[-] FO : changed behavior of the cart rules when the carrier and the address are not determined yet

This commit is contained in:
Damien Metzger
2012-12-20 17:13:11 +01:00
parent 30a477dd22
commit 9b3965425e
+6 -2
View File
@@ -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