在prestashop 1.7的管理模块中启用jquery2

时间:2017-07-27 21:44:56

标签: php prestashop prestashop-1.7

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

由于

1 个答案:

答案 0 :(得分:1)

您可以在$this->context->controller->addJquery();功能的第一行添加hookDisplayBackOfficeHeader()