Prestashop 加载产品编辑页面上的“组合”选项卡时,应该使用哪个钩子来运行脚本
我正在为prestashop 1.5开发一个新模块 我需要在产品编辑页面的“组合”选项卡上添加一行html代码。 我在template/controllers/products/combinations.tpl中找不到任何特定的钩子 所以我决定使用jQuery动态添加这一行 作为临时解决方案,我使用displayAdminProductsExtra钩子。我在included.tpl中有一个脚本,它隐藏了左侧的额外选项卡,并将reuired行添加到“combinations”选项卡中 显然,这不是最好的解决办法。 首先,加载额外的选项卡内容需要1-2秒,因此左侧的选项卡会延迟隐藏。第二,这种方式看起来不太合适 所以我的问题是:加载“组合”选项卡时,运行脚本的最佳方式是什么Prestashop 加载产品编辑页面上的“组合”选项卡时,应该使用哪个钩子来运行脚本,prestashop,prestashop-1.5,Prestashop,Prestashop 1.5,我正在为prestashop 1.5开发一个新模块 我需要在产品编辑页面的“组合”选项卡上添加一行html代码。 我在template/controllers/products/combinations.tpl中找不到任何特定的钩子 所以我决定使用jQuery动态添加这一行 作为临时解决方案,我使用displayAdminProductsExtra钩子。我在included.tpl中有一个脚本,它隐藏了左侧的额外选项卡,并将reuired行添加到“combinations”选项卡中 显然,这不是
如果有更好的方法向“组合”选项卡添加一行html代码,那就更好了:)您确实可以通过覆盖其模板将html添加到组合选项卡 为此,您必须在模块中创建一个文件:
modules/your_module/override/controllers/admin/templates/products/combinations.tpl 在此文件中复制以下代码:
{include file="controllers/products/combinations.tpl"}
// Add here your html code
<p style="color:red;text-align:center;">Add a text after the form</p>
{include file=“controllers/products/combinations.tpl”}
//在这里添加您的html代码
在表单后添加文本
不幸的是,当人们安装您的模块时,Prestashop不会自动将此文件复制到需要处理的位置
要复制此文件,您必须在安装函数中添加本主题中提供的代码: