// Small fixes for cart rules

This commit is contained in:
dMetzger
2012-01-27 14:38:04 +00:00
parent ec97c81508
commit 6ce19f8427
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ class OrderOpcControllerCore extends ParentOrderController
$this->context->smarty->assign('is_multi_address_delivery', $this->context->cart->isMultiAddressDelivery()); $this->context->smarty->assign('is_multi_address_delivery', $this->context->cart->isMultiAddressDelivery());
$this->isLogged = (bool)($this->context->customer->id && Customer::customerIdExistsStatic((int)($this->context->cookie->id_customer))); $this->isLogged = (bool)($this->context->customer->id && Customer::customerIdExistsStatic((int)$this->context->cookie->id_customer));
if ($this->context->cart->nbProducts()) if ($this->context->cart->nbProducts())
{ {
+2 -2
View File
@@ -92,13 +92,13 @@ class ParentOrderControllerCore extends FrontController
{ {
if (Tools::isSubmit('submitAddDiscount')) if (Tools::isSubmit('submitAddDiscount'))
{ {
if (!($code = Tools::getValue('discount_name'))) if (!($code = trim(Tools::getValue('discount_name'))))
$this->errors[] = Tools::displayError('You must enter a voucher code'); $this->errors[] = Tools::displayError('You must enter a voucher code');
elseif (!Validate::isDiscountName($code)) elseif (!Validate::isDiscountName($code))
$this->errors[] = Tools::displayError('Voucher code invalid'); $this->errors[] = Tools::displayError('Voucher code invalid');
else else
{ {
if ($cartRule = new CartRule(CartRule::getIdByCode($code)) && Validate::isLoadedObject($cartRule)) if (($cartRule = new CartRule(CartRule::getIdByCode($code))) && Validate::isLoadedObject($cartRule))
{ {
if ($error = $cartRule->checkValidity($this->context)) if ($error = $cartRule->checkValidity($this->context))
$this->errors[] = $error; $this->errors[] = $error;