Magento – Product rating display total review score

ratingsreviewstore-view

I use 5 rating options for a product review.
It is displayed with the well known stars, see below.

enter image description here

But I want to also display the total score.
A score that display the average score of the total 5 of that score.

(I do not want to display the average of all reviews, only the average of each individual review)

This is my detailed.phtml

    <?php $_votes = $this->getRatingVotes($_review->getId());?>
    <?php if (count($_votes)): ?>
    <table class="ratings-table">
        <col width="1" />
        <col />
        <tbody>
            <?php foreach ($_votes as $_vote): ?>
            <tr>
                <th><?php echo $_vote->getRatingCode() ?></th>
                <td>
                    <div class="rating-box">
                        <div class="rating" style="width:<?php echo $_vote->getPercent() ?>%;"></div>
                    </div>
                </td>
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <?php endif; ?>

How can I display this?

Best Answer

Please goto list.phtml file and edit path of magento root directory: app\design\frontend\MyPackage\MyTheme\template\review\product\view\list.phtml

Add the below code as you require to display on product page's review section of front-end after admin configure review rating summary.

<?php  
    $_product = Mage::registry('product'); 
    $_productId = $_product->getId();
    $storeId = Mage::app()->getStore()->getId();
    $summaryData = Mage::getModel('review/review_summary')->setStoreId($storeId)->load($_product->getId());  
    $reviewsCount = Mage::app()->getLayout()->createBlock('review/product_view')->getReviewsCollection()->getSize(); 

    ?> 
    <div class="review-star-rating">
            <div class="star-rating"><?php echo (($summaryData['rating_summary'] * 5) / 100) ; ?></div>  
            <div class="rating_text"><?php echo $this->__('Average Rating Based on '.$reviewsCount.' ratings') ?></div> 
    </div>

Hope this helps you.