2011-06-27 122 views

回答

1
  • 我想创建一个扩展。
  • 使用layout.xml放置应该将核心/模板块扩展到产品页面的左侧/右侧边栏的块
  • 在该块类中,您应该有方法从数据库中检索要显示的评论。因此,举例说,您需要一种方法getReviews()
  • 在模板中调用$ this-> getReviews()并迭代结果并根据需要显示评论。明星酒吧可能是有点麻烦,但如果你看看在使用它们,你应该能够得到要点其他模板文件吧:)

HTH :)

4

正如ElGabby说,创建一个扩展将是一条路。

但你可以通过编辑你当前的布局来做到这一点。

转到文件的catalog.xml在/ app /设计/前端/预设/ [您的主题] /布局/或/应用/设计/前端/基/ [您的主题] /布局/

发现部分:

​​ 在那里

你proberly有这样一段:在节中添加

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

保存文件,并创建一个新文件: /应用程序/设计/前端/预设/ [您的主题] /设计/审查/ 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;?> 
相关问题