题
我正在尝试实例化评论助手类,但失败了。.我需要访问class mage_review_block_block_product_view(app/code/code/code/mage/mage/mage/block/block/product/view.php)的class_review_block_product_view的GetReviewssummaryhtml()。
我已经尝试了:
Mage::helper('review/product')->getReviewsSummaryHtml($_product, false, true);
但是我收到致命错误:找不到类'mage_review_helper_product'。
我究竟做错了什么?
(ps我不能使用$ this-> getReviewssummaryhtml作为$这不超出范围。)
谢谢
解决方案
方法 getReviewsSummaryHtml()
定义在 Mage_Review_Block_Product_View
. 。您可以使用 Mage::app()->getLayout()->createBlock('review/product_view',$product);
. 。但是,为了使此工作起作用,您还需要有一个名为的块实例 product_review_list.count
, ,通常在 review.xml
, ,类型 core/template
, ,并使用 review/product/view/count.phtml
模板。
其他提示
您应该简单地做:
Mage::helper('review')
为了获得命名为data.php的助手类
函数getReviewsSummaryHtml()位于一个块中,您只能从模板(理想情况下)调用该函数。
如果您将该功能移至助手,那么您可以称呼它:
Mage::helper('review')->getReviewsSummaryHtml();
您应该在本地进行所有这些更改。
不隶属于 StackOverflow