Files
esun3d/app/code/Esun/Review/view/frontend/templates/review/summary-empty-rating.phtml
T
2026-09-15 10:35:56 +08:00

31 lines
1.5 KiB
PHTML

<?php
/**
* @var \Magento\Review\Block\Product\ReviewRenderer $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<?php if ($block->isReviewEnabled()): ?>
<?php
$reviewsCount = (int)$block->getData('esun_reviews_count');
$rating = (int)$block->getData('esun_rating_summary');
$ratingValue = $rating > 0 ? number_format($rating / 20, 1) : '';
$reviewsUrl = $block->getReviewsUrl() . '#reviews';
?>
<div class="product-reviews-summary<?= !$rating ? ' no-rating' : '' ?> esun-review-summary">
<div class="rating-summary">
<span class="label"><span><?= $escaper->escapeHtml(__('Rating')) ?>:</span></span>
<div class="rating-result"
id="rating-result_<?= $escaper->escapeHtmlAttr($block->getProduct()->getId()) ?>"
title="<?= $escaper->escapeHtmlAttr((string)$rating) ?>%">
<span style="width: <?= $escaper->escapeHtmlAttr((string)$rating) ?>%;"><span></span></span>
</div>
</div>
<?php if ($reviewsCount > 0): ?>
<a class="esun-review-summary__meta" href="<?= $escaper->escapeUrl($reviewsUrl) ?>">
<span class="esun-review-summary__score"><?= $escaper->escapeHtml($ratingValue) ?></span>
<span class="esun-review-summary__count">(<?= $escaper->escapeHtml((string)$reviewsCount) ?><?= $escaper->escapeHtml($reviewsCount === 1 ? __('Review') : __('Reviews')) ?>)</span>
</a>
<?php endif; ?>
</div>
<?php endif; ?>