[-] FO : cart rules are now removed when the cart is empty #PSTEST-1205

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14858 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
dMetzger
2012-04-24 17:10:32 +00:00
parent 2a97927eba
commit 0af6a2f360
+7 -2
View File
@@ -1159,8 +1159,13 @@ class CartCore extends ObjectModel
{
// refresh cache of self::_products
$this->_products = $this->getProducts(true);
/* Update cart */
return $this->update(true);
$return = $this->update(true);
// If there isn't any product left, remove all the cart rules associated
if (!$this->nbProducts())
$result = Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cart_cart_rule` WHERE `id_cart` = '.(int)$this->id);
return $return;
}
return false;