By default Magento will display all of your product reviews on a separate dedicated reviews page. In most cases you’ll find that the design caters for some/all of the product reviews to be displayed somewhere on the product detail page. Commonly they are found in a tab towards the bottom page, along with a link to the aforementioned full review page.
Register XML Block
First you’ll need to add a block to your XML in your template file – this will tell Magento where to find your files. I normally do this in my local.xml file but that’s just personal preference – you can add this to your catalog.xml file if you prefer;
<catalog_product_view> <reference name="product.info"> <block type="review/product_view_list" name="product.info.product_additional_data" as="reviews" template="review/product/view/review_summary.phtml" /> </reference> </catalog_product_view>
Create review_summary.phtml
Next you will need to create review_summary.phtml which we registered in the above XML. It should be saved here;
app/design/frontend/default/YOURTHEME/review/product/view/review_summary.phtml
Create review collection
And finally load your collection, and style accordingly
$ReviewsCollection = $this->getReviewsCollection()->getItems(); if( count( $ReviewsCollection ) ) { $x = 1; foreach( $ReviewsCollection as $_review ){ // get review title echo $_review->getTitle(); $_votes = $_review->getRatingVotes(); if (count($_votes)){ foreach ($_votes as $_vote){ echo $_vote->getRatingCode().' - '.$_vote->getPercent().'%<br />'; } } // get review date echo $this->formatDate($_review->getCreatedAt()).'<br />'; // get review detail echo $_review->getDetail().'<br />'; // get how wrote the review echo $_review->getNickname().'<br />'; // because you cant setPageSize with this collection it's best to break the loop. if($x == 4){ break; } $x++; } }
Display product review collection
And finally, to display your newly created review block simply add the below code to your product view.
echo $this->getChildHtml('reviews');