Skip to content

Commit f15ddaf

Browse files
apasaregelanivishal
authored andcommitted
performance improvements
Get rid of unnecessary reviews queries on product listing: "select review_entity_summary.* from review_entity_summary where (review_entity_summary.entity_pk_value = ?) and (store_id = ?)" This query was executed for each product on listing which didn't have a review summary(@see: Magento\Review\Block\Product\ReviewRenderer::getReviewsSummaryHtml)
1 parent 0f57a30 commit f15ddaf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/code/Magento/Review/Model/Review.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Review\Model;
77

8+
use Magento\Framework\DataObject;
89
use Magento\Catalog\Model\Product;
910
use Magento\Framework\DataObject\IdentityInterface;
1011
use Magento\Review\Model\ResourceModel\Review\Product\Collection as ProductCollection;
@@ -327,6 +328,9 @@ public function appendSummary($collection)
327328
$item->setRatingSummary($summary);
328329
}
329330
}
331+
if (!$item->getRatingSummary()) {
332+
$item->setRatingSummary(new DataObject());
333+
}
330334
}
331335

332336
return $this;

0 commit comments

Comments
 (0)