[-] BO : getCartsRuleByCode should be retrocompatible
This commit is contained in:
@@ -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).'%\'' : ''));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user