From ce43fd035b09d8075cc9e2b9246849461fc48c14 Mon Sep 17 00:00:00 2001 From: dMetzger Date: Mon, 6 Feb 2012 16:29:47 +0000 Subject: [PATCH] // Fixed small bug which occured when you refreshed a reduction on a selection of product on an order that did not match the selection anymore --- classes/CartRule.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/classes/CartRule.php b/classes/CartRule.php index 90d103c05..84bb3498b 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -655,14 +655,13 @@ class CartRuleCore extends ObjectModel { $selectedProductsReduction = 0; $selectedProducts = $this->checkProductRestrictions($context, true); - foreach ($context->cart->getProducts() as $product) - { - if (in_array($product['id_product'], $selectedProducts)) - { - $price = ($useTax ? $product['price_wt'] : $product['price']); - $selectedProductsReduction += $price * $product['cart_quantity']; - } - } + if (is_array($selectedProducts)) + foreach ($context->cart->getProducts() as $product) + if (in_array($product['id_product'], $selectedProducts)) + { + $price = ($useTax ? $product['price_wt'] : $product['price']); + $selectedProductsReduction += $price * $product['cart_quantity']; + } $reductionValue += $selectedProductsReduction * $this->reduction_percent / 100; }