From 9b3965425efa349e5acb75382b9f3a61b2e86a3a Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 20 Dec 2012 17:12:53 +0100 Subject: [PATCH] [-] FO : changed behavior of the cart rules when the carrier and the address are not determined yet --- classes/CartRule.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/CartRule.php b/classes/CartRule.php index 5f1bf625a..b922bfeab 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -414,8 +414,10 @@ class CartRuleCore extends ObjectModel } // Check if the customer delivery address is usable with the cart rule - if ($this->country_restriction && $context->cart->id_address_delivery) + if ($this->country_restriction) { + if (!$context->cart->id_address_delivery) + return (!$display_error) ? false : Tools::displayError('You must choose a delivery address before applying this voucher to your order'); $id_cart_rule = (int)Db::getInstance()->getValue(' SELECT crc.id_cart_rule FROM '._DB_PREFIX_.'cart_rule_country crc @@ -426,8 +428,10 @@ class CartRuleCore extends ObjectModel } // Check if the carrier chosen by the customer is usable with the cart rule - if ($this->carrier_restriction && $context->cart->id_carrier) + if ($this->carrier_restriction) { + if (!$context->cart->id_carrier) + return (!$display_error) ? false : Tools::displayError('You must choose a carrier before applying this voucher to your order'); $id_cart_rule = (int)Db::getInstance()->getValue(' SELECT crc.id_cart_rule FROM '._DB_PREFIX_.'cart_rule_carrier crc