Хак "Общие скидки"
Открываем clases/cart.php и в самом конце пишем:
Код:
function oTotal()
{
$products = $this->getProducts();
foreach ($products AS $product)
{
$price = floatval(Product::getPriceStatic(intval($product['id_product']), $withTaxes, intval($product['id_product_attribute']), 6, NULL, false, true, $product['quantity']));
$total_price = $price * intval($product['quantity']);
$order_total += $total_price;
}
return intval($order_total);
}
function oDiscount()
{
# параметры
$th1 = 1000;
$th2 = 5000;
$d1 = 10;
$d2 = 20;
if ($this->oTotal() >= $th1 and $this->oTotal() < $th2) {$discounts = $d1;}
if ($this->oTotal() >= $th2) {$discounts = $d2;}
return $discounts;
}
в функции function getOrderTotal меняем
Код:
return floatval($order_total);
на
Код:
return $order_total-$this->oDiscount();