簡體   English   中英

Magento-view.phtml上未顯示產品評論

[英]Magento - product reviews not showing on view.phtml

我正在嘗試在產品查看頁面(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') ?>

我得到的是一個空白,應該在此處顯示評論信息。 我有一些選項卡可以滿足我的需求,只需在該選項卡中顯示評論表單和評論即可。

任何幫助是極大的贊賞。

我不確定為什么會這樣,但是我遇到了同樣的問題。 當我引用審閱表單並像這樣在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') ?>

希望能幫助到你

編輯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;?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM