Oh this is an odd one, it does appear that there is a "bug" or maybe just a "difference" in opinions as to when a product should show in the review.
Product View
So currently the catalog product view page uses Mage_Catalog_Helper_Product
to help init and render the product. Sounds good and it does a couple of good checks.
$product = Mage::getModel('catalog/product')
->setStoreId(Mage::app()->getStore()->getId())
->load($productId);
if (!$this->canShow($product)) {
return false;
}
if (!in_array(Mage::app()->getStore()->getWebsiteId(), $product->getWebsiteIds())) {
return false;
}
The canShow function when looked into deeper simply returns the results of $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility()
the the product has loaded correctly.
Now this all seems to work well, good job Magento.
Review List
So let's see how the review list does it.
Well firstly it does not use the same helper, which is a bit odd as I would assume that this to limit a lot of duplicate code such as checking if a product can be displayed, which seems to be the issue we are looking at here :(
So we know what it does not do so let's check what it does do.
Well it classifies a product as allowed with the following check:
if (!$product->getId() || !$product->isVisibleInCatalog() || !$product->isVisibleInSiteVisibility()) {
Which we have seen before in the helper's canShow function, but sadly that is all it checks and so does not do a further check for websites. Now I am not sure if this is actually a bug or the desired results, but but it should be fairly simply to sort out.
Fix
To fix this it appears to be fairly simple, luckily there are two events that can be hooked onto. They are both fired in the Mage_Review_ProductController::_initProduct
.
Mage::dispatchEvent('review_controller_product_init', array('product'=>$product));
Mage::dispatchEvent('review_controller_product_init_after', array(
'product' => $product,
'controller_action' => $this
));
So I would suggest creating an observer that works with one of these events and checks the websites attached to a product and if it is not allowed to be shown on the current website simply call clearInstance
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.
Best Answer
To get Rating Array Try the Below Code.