Skip to content

Module Review observer executes ->load() on products collection #10928

Closed
@lbajsarowicz

Description

@lbajsarowicz

Preconditions

  1. Magento 2.1.7
  2. PHP 7.0.22
  3. Module Review enabled

Steps to reproduce

Problem occured when tried to inject own filters into products collection.

  1. Build own Observer that runs on
    catalog_block_product_list_collection event
  2. Try to use
    $productCollection = $observer->getEvent()->getCollection();
  3. Then try execute
    $productCollection->addAttributeToFilter('entity_id', ['in' => $fancyIds]);

Expected result

  1. Products collection should be filtered to provided IDs
  2. Products collection should not be loaded too early

Actual result

  1. 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" />

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions