如何通过审核list.phtml获取评论?
frontend\base\default\template\review/product/view/list.phtml
在此页面中使用此代码时出现错误,
<?php
// Get the number of reviews of the product on the product page.
$storeId = Mage::app()->getStore()->getId();
$summaryData = Mage::getModel('review/review_summary')
->setStoreId($storeId)
->load($_product->getId());
/* @var $summaryData Mage_Review_Model_Review_Summary */
/*
array(
['primary_id'] => 147
['entity_pk_value'] => 166
['entity_type'] => 1
['reviews_count'] => 1
['rating_summary'] => 80
['store_id'] => 1
)
*/
//var_dump($summaryData['reviews_count']);
?>
误差,
Fatal error: Call to a member function getId() on a non-object in
虽然frontend\base\default\template\review/product/view/count.phtml
上的点数将始终返回为空
<?php if (!empty($count)):?>
<a href="#customer-reviews" class="nobr"><?php echo $this->__('%s Review(s)', $count) ?></a>
<?php endif;?>
知道为什么吗?
我的catalog.xml&#39; <catalog_product_view translate="label">
,
<!-- adding review to the product page -->
<block type="page/html_pager" name="product_review_list.toolbar">
<action method="setLimit"><limit>2</limit></action>
</block>
<block type="review/product_view_list" name="product.info.product_additional_data" as="product_review" template="review/product/view/list.phtml">
<block type="core/template" name="product_review_list.count" template="review/product/view/count.phtml" />
<block type="review/form" name="product.review.form" as="review_form"/>
</block>
<!-- adding review to the product page -->