Closed
Description
Preconditions
- Magento 2.1.7
- PHP 7.0.22
- Module Review enabled
Steps to reproduce
Problem occured when tried to inject own filters into products collection.
- Build own Observer that runs on
catalog_block_product_list_collection
event - Try to use
$productCollection = $observer->getEvent()->getCollection();
- Then try execute
$productCollection->addAttributeToFilter('entity_id', ['in' => $fancyIds]);
Expected result
- Products collection should be filtered to provided IDs
- Products collection should not be loaded too early
Actual result
- Exception message saying that Collection is already loaded
Temporary workaround
I disabled Review observer:
<!-- Disabled because of ->load() bug on product collection in Review module -->
<observer name="review" disabled="true" />