问题描述
我的自定义模块出现错误。 我需要在产品管理页面上添加其他文本。 我使用了钩子“ hookdisplayAdminProductsMainStepLeftColumnMiddle”,它显示了带有信息的tpl(在图像上是文本“Informaciónadicional relacionada”)。
问题是,当模块处于活动状态时,产品管理页面无法完成充电。
所以我无法保存产品或做任何事情。
这是挂钩的代码
public function hookdisplayAdminProductsMainStepLeftColumnMiddle($params)
{
$product = new Product($params['id_product']);
$this->context->smarty->assign(array(
'product ' => $product,)
);
return $this->display($this->_path,'/views/templates/admin/admininfo.tpl');
}
如果我仅评论“ return ....”行,那么它当然不会显示,但是产品页面会正确收费。
在tpl上,我只写文本,甚至都没有变量。
其他代码似乎正常工作。我已经在模块上注释了javascript代码。 控制台上甚至日志上都没有错误或警告。 我已经激活了调试模式,但是甚至没有显示任何错误。
任何想法或建议都会感激不尽!
解决方法
尝试使用:
$tpl = $this->context->smarty->createTemplate(
dirname(__FILE__).'/views/templates/admin/yourtemplate.tpl'
);
然后:
return $tpl->fetch();