0

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.

2 Answers 2

2

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>
0
0

Are you expecting rating for the product price and product quantity?Please elaborate your question to understand

1
  • check my question now.Yes i am talking about Quality and price rating fields.
    – Adda
    Commented Oct 16, 2014 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.