From 01be908e517d37b1aad9595fd81b9bc897fe82d5 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 11 Sep 2013 14:50:42 +0200 Subject: [PATCH] [-] CORE : Could not add several cart rules --- classes/Cart.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/Cart.php b/classes/Cart.php index f477f38b0..d19fb0ab0 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -762,10 +762,11 @@ class CartCore extends ObjectModel { // You can't add a cart rule that does not exist $cartRule = new CartRule($id_cart_rule, Context::getContext()->language->id); + if (!Validate::isLoadedObject($cartRule)) return false; - if (Db::getInstance()->getValue('SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$this->id)) + if (Db::getInstance()->getValue('SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart_rule = '.(int)$id_cart_rule.' AND id_cart = '.(int)$this->id)) return false; // Add the cart rule to the cart