Grazie mille sembra che adesso funziona tutto alla perfezione, ho solo modiciato il codice nella parte
($item['discount'] == 1) sostituito con ($val['discount'] == 1)
foreach ($this->cart_contents as $key => $val){
// make sure the array contains the proper indexes
if(!is_array($val) OR !isset($val['price'], $val['qty'])){
continue;
}
$this->cart_contents['total_items'] += $val['qty'];
if($val['qty']<=3 || $item['discount'] == 0)
{
$this->cart_contents[$key]['subtotal'] = ($this->cart_contents[$key]['price'] * $this->cart_contents[$key]['qty']);
}
if (($val['qty']>=4) && ($val['discount'] == 1)) {
$this->cart_contents[$key]['subtotal'] = ($this->cart_contents[$key]['price'] * $this->cart_contents[$key]['qty']/1.10);
}
if (($val['qty']>=8) && ($val['discount'] == 1)){
$this->cart_contents[$key]['subtotal'] = ($this->cart_contents[$key]['price'] * $this->cart_contents[$key]['qty']/1.15);
}
if (($val['qty']>=12) && ($val['discount'] == 1)){
$this->cart_contents[$key]['subtotal'] = ($this->cart_contents[$key]['price'] * $this->cart_contents[$key]['qty']/1.20);
}
if (($val['qty']>15) && ($val['discount'] == 1)) {
$this->cart_contents[$key]['subtotal'] = ($this->cart_contents[$key]['price'] * $this->cart_contents[$key]['qty']/1.30);
}
$this->cart_contents['cart_total'] += $this->cart_contents[$key]['subtotal']; // Aggiungi questo
}
un cosa bella sarebbe che cambiasse anche il valore prezzo unitario in base all sconto, esempio quando si arriva con il combo a 4 unitá il prezzo cambiasse invece di 300$ ponesse 273$
ceil(prezzo / 1.10), avevo fatto varie prove pero non funzionavano
ti posto il link del carrello:
http://cietesting.com/