1

I want to put review and rating widget for products, I want to put review plugin for pages and article ,

How can I do this?

thanks

0

Please try with this custom phtml file.

<?php
$reviewSummary = Mage::getModel('review/review_summary');
$storeStructure = Mage::getSingleton('adminhtml/system_store')->getStoresStructure();
$productId = $this->getProduct()->getId();
$avgRating = 0;
$cumulativeRating = 0;
$storesWithRatings = 0;
foreach($storeStructure as $websiteStructure){
    foreach($websiteStructure[children] as $storeInfo){
        $storeID = $storeInfo[value];
        array_push($storeIds,$storeID);
        $currentRating = $reviewSummary->setStoreId($storeID)->load($productId)->getRatingSummary();
        if ($currentRating) {
            $storesWithRatings++;
        }
        $cumulativeRating = $cumulativeRating + $currentRating;
    }
}

if ($cumulativeRating && $storesWithRatings) {
    $avgRating = $cumulativeRating / $storesWithRatings;
}
?>
<div class="ratings">
    <?php if ($avgRating):?>
        <div class="rating-box">
            <div class="rating" style="width:<?php echo $avgRating ?>%"></div>
        </div>
    <?php endif;?>

I hope its work for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.