Update AdminNewsletterController.php

This commit is contained in:
Abhishek Kumar
2023-09-14 11:25:21 +05:30
parent 106303a401
commit 336b64d7e1

View File

@@ -296,11 +296,13 @@ class AdminNewsletterController extends ModuleAdminController
public function postProcess()
{
if (Tools::isSubmit('submitNewsletterOptions')) {
$voucherCode = trim(Tools::getValue('NW_VOUCHER_CODE'));
if ($voucherCode && !Validate::isDiscountName($voucherCode)) {
$this->errors[] = $this->l('The voucher code is invalid.');
} elseif (!CartRule::cartRuleExists($voucherCode)) {
$this->errors[] = $this->l('The voucher code does not exist.');
$voucherCode = Tools::getValue('NW_VOUCHER_CODE');
if (Tools::strlen($voucherCode) > 0) {
if (!Validate::isDiscountName($voucherCode)) {
$this->errors[] = $this->l('The voucher code is invalid.');
} elseif (!CartRule::cartRuleExists($voucherCode)) {
$this->errors[] = $this->l('The voucher code does not exist.');
}
}
if (!count($this->errors)) {