Reputation: 582
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') ?>
Upvotes: 1
Views: 985
Reputation: 1836
If you want to show reviews in products view.phtml template, you need to add reviews list as a child of proper block. Which should be catalog/product_view... (not content). So in your example:
<reference name="content">
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
<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_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>
Then <?php echo $this->getChildHtml('reviews') ?>
will work.
Upvotes: 0
Reputation: 81
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>
Upvotes: 2