From 564903dfdfca6922e6c15529b8a3e4609dabceef Mon Sep 17 00:00:00 2001 From: dMetzger Date: Mon, 4 Jun 2012 08:23:28 +0000 Subject: [PATCH] // Fixed #PSCFV-2605 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15803 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Cart.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index 52f361a8c..660a0e973 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -1169,17 +1169,7 @@ class CartCore extends ObjectModel $return = $this->update(true); // refresh cache of self::_products $this->_products = $this->getProducts(true); - - // If there isn't any product left (which does not belong to a cart rule), remove all the cart rules associated to this cart - // Compare the quantity of products in the cart and the quantity of product offered (you can't simply compare the product itself, because the same product can be paid and free (2 products bought, 1 free)) - $quantity_in_cart = 0; - if ($this->_products) - foreach ($this->_products as $product) - $quantity_in_cart += $product['cart_quantity']; - $count_free_products = Db::getInstance()->getValue('SELECT count(*) FROM `'._DB_PREFIX_.'cart_cart_rule` ccr LEFT JOIN `'._DB_PREFIX_.'cart_rule` cr ON ccr.id_cart_rule = cr.id_cart_rule WHERE `id_cart` = '.(int)$this->id.' AND gift_product != 0'); - if ($quantity_in_cart <= $count_free_products) - foreach ($this->getCartRules() as $cart_rule) - $this->removeCartRule($cart_rule['id_cart_rule']); + CartRule::autoRemoveFromCart(); return $return; }