// Small fixes for cart rules
This commit is contained in:
@@ -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())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user