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

This commit is contained in:
dMetzger
2012-04-24 17:10:32 +00:00
parent a2679455ed
commit b8d97dbb02
+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;