Skip to content

Commit 63f5b8c

Browse files
committed
Fix for #4530 $product->getRatingSummary() always returns null […]
1 parent ce5dbd5 commit 63f5b8c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/code/Magento/Review/Block/Product/ReviewRenderer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public function getReviewsSummaryHtml(
5757
$templateType = self::DEFAULT_VIEW,
5858
$displayIfNoReviews = false
5959
) {
60+
if (!$product->getRatingSummary()) {
61+
$this->_reviewFactory->create()->getEntitySummary($product, $this->_storeManager->getStore()->getId());
62+
}
63+
6064
if (!$product->getRatingSummary() && !$displayIfNoReviews) {
6165
return '';
6266
}
@@ -68,9 +72,6 @@ public function getReviewsSummaryHtml(
6872

6973
$this->setDisplayIfEmpty($displayIfNoReviews);
7074

71-
if (!$product->getRatingSummary()) {
72-
$this->_reviewFactory->create()->getEntitySummary($product, $this->_storeManager->getStore()->getId());
73-
}
7475
$this->setProduct($product);
7576

7677
return $this->toHtml();

0 commit comments

Comments
 (0)