2013-02-15 52 views
0

我試圖讓產品評論和形式顯示產品視圖頁面上(view.phtml) 我已經看了一些論壇帖子,並試圖:Magento的 - 產品評論沒有出現在view.phtml

查找在catalog.xml中

<catalog_product_view translate="label"> 

而且要查找的內容:

<reference name="content"> 

在這裏我輸入的代碼:

<block type="review/product_view_list" name="product.info.product_additional_data" as="reviews" template="review/product/view/list.phtml"/> 

<block type="review/product_view_list" name="product.info.product_additional_data" as="product_additional_data" template="review/product/view/list.phtml"> 
       <block type="review/form" name="product.review.form" as="review_form"> 
        <block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before" translate="label"> 
         <label>Review Form Fields Before</label> 
         <action method="setMayBeInvisible"><value>1</value></action> 
        </block> 
       </block> 
</block> 

在view.phtml我已經加入

<?php echo $this->getChildHtml('product_additional_data') ?> 
<?php echo $this->getChildHtml('reviews') ?> 

我得到一個空在哪裏,這是想顯示的評論信息。 我有標籤工作,我想要做的只是在該標籤中顯示評論表單和評論。

任何幫助,非常感謝。

+0

您是否在編輯佈局文件後清除了xml緩存? – 2013-02-15 09:08:32

+0

嗨,是的,我做了更改後清除了所有緩存。 – 2133215543 2013-02-15 09:14:24

回答

3

我不知道爲什麼它是,但我有同樣的問題。當我參考catalog.xml中產品視圖部分的評論表單和評論時,它對我很有幫助。

<block type="review/product_view_list" name="review.product_view_list" as="product_view_list" template="review/product/view/list.phtml"/> 
    <block type="review/form" name="product.review.form" as="review_form" /> 

我叫他們view.phtml這樣

<?php echo $this->getChildHtml('review_form') ?> 
    <?php echo $this->getChildHtml('product_view_list') ?> 

希望它可以幫助

1

編輯local.xml中

<catalog_product_view> 
    <reference name="content"> 
     <block type="review/product_view_list" name="review.product_view_list" as="product_view_list" template="review/product/view/list.phtml"/> 
     <block type="review/form" name="product.review.form" as="review_form" /> 
    </reference> 
</catalog_product_view> 

view.phtml

<?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html):?> 
    <div class="box-collateral <?php echo "box-{$alias}"?>"> 
     <?php if ($title = $this->getChildData($alias, 'title')):?> 
      <h2><?php echo $this->escapeHtml($title); ?></h2> 
     <?php endif;?> 
     <?php echo $html; ?> 
    </div> 
<?php endforeach;?> 
相關問題