当用户执行了预处理搜索结果时,我需要从我的模块中的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中检索此结果?
只有两个参数传递给该钩子实现:
- $params['query']-这是客户搜索的字符串
- $params['total']-这是结果的总数
搜索结果没有被传递,因此您无法通过这种方式获取它们。
要获得它们,您需要重写SearchController::initContent()并添加另一个钩子,您必须在该钩子上传递结果并在模块中实现。