简体   繁体   中英

Magento - product reviews not showing on view.phtml

I'm trying to get the product reviews and form showing on the product view page (view.phtml) I've looked at some forum posts and tried:

Finding in catalog.xml

<catalog_product_view translate="label">

And looking for the content:

<reference name="content"> 

In here I have entered the code:

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

In view.phtml I have added

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

I get an empty are where this is suppose to show the review information. I have tabs working what I want to do it just show the review form and reviews in that tab.

Any help is greatly appreciated.

I'm not sure why it is but I had the same problem. It worked for me when I referenced the review form and reviews inside the product view part of the catalog.xml like this.

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

I called them from view.phtml like this

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

Hope it helps

Edit 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;?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM