Prestashop-将搜索的产品结果检索到自定义模块

Prestashop-将搜索的产品结果检索到自定义模块,prestashop,prestashop-1.6,prestashop-1.5,Prestashop,Prestashop 1.6,Prestashop 1.5,当用户执行了预搜索结果时,我需要在我的模块中从SearchController.php检索($search['result']) 我的代码是下一个 public function hookActionSearch($params) { $my_var = $this->context->smarty; //1st test $my_var = $this->context->controller; //2nd test $my_var = $params

当用户执行了预搜索结果时,我需要在我的模块中从SearchController.php检索($search['result'])

我的代码是下一个

public function hookActionSearch($params)
{
   $my_var = $this->context->smarty; //1st test
   $my_var = $this->context->controller; //2nd test
   $my_var = $params; //3rd test
   $var_dump($my_var); //in the three cases Couldn't see on the dump the $search var or $search_result in the smarty case
}

如何在var中检索此结果?

只有2个参数传递给该钩子实现:

  • $params['query']-这是客户搜索的字符串
  • $params['total']-这是结果的总数
  • 搜索结果未被传递,因此无法通过这种方式获取

    要获得它们,您需要重写SearchController::initContent()并添加另一个钩子,您必须在该钩子上传递结果并在模块中实现