Customised Magento review summary
06 Jul 2009, by Denis Margetic
4 Comments · Posted in Magento

    There is little doubt that product reviews are popular with online shoppers, and are playing an increasingly important role in purchasers' buying decisions. Magento includes a solid feature set for implementing product reviews and can show them on various pages that include product listings. You may find that you want to customise the way these reviews are displayed, but the best way to do this may not be immediately obvious.

    The standard review summary text for products without reviews is:

    In cases with one or more existing reviews it shows the rating followed by some links, as seen in this example:

    And if you inspect the relevant phtml files you will find this code, which is responsible for inserting the review summary html:

    getReviewsSummaryHtml($_product, false, true)?>

    But what if you needed to make changes to this? If you want to change the look for all instances of the review summary you can simple change the review summary phtml file, namely:


    If, on the other hand you would like to have a different looking review summary in some cases, whilst leaving the default look for others, you can indeed do this and it is very easy. Magento actually provides a shorter version of the review summary, but this is not obvious from the existing code. For some reason the second argument in the getReviewsSummaryHtml function call is incorrectly set to 'false' when it really isn't a boolean, but is actually a keyword for a review summary template. Magento comes with a shorter version of the review summary which you can access by simply replacing the false in the second argument with "short", like this:

    getReviewsSummaryHtml($_product, "short", true)?>

    Now if there is a review for a product it will be appear like this

    and if you want to edit this template, you can find it here


    You can go a step further and add your custom templates as well. However, to do this you will need to edit one Magento core file and you will need to add your own phtml template.

    First, add your own phtml file in the template/review/helper/directory. Probably the best thing to do here is to make a copy of the existing summary.phtml file and modify it to fit your needs. Let's say you called your new file myreview.phtml.

    You need to add a reference to this template (a keyword and the path to your phtml template) in the following core file:


    in the $_availableTemplates array. Once you have added the necessary line, the top of the file should look like this:

    class Mage_Review_Block_Helper extends Mage_Core_Block_Template
        private $_availableTemplates = array(
            'default' => 'review/helper/summary.phtml',
    	'short'   => 'review/helper/summary_short.phtml'
    	'myreview'=> 'review/helper/myreview.phtml'
    	public function getSummaryHtml($product, $templateType, $displayIfNoReviews)

    Note the usual warning that you should not edit the actual Magento core file, but should first copy it to your local directory. The file to edit is:


    Your template is ready to go. To use it in your html code simply insert the following line:

    getReviewsSummaryHtml($_product, "myreview", true)?>