Prestashop模块产品注释
我正在尝试调整产品评论“添加评论功能”(位于产品页面上)以在产品列表页面上工作,但链接仅识别列表中的第一个产品。列表中的每个产品旁边都有一个铅笔图标链接,但它们都只链接到第一个产品 有人能告诉我为什么会发生这种情况,并为我指出解决问题的正确方向吗 以下是我的自定义挂钩中的代码:Prestashop模块产品注释,prestashop,Prestashop,我正在尝试调整产品评论“添加评论功能”(位于产品页面上)以在产品列表页面上工作,但链接仅识别列表中的第一个产品。列表中的每个产品旁边都有一个铅笔图标链接,但它们都只链接到第一个产品 有人能告诉我为什么会发生这种情况,并为我指出解决问题的正确方向吗 以下是我的自定义挂钩中的代码: include_once dirname(__FILE__).'/ProductComment.php'; include_once dirname(__FILE__).'/ProductCommentCrite
include_once dirname(__FILE__).'/ProductComment.php';
include_once dirname(__FILE__).'/ProductCommentCriterion.php';
if(in_array($this->context->controller->php_self, array('product-list'))) $products = Product::getProducts((int) Tools::getValue('id_product'), $this->context->language->id);
{
$id_guest = (!$id_customer = (int) $this->context->cookie->id_customer) ? (int) $this->context->cookie->id_guest : false;
$customerComment = ProductComment::getByCustomer((int) (Tools::getValue('id_product')), (int) $this->context->cookie->id_customer, true, (int) $id_guest);
$average = ProductComment::getAverageGrade((int) Tools::getValue('id_product'));
$image = Product::getCover((int) Tools::getValue('id_product'));
$cover_image = $this->context->link->getImageLink($product->link_rewrite, $image['id_image'], 'medium_default');
$this->context->smarty->assign(array(
'id_product_comment_form' => (int) Tools::getValue('id_product'),
'product' => $products,
'secure_key' => $this->secure_key,
'logged' => $this->context->customer->isLogged(true),
'allow_guests' => (int) Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'),
'productcomment_cover' => (int) Tools::getValue('id_product').'-'.(int) $image['id_image'], // retro compat
'productcomment_cover_image' => $cover_image,
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
'criterions' => ProductCommentCriterion::getByProduct((int) Tools::getValue('id_product'), $this->context->language->id),
'action_url' => '',
'averageTotal' => round($average['grade']),
'ratings' => ProductComment::getRatings((int) Tools::getValue('id_product')),
'too_early' => ($customerComment && (strtotime($customerComment['date_add']) + Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME')) > time()),
'nbComments' => (int) (ProductComment::getCommentNumber((int) Tools::getValue('id_product'))),
));
return $this->display(__FILE__, '/mytemplate.tpl');
}
这是我的模板中的代码:
<SCRIPT>
$(document).ready(function() {
if (!!$.prototype.fancybox)
$('.open-comment-form').fancybox({
'autoSize' : false,
'width': 800,
'height': auto,
'hideOnContentClick': false,
'title' : null,
});
});
</SCRIPT>
{if (!$too_early AND ($is_logged OR ($PRODUCT_COMMENTS_ALLOW_GUESTS == 0)))}
<p class="align_center">
<a class="open-comment-form" href="#new_comment_form" title="{l s='Write your review' mod='productcomments'}!"></a>
</p>
{/if}
$(文档).ready(函数(){
if(!!$.prototype.fancybox)
$('.open comment form').fancybox({
“自动大小”:false,
“宽度”:800,
“高度”:自动,
“hideOnContentClick”:false,
“title”:null,
});
});
{如果(!$too_-early和($is_-logged或($PRODUCT_-COMMENTS_-ALLOW_-GUESTS==0))}
{/if}
我使用的是Prestashop版本1.6.1.14。谢谢aussiecomet我问这个问题已经13天了,但我仍然没有回答。难道没有人能帮助解决这个问题吗?我不想让你解决它,只要告诉我必须做什么,我会做的,毕竟这是你学习的方式。我可以提供更多细节,但除非有人表示有兴趣帮忙。谢谢当然,你可以给出更多的细节,也许是一些你如何生成链接的代码。您正在使用的Prestashop版本也会有所帮助。当你基本上在问“为什么这不起作用?”而没有任何具体细节时,你希望人们如何帮助你。你不会去找机械师,告诉他“我的车坏了…”对吧?我会再试一次。我对这个问题仍然没有答案。没有人愿意帮忙!!直到你发表评论,我才看到你编辑了你的问题。这里有两件事可以直接跳出来:
Product::getProducts((int)Tools::getValue('id_Product'),$this->context->language->id)代码>不知道当您在产品列表中时,您如何获得产品的id\u
价值,可能它是第一个产品,所以这是您的第一个问题。第二个问题是方法参数有误。寻找方法参数。谢谢你给了我一些可以使用的东西。在澳大利亚已经很晚了,所以我明天要做这件事。再次感谢!