我创建了prestashop模块,并带有一个钩子来显示我的特定搜索表单。
public function hookDisplayTopColumn($params)
{
$this->context->controller->addCSS($this->_path.'css/modelfilter.css', 'all');
$this->context->controller->addJS($this->_path.'js/modelfilter.js');
$marque = $this->getSubCategories($this->marquesCategory);
$this->context->smarty->assign(array(
'marques' => $marque,
));
return $this->display(__FILE__, 'form_model.tpl');
}
Run Code Online (Sandbox Code Playgroud)
不包括JS和CSS文件。为了找到原因,我在classes / controller / FrontController.php中添加了一个解析行:
public function addMedia($media_uri, $css_media_type = null, $offset = null, $remove = false, $check_path = true)
{
echo 'addMedia '.$media_uri."<br/>\n";
Run Code Online (Sandbox Code Playgroud)
结果是:所有css / js文件都出现在页面开始之前(<body>紧随在之后),但是我的文件出现在显示form_model.tpl之前。
请,如何使我的文件及时被调用?