如何将文本添加到微型列表块
how to add text to the miniature list block
我正在为 prestashop 1.7 创建一个模块,我想在此块中添加一个文本,但我不知道该怎么做:
不知道要不要用hook,用哪个!
edit : 不修改主题的tpl文件
谢谢!
你可以使用这个钩子:
{hook h='displayProductPriceBlock' product=$product type="before_price"}
public function HookDisplayProductPriceBlock($params)
{
if ($params['type'] == "before_price") {
return 'TEXT'; // or return TPL file
}
}
更新:
在您的模块上,您只需在安装过程中注册 "displayProductPriceBlock" 钩子并将上述函数添加到 yourmodule.php 文件中。
我正在为 prestashop 1.7 创建一个模块,我想在此块中添加一个文本,但我不知道该怎么做:
不知道要不要用hook,用哪个!
edit : 不修改主题的tpl文件 谢谢!
你可以使用这个钩子:
{hook h='displayProductPriceBlock' product=$product type="before_price"}
public function HookDisplayProductPriceBlock($params)
{
if ($params['type'] == "before_price") {
return 'TEXT'; // or return TPL file
}
}
更新:
在您的模块上,您只需在安装过程中注册 "displayProductPriceBlock" 钩子并将上述函数添加到 yourmodule.php 文件中。