2017-07-27 143 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