From 76f1dd5c52a5efbaa84a4a444f39d92d080a4f49 Mon Sep 17 00:00:00 2001 From: Gregory Roussac Date: Thu, 2 Apr 2015 15:03:59 +0200 Subject: [PATCH] [-] FO : Exception in Cart.php // norms --- classes/Cart.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index c8972c198c432..93f4caa570e11 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -2171,10 +2171,14 @@ public function getDeliveryOptionList(Country $default_country = null, $flush = } $cart_rules = CartRule::getCustomerCartRules(Context::getContext()->cookie->id_lang, Context::getContext()->cookie->id_customer, true, true, false, $this, true); - $result = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart='.$this->id); + + $result = false; + if ($this->id) + $result = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$this->id); + $cart_rules_in_cart = array(); - if (is_array($result) && count($result)) + if (is_array($result)) foreach ($result as $row) $cart_rules_in_cart[] = $row['id_cart_rule'];