我希望在 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/[your theme]/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 :)