2
正在prestashop 1.5中开发一个模块。我正在使用displayAdminProductsExtra挂钩在admin选项卡中显示tpl文件。当我在tpl中包含我的jquery代码时,它工作正常。但是当我尝试将其作为新文件并包含其不工作时。到目前为止,我尝试下面的方法..如何在prestashop 1.5中添加JS模块?
使用displayBackOfficeHeader注册一个钩子,并呼吁这样的..
public function hookdisplayBackOfficeHeader($params)
{
$this->context->controller->addJS(($this->_path).'abc.js');
}
,我试着将它添加在displayAdminProductsExtra也是这样..
$this->context->controller->addJS(_MODULE_DIR_.$this->module->name.'/views/js/abc.js'); //first tried..
$this->context->controller->addJS(($this->_path).'abc.js','all'); //second tried this..
我试图用这样的getContent ..
public function getContent()
{
$this->_html= '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js">
<script src="../modules/abc/abc.js" type="text/javascript" ></script>';
return $this->_html;
}
但这些方法没有添加我的js文件。不知道我在哪里犯错。任何帮助将不胜感激。
[看看本作详细的解答](http://www.vipulhadiya.com/prestashop-module-development-tutorial-creating-front-and-admin-view-in-prestashop-module /) –
下次再说。 –