在管理模块中启用jquery2 for prestashop 1.7
问题描述:
我正在使用prestashop 1.7.2.0编写一个管理模块,该模块添加csv文件的嵌套类别和产品。我明白,addJQuery()
已被弃用,我试图让jquery代码工作。 I get Uncaught ReferenceError: $ is not defined
。在管理模块中启用jquery2 for prestashop 1.7
我创建了一个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
,我仍然得到了同样的错误。我错过了什么?
感谢
答
可以包括$this->context->controller->addJquery();
在hookDisplayBackOfficeHeader()
功能的第一道防线。
$ this-> context-> controller-> addJquery(); – ufk