Magento 评论在 php 中显示摘要评级而不是评级项目
在我的 Magento 商店中,客户按 3 个类别(即价格)评论我的产品。但是当我打印这些评级时,它只显示摘要,而不是这 3 个类别(请参阅代码)。
<?php
//from http://www.exploremagento.com/magento/run-magento-code-outside-of-magento.php
require_once '../app/Mage.php';
umask(0);
Mage::app('default');
$review = Mage::getModel('review/review');
$collection = $review->getProductCollection();
$collection
->addAttributeToSelect('*')
->getSelect()
->limit(5)
->order('rand()');
$review->appendSummary($collection);
foreach($collection as $product) {
//var_dump($product->debug());
}
/* To get (what I assume is) 'star' rating. */
$ratingSummary = $product->getRatingSummary();
$starRating = $ratingSummary['rating_summary'];
echo $starRating . "<br/>";
?>
我怎样才能获得所有评级而不是摘要?
In my Magento store customers are reviewing my products in 3 categories (i.e. price). But when I'm printing these ratings it only shows a summary instead of these 3 categeries(see code).
<?php
//from http://www.exploremagento.com/magento/run-magento-code-outside-of-magento.php
require_once '../app/Mage.php';
umask(0);
Mage::app('default');
$review = Mage::getModel('review/review');
$collection = $review->getProductCollection();
$collection
->addAttributeToSelect('*')
->getSelect()
->limit(5)
->order('rand()');
$review->appendSummary($collection);
foreach($collection as $product) {
//var_dump($product->debug());
}
/* To get (what I assume is) 'star' rating. */
$ratingSummary = $product->getRatingSummary();
$starRating = $ratingSummary['rating_summary'];
echo $starRating . "<br/>";
?>
How can I get all the ratings instead of the summary?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在辅助对象中创建了这个函数,只是为了显示平均产品评级的简单 html(也是 3 个类别)。希望您觉得它有帮助。
I've created this function in helper object, just to display simple html for average product rating (also 3 categories). Hope you find it helpfull.