1

review

Here is my app/design/frontend/rwd/ysv/template/rating/detailed.php

<?php if(!empty($collection) && $collection->getSize()): ?>
    <table class="ratings-table">
        <col width="1" />
        <col />
        <tbody>
            <?php foreach ($collection as $_rating): ?>
                <?php if($_rating->getSummary()): ?>
                    <tr>
                        <th><?php echo $this->__($this->escapeHtml($_rating->getRatingCode())) ?></th>
                        <td>
                            <div class="rating-box">
                                <div class="rating" style="width:<?php echo ceil($_rating->getSummary()) ?>%;"></div>
                            </div>
                        </td>
                    </tr>
                <?php endif; ?>
            <?php endforeach; ?>
        </tbody>
    </table>
<?php endif; ?>

second image

app/design/frontend/rwd/ysv/template/review/product/view/list.phtml

Is there any error or any line is missing.

<?php $_items = $this->getReviewsCollection()->getItems();?>
<div class="box-collateral box-reviews" id="customer-reviews">
    <?php if (count($_items)):?>
        <div class="review-heading">
            <h2>
                <?php echo $this->__('Customer Reviews') ?>
                <span><?php echo count($_items); ?> item(s)</span>
            </h2>
            <?php echo $this->getChildHtml('toolbar') ?>
        </div>
        <dl>
        <?php foreach ($_items as $_review):?>
            <dt>
                <a href="<?php echo $this->getReviewUrl($_review->getId()) ?>">
                    <?php echo $this->escapeHtml($_review->getTitle()) ?>
                </a>
            </dt>
            <dd>
                <?php $_votes = $_review->getRatingVotes(); ?>

                <?php echo nl2br($this->escapeHtml($_review->getDetail())) ?>


                <?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; ?>


                <span class="review-meta">
                    <?php echo $this->__('Review by %s', $this->escapeHtml($_review->getNickname())) ?>
                    /
                   <?php echo $this->__('(Posted on %s)', $this->formatDate($_review->getCreatedAt()), 'long') ?>
                </span>
            </dd>
        <?php endforeach; ?>
        </dl>

        <?php // echo $this->getChildHtml('toolbar') ?>
    <?php elseif($this->getParentBlock()): ?>
        <?php echo $this->getParentBlock()->getReviewsSummaryHtml($this->getProduct(), 'short', true)?>
    <?php endif;?>
    <?php echo $this->getChildHtml('review_form') ?>
</div>

UPDATE: this gives the value like

Quality : 2 
Price : 3
Value : 1

But i want to print star.

should i hard code this.

$this->escapeHtml($_vote->getValue())

2 Answers 2

0

I was having same issue in my custom theme, it was happening because the rating star are displayed from background image, which was missing in my theme, Copy icon_sprite.png from default or rwd theme's images directory under skin and paste it to your theme.

Hope it will help you.

3
  • i copied icon_sprite.png but still no rating is shown
    – inrsaurabh
    Commented Sep 29, 2017 at 8:14
  • your code looks fine, check css for class= "rating" from browser, is it has set any other image
    – Piyush
    Commented Sep 29, 2017 at 8:28
  • you can also check css by applying rwd theme
    – Piyush
    Commented Sep 29, 2017 at 8:32
-1

Go to catalog -> reviews and ratings - > Customer Reviews->pending reviews and make status to approved.Now you can see all reviews on product page.

2
  • use this if don't work than tell me
    – Monu kumar
    Commented Sep 29, 2017 at 7:42
  • reviews are approved that's why they are shown on view page and total review count is incremented as well.
    – inrsaurabh
    Commented Sep 29, 2017 at 9:07

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.