diff --git a/classes/CartRule.php b/classes/CartRule.php index 0461d53e7..9bc2a1f9f 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -1195,14 +1195,14 @@ class CartRuleCore extends ObjectModel * @param $id_lang * @return array */ - public static function getCartsRuleByCode($name, $id_lang) + public static function getCartsRuleByCode($name, $id_lang, $extended = false) { return Db::getInstance()->executeS(' SELECT cr.*, crl.* FROM '._DB_PREFIX_.'cart_rule cr LEFT JOIN '._DB_PREFIX_.'cart_rule_lang crl ON (cr.id_cart_rule = crl.id_cart_rule AND crl.id_lang = '.(int)$id_lang.') - WHERE code LIKE \'%'.pSQL($name).'%\' OR name LIKE \'%'.pSQL($name).'%\' - '); + WHERE code LIKE \'%'.pSQL($name).'%\'' + .($extended ? ' OR name LIKE \'%'.pSQL($name).'%\'' : '')); } } diff --git a/controllers/admin/AdminCartRulesController.php b/controllers/admin/AdminCartRulesController.php index 6689f023f..1372e1379 100644 --- a/controllers/admin/AdminCartRulesController.php +++ b/controllers/admin/AdminCartRulesController.php @@ -595,7 +595,7 @@ class AdminCartRulesControllerCore extends AdminController public function displayAjaxSearchCartRuleVouchers() { $found = false; - if ($vouchers = CartRule::getCartsRuleByCode(Tools::getValue('q'), (int)$this->context->language->id)) + if ($vouchers = CartRule::getCartsRuleByCode(Tools::getValue('q'), (int)$this->context->language->id, true)) $found = true; echo Tools::jsonEncode(array('found' => $found, 'vouchers' => $vouchers)); }