2017-04-17 16 views
0

我试图在my-theme/modules/productcomments/tab.tpl上显示产品名称,但它有时会起作用。

我不知道为什么,但有些产品页面显示他们而不是其他人。

代码很简单。我添加了{$ product-> name},但有时$ product是空的。

任何帮助,将不胜感激

回答

0

修改this line的代码,这

$this->context->smarty->assign(array(
    'product' => $params['product'], 
    'averageTotal' => round($average['grade']), 
    'ratings' => ProductComment::getRatings($id_product), 
    'nbComments' => (int) ProductComment::getCommentNumber($id_product), 
)); 

,看看能否解决。

我注意到自己,当我将相关产品列表添加到产品页面时,这些变量全部搞砸了。换成其他产品的数据,有时product变量为空。

如果此问题解决了问题,您可能需要覆盖productcomments模块并修复其中的代码,否则模块更新时您的更改将会丢失。

+0

我试图覆盖模块类,并直接在模块文件上进行更改。它不起作用。 – Inbloo