2

I have a review.phtml template that shows the review count of the current product using this code:

if($this->getReviews()):
  $rc = $this->getReviewCount();
if($this->getReviewCount() == 1):
  echo '<img src="' . $this->getLogoSrc() . '" /> <strong>(' . $rc . ' review)</strong>';
elseif($this->getReviewCount() > 1):
  echo '<img src="' . $this->getLogoSrc() . '" /> <strong>(' . $rc . ' reviews)</strong>';
endif;
endif;  

I want to show the review count somewhere else on the page(same product) by putting the code in summary.phtml where the default "leave a review" link is.

This doesnt work as I am sure I need to change $this to where the review.phtml template is?

3

Try this code in your .phtml file

$product = Mage::registry('current_product');
$rc = $product->getRatingSummary()->getReviewsCount();

Hope this helps.

| improve this answer | |

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.