Magento – Product Star Ratings Summary not displaying Magento 1.9.0

magento-1.9review

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())

Best Answer

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.