[+] Classes : Helper::renderAdminCategorieTree() have new params "$use_search" to add a input search
This commit is contained in:
@@ -906,3 +906,33 @@ if (Tools::isSubmit('ajaxFeaturesPositions'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('searchCategory'))
|
||||
{
|
||||
$q = Tools::getValue('q');
|
||||
$limit = Tools::getValue('limit');
|
||||
$results = Db::getInstance()->executeS(
|
||||
'SELECT c.`id_category`, cl.`name`
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.$context->shop->sqlLang('cl').')
|
||||
WHERE cl.`id_lang` = '.(int)($context->language->id).'
|
||||
AND cl.`name` LIKE \'%'.pSQL($q).'%\'
|
||||
GROUP BY c.id_category
|
||||
ORDER BY c.`position`
|
||||
LIMIT '.(int)$limit);
|
||||
if ($results)
|
||||
foreach ($results AS $result)
|
||||
echo trim($result['name']).'|'.(int)($result['id_category'])."\n";
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getParentCategoriesId') AND $id_category = Tools::getValue('id_category'))
|
||||
{
|
||||
$category = new Category((int)$id_category);
|
||||
$results = Db::getInstance()->executeS('SELECT `id_category` FROM `'._DB_PREFIX_.'category` c WHERE c.`nleft` < '.(int)$category->nleft.' AND c.`nright` > '.(int)$category->nright.'');
|
||||
$output = array();
|
||||
foreach($results as $result)
|
||||
$output[] = $result;
|
||||
|
||||
die(Tools::jsonEncode($output));
|
||||
}
|
||||
|
||||
|
||||
@@ -3106,9 +3106,10 @@ class AdminProducts extends AdminTab
|
||||
'Collapse All' => $this->l('Collapse All'),
|
||||
'Expand All' => $this->l('Expand All'),
|
||||
'Check All' => $this->l('Check All'),
|
||||
'Uncheck All' => $this->l('Uncheck All')
|
||||
'Uncheck All' => $this->l('Uncheck All'),
|
||||
'search' => $this->l('Search a category')
|
||||
);
|
||||
echo Helper::renderAdminCategorieTree($trads, $selectedCat).'
|
||||
echo Helper::renderAdminCategorieTree($trads, $selectedCat, 'categoryBox', false, true).'
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
|
||||
|
||||
Reference in New Issue
Block a user