我正在使用prestashop。我已经搜索过功能了。 但这对产品有用,我希望进行搜索搜索 页面和类别中的关键字也是。
我有来自当前正在运行的SearchController.php的脚本。有什么想法吗?
<?php
if (($query = Tools::getValue('search_query', Tools::getValue('ref'))) && !is_array($query))
{
$this->productSort();
$this->n = abs((int)(Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE'))));
$this->p = abs((int)(Tools::getValue('p', 1)));
$search = Search::find($this->context->language->id, $query, $this->p, $this->n, $this->orderBy, $this->orderWay);
Hook::exec('actionSearch', array('expr' => $query, 'total' => $search['total']));
$nbProducts = $search['total'];
$this->pagination($nbProducts);
$this->context->smarty->assign(array(
'products' => $search['result'], // DEPRECATED (since to 1.4), not use this: conflict with block_cart module
'search_products' => $search['result'],
'nbProducts' => $search['total'],
'search_query' => $query,
'homeSize' => Image::getSize('home_default')));
}
?>