Search code examples
phpxmlmagentoreviewcatalog

Review in Magento product page


Im trying to get the reviews submission box to show within the product page, showing the latest reviews under that.

All tutorials are saying them same but it wont work. Any ideas?

catalog.xml - in this snippet you can see i've included the reference to reviews

 <catalog_product_view translate="label">



        <label>Catalog Product View (Any)</label>
        <!-- Mage_Catalog -->




        <reference name="root">


            <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        </reference>
        <reference name="head">
            <action method="addJs"><script>varien/product.js</script></action>
            <action method="addJs"><script>varien/configurable.js</script></action>

            <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
            <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
            <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
        </reference>
        <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="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
                <!--
                <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/summary.phtml</template></action>
                <action method="addReviewSummaryTemplate"><type>short</type><template>review/helper/summary_short.phtml</template></action>
                <action method="addReviewSummaryTemplate"><type>...</type><template>...</template></action>
                -->
                <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>
                <block type="core/text_list" name="alert.urls" as="alert_urls" translate="label">
                    <label>Alert Urls</label>
                </block>

then called it in catalog/product/view.phtml where i want it to appear:

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

Solution

  • Try this in catalog/product/view.phtml :

    <div>
        <?php echo $this->getLayout()->createBlock('review/product_view_list')->setTemplate('review/product/view/list.phtml')->toHtml() ?>
    </div>        
    <div>   
        <?php echo $this->getLayout()->createBlock('review/form')->setBlockId('product.review.form')->toHtml() ?>
    </div>