-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[Backport] Don't load product collection in review observer #23094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Backport] Don't load product collection in review observer #23094
Conversation
Hi @Den4ik. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @orlangur, thank you for the review. |
@ysapiga Done |
@orlangur please approve changes |
|
@@ -217,7 +218,7 @@ public function getSize() | |||
{ | |||
if ($this->_totalRecords === null) { | |||
$sql = $this->getSelectCountSql(); | |||
$this->_totalRecords = $this->getConnection()->fetchOne($sql, $this->_bindParams); | |||
$this->_totalRecords = $this->_totalRecords ?? $this->getConnection()->fetchOne($sql, $this->_bindParams); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@korostii no. Value can be set during getSelectCountSql method execution, and Elasticsearch adapter does it at some point.
@magento run all tests |
✔️ QA passed |
Hi @Den4ik, thank you for your contribution! |
Original Pull Request
#21200
Description (*)
Module observers executed after
CatalogBlockProductCollectionBeforeToHtmlObserver
don't have affect on collection. This PR is changing Review observer logic. If fact we can join only 2 reviews_count and rating_summary fields instead of send additional sql query for retrieving this data.Fixed Issues (if relevant)
Changed append summary to product collection to mysql join
load()
of product collection inReview
observer as it causes issues for other observers community-features#57: DO NOT doload()
of product collection inReview
observer as it causes issues for other observersManual testing scenarios (*)
catalog_block_product_list_collection
Contribution checklist (*)