// previous fix fix

This commit is contained in:
fBrignoli
2012-05-10 15:51:05 +00:00
parent aff0019b48
commit ddc49dcba0
+13 -6
View File
@@ -325,10 +325,11 @@ abstract class PaymentModuleCore extends Module
$cart_rules_list = ''; $cart_rules_list = '';
$cart_rules = $cart->getCartRules(); $cart_rules = $cart->getCartRules();
$values = array('tax_incl' => 0, 'tax_excl' => 0); $total_cart_rules = array('tax_incl' => 0, 'tax_excl' => 0);
foreach ($cart_rules as $cart_rule) foreach ($cart_rules as $cart_rule)
{ {
$values = array('tax_incl' => 0, 'tax_excl' => 0);
// If the cart is split in multiple orders, the cart rule must be split too // If the cart is split in multiple orders, the cart rule must be split too
if (count($order_list) > 1) if (count($order_list) > 1)
{ {
@@ -367,14 +368,20 @@ abstract class PaymentModuleCore extends Module
} }
else else
{ {
$values['tax_incl'] += $cart_rule['obj']->getContextualValue(true); $values = array(
$values['tax_excl'] += $cart_rule['obj']->getContextualValue(false); 'tax_incl' => $cart_rule['obj']->getContextualValue(true),
'tax_excl' => $cart_rule['obj']->getContextualValue(false)
);
} }
// If the reduction is not applicable to this order (in a multi-shipping case), then try the next // If the reduction is not applicable to this order (in a multi-shipping case), then try the next
if (!$values['tax_excl']) if (!$values['tax_excl'])
continue; continue;
$total_cart_rules['tax_incl'] += $values['tax_incl'];
$total_cart_rules['tax_excl'] += $values['tax_excl'];
/* IF /* IF
** - This is not multi-shipping ** - This is not multi-shipping
** - The value of the voucher is greater than the total of the order ** - The value of the voucher is greater than the total of the order
@@ -420,8 +427,8 @@ abstract class PaymentModuleCore extends Module
$order->addCartRule($cart_rule['obj']->id, $cart_rule['obj']->name, $values); $order->addCartRule($cart_rule['obj']->id, $cart_rule['obj']->name, $values);
$order->total_discounts = $order->total_discounts_tax_incl = round($values['tax_incl'], 9); $order->total_discounts = $order->total_discounts_tax_incl = round($total_cart_rules['tax_incl'], 9);
$order->total_discounts_tax_excl = round($values['tax_excl'], 9); $order->total_discounts_tax_excl = round($total_cart_rules['tax_excl'], 9);
$order->update(); $order->update();
if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && !in_array($cart_rule['obj']->id, $cart_rule_used)) if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && !in_array($cart_rule['obj']->id, $cart_rule_used))