【发布时间】:2011-06-27 12:31:14
【问题描述】:
我希望在 magento 产品页面的侧边栏中显示该产品的最新评论(可能是 3 或 4 条)。
显示评论的前 10 或 15 个单词、星号栏和评论页面的链接以查看所有评论..
非常感谢任何建议或指示,
谢谢,
强尼
【问题讨论】:
我希望在 magento 产品页面的侧边栏中显示该产品的最新评论(可能是 3 或 4 条)。
显示评论的前 10 或 15 个单词、星号栏和评论页面的链接以查看所有评论..
非常感谢任何建议或指示,
谢谢,
强尼
【问题讨论】:
正如 ElGabby 所说,创建一个扩展是可行的方法。
但您可以通过编辑当前布局来做到这一点。
转到 /app/design/frontend/default/[your theme]/layout/ 或 /app/design/frontend/base/[your theme]/layout/ 中的文件 catalog.xml
找到该部分:
<catalog_product_view>
在那里你很可能有一个类似的部分:
<reference name="right">
在该部分添加:
<block type="review/product_view" name="right.rewiev" template="review/rightbar.phtml" />
我的示例中的部分如下所示:
<reference name="right">
<block type="review/product_view" name="right.rewiev" template="review/rightbar.phtml" />
<block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/>
</reference>
保存文件并在以下位置创建一个新文件: /app/design/frontend/default/[你的主题]/design/review/rightbar.phtml
该文件的内容类似于:
<?php $collection = $this->getReviewsCollection(); ?>
<?php if(count($collection) > 0):?>
<?php foreach ($collection as $rating):?>
<?php echo $rating->title //title of the rewiev?>
<?php echo $rating->detail //content of the rewiev?>
<?php echo $rating->created_at //data rewiev is created?>
<?php endforeach;?>
<?php endif;?>
【讨论】:
HTH :)
【讨论】: