我正在使用prestashop 1.7.2.0编写一个管理模块,用于添加csv文件中的嵌套类别和产品。我知道addJQuery()
已被弃用,我正试图让jquery代码工作。 I get Uncaught ReferenceError: $ is not defined
。
我创建了一个displayBackOfficeHeader
钩子,其中包含以下内容:
public function hookDisplayBackOfficeHeader(){
$this->context->controller->addJS($this->_path.'/js/jqShim.min.js');
$this->context->controller->addCSS($this->_path.'/css/getcontent.css');
$this->context->controller->addJS($this->_path.'/js/getcontent.js');
}
你可以看到我试过包括jqShim.min.js
,但我仍然遇到了同样的错误。我错过了什么?
由于
答案 0 :(得分:1)
您可以在$this->context->controller->addJquery();
功能的第一行添加hookDisplayBackOfficeHeader()
。