// Retro compatibility for Discount

This commit is contained in:
dMetzger
2011-11-02 10:47:01 +00:00
parent e7c0b0bdf9
commit 7f830c2f4e
6 changed files with 215 additions and 481 deletions
+3 -3
View File
@@ -286,8 +286,8 @@ class CartCore extends ObjectModel
foreach ($result as &$row)
{
$cartRule = new CartRule($row['id_cart_rule'], (int)$this->id_lang);
$row['value_real'] = $cartRule->getValue(true);
$row['value_tax_exc'] = $cartRule->getValue(false);
$row['value_real'] = $cartRule->getContextualValue(true);
$row['value_tax_exc'] = $cartRule->getContextualValue(false);
// Retro compatibility < 1.5.0.2
$row['id_discount'] = $row['id_cart_rule'];
@@ -1032,7 +1032,7 @@ class CartCore extends ObjectModel
{
$result = $this->getCartRules();
foreach (ObjectModel::hydrateCollection('CartRule', $result, Configuration::get('PS_LANG_DEFAULT')) AS $cartRule)
$order_total_discount += Tools::ps_round($cartRule->getValue($withTaxes));
$order_total_discount += Tools::ps_round($cartRule->getContextualValue($withTaxes));
$order_total_discount = min(Tools::ps_round($order_total_discount), $wrapping_fees + $order_total_products + $shipping_fees);
$order_total -= $order_total_discount;
}