Question

I'm trying to instantiate the review helper class but failing.. I need to access getReviewsSummaryHtml() of class Mage_Review_Block_Product_View (app/code/code/Mage/Review/Block/Product/View.php).

I've tried this:

Mage::helper('review/product')->getReviewsSummaryHtml($_product, false, true);

But I receive Fatal error: Class 'Mage_Review_Helper_Product' not found.

What am I doing wrong?

(p.s. I can't use $this->getReviewsSummaryHtml as $this is out of scope.)

Thanks

Was it helpful?

Solution

The method getReviewsSummaryHtml() is defined in Mage_Review_Block_Product_View. You can instantiate it anywhere using Mage::app()->getLayout()->createBlock('review/product_view',$product);. In order for this to work, though, you'll need to also have a block instance named product_review_list.count, which is normally defined in review.xml, is of type core/template, and uses the review/product/view/count.phtml template.

OTHER TIPS

You should simply do :

Mage::helper('review')

in order to get helper class which is named as Data.php

The function getReviewsSummaryHtml() resides in a block and you should only be able to call that function (ideally) from you template.

If you have moved that function to helper than you can call it like :

Mage::helper('review')->getReviewsSummaryHtml();

and you should do all these changes in your local.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top