0
<div class="rating-summary"></div>

The rating-summary div is not showing on product page and category page

Only is showing the count of reviews.

enter image description here

Magento 2.x

    <?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * @description:
 *
 */
?>
<?php
    $_items = $block->getReviewsCollection()->getItems();
    $format = $block->getDateFormat() ?: \IntlDateFormatter::SHORT;
?>
<?php if (count($_items)):?>
<div class="block review-list" id="customer-reviews">
    <div class="block-title">
        <strong><?php /* @escapeNotVerified */ echo __('Customer Reviews') ?></strong>
    </div>
    <div class="block-content">
        <div class="toolbar review-toolbar">
            <?php echo $block->getChildHtml('toolbar') ?>
        </div>
        <ol class="items review-items">
        <?php foreach ($_items as $_review):?>
            <li class="item review-item" itemscope itemprop="review" itemtype="http://schema.org/Review">
                <div class="review-title" itemprop="name"><?php echo $block->escapeHtml($_review->getTitle()) ?></div>
                <?php if (count($_review->getRatingVotes())): ?>
                    <div class="review-ratings">
                    <?php foreach ($_review->getRatingVotes() as $_vote): ?>
                    <div class="rating-summary item" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
                        <span class="label rating-label"><span><?php echo $block->escapeHtml($_vote->getRatingCode()) ?></span></span>
                        <div class="rating-result" title="<?php /* @escapeNotVerified */ echo $_vote->getPercent() ?>%">
                            <meta itemprop="worstRating" content = "1"/>
                            <meta itemprop="bestRating" content = "100"/>
                            <span style="width:<?php /* @escapeNotVerified */ echo $_vote->getPercent() ?>%">
                                <span itemprop="ratingValue"><?php /* @escapeNotVerified */ echo $_vote->getPercent() ?>%</span>
                            </span>
                        </div>
                    </div>
                    <?php endforeach; ?>
                    </div>
                <?php endif; ?>
                <div class="review-content" itemprop="description">
                    <?php echo nl2br($block->escapeHtml($_review->getDetail())) ?>
                </div>
                <div class="review-details">
                    <p class="review-author">
                        <span class="review-details-label"><?php /* @escapeNotVerified */ echo __('Review by')?></span>
                        <strong class="review-details-value" itemprop="author"><?php echo $block->escapeHtml($_review->getNickname()) ?></strong>
                    </p>
                    <p class="review-date">
                        <span class="review-details-label"><?php /* @escapeNotVerified */ echo __('Posted on') ?></span>
                        <time class="review-details-value" itemprop="datePublished" datetime="<?php /* @escapeNotVerified */ echo $block->formatDate($_review->getCreatedAt(), $format) ?>"><?php /* @escapeNotVerified */ echo $block->formatDate($_review->getCreatedAt(), $format) ?></time>
                    </p>
                </div>
            </li>
        <?php endforeach; ?>
        </ol>
        <div class="toolbar review-toolbar">
            <?php echo $block->getChildHtml('toolbar') ?>
        </div>
    </div>
</div>
<?php endif;?>
  • Maybe it is displayed none using CSS.Inspect the HTML content and check – Amit Bera Aug 6 '18 at 11:52
  • it will under review tab, also in your website customer must need login or create the account to view the reviews – kunj Aug 6 '18 at 12:00
  • @AmitBera I have checked. did not use CSS. Actually, review-summary div not displayed there. – Masud Shaikh Aug 6 '18 at 12:22
  • @kunj Also login my account. But, Review not display under review tab, product view page and on product under category. – Masud Shaikh Aug 6 '18 at 12:24
  • Only is showing count every page – Masud Shaikh Aug 6 '18 at 12:25
0

No need to change code, I think its backend configuration issue

Just move to Dashboard >> Attributes >> Rating set rating status of product,Quality etc. from inactive to active.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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