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 :)