2017-07-27 145 views
0

我正在使用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,我仍然得到了同样的错误。我错过了什么?

感谢

回答

1

可以包括$this->context->controller->addJquery();hookDisplayBackOfficeHeader()功能的第一道防线。

+0

$ this-> context-> controller-> addJquery(); – ufk