Get Price, Value, and Quality Rating Values in Magento 1.8

magento-1.8ratingsreview

I want to get the Price,Value and Quality rating values.For that i use review code but didn't get the specified values.

$reviewcollection = Mage::getModel('review/review')
                ->getResourceCollection()
                ->addStoreFilter(Mage::app()->getStore()->getId())
                ->addFieldToFilter('customer_id','4')
                ->addRateVotes();
print_r($reviewcollection);

I can use product id and customer id for this code.
How can i get the rating like price -> 4,Value->5 etc.Thanks
I am asking about the three fields (Quality,Price and Value) during review submission.

Best Answer

I found code for rating on reviews page.You can code it like this :

<?php   $reviewcollection = Mage::getModel('review/review')->getCollection()
                ->addStoreFilter(Mage::app()->getStore()->getId())
                ->setDateOrder()->addRateVotes();
        $_items = $reviewcollection;

        ?>
<?php foreach ($_items as $_review):?>
 <dl>
<dt>
                <a href="<?php echo $this->getReviewUrl($_review->getId()) ?>"><?php echo $this->htmlEscape($_review->getTitle()) ?></a> <?php echo $this->__('Review by <span>%s</span>', $this->htmlEscape($_review->getNickname())) ?>
            </dt>
            <dd>
                <?php $_votes = $_review->getRatingVotes();

                ?>
                <?php if (count($_votes)): ?>
                <table class="ratings-table">
                    <col width="1" />
                    <col />
                    <tbody>
                        <?php foreach ($_votes as $_vote): ?>
                        <tr>
                            <th><?php echo $this->escapeHtml($_vote->getRatingCode()) ?></th>
                            <td>
                                <div class="rating-box">
                                    <div class="rating" style="width:<?php echo $_vote->getPercent() ?>%;"></div>
                                </div>
                            </td>
                        </tr>
                        <?php  endforeach; ?>
                    </tbody>
                </table>
                <?php endif; ?>
                <?php echo nl2br($this->htmlEscape($_review->getDetail())) ?>
                <small class="date"><?php echo $this->__('(Posted on %s)', $this->formatDate($_review->getCreatedAt()), 'long') ?></small>
            </dd>
              </dl>
Related Topic