Skip to content

Incorrect partial attribute (EAV) reindex (Update by Schedule) for configurable product with childs visibility "Not Visible Individually" #12667

@Nix-id

Description

@Nix-id

Preconditions

  1. Magento 2.2.1
  2. PHP 7.1
  3. MariaDB

Steps to reproduce

  1. Create config product and childs
    For example with id '1', and his childs with '2','3'
  2. set indexer method to "Update by Schedule"
  3. Edit and save only Configurable product (don't edit childs)
  4. waite while cron update MView
  5. check DB catalog_product_index_eav. all entries with entity_id=1 and source_id in (2,3) are deleted. because of this, the filters on the catalog list page do not work correctly

Expected result

  1. All index must be reindex correct

Actual result

Reson

In file
https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php
method
processRelations($indexer, $ids, $onlyParents = false)

if in $ids = only parent id then
$parentIds = $indexer->getRelationsByChild($ids);
return empty result
and
$childIds = $onlyParents ? [] : $indexer->getRelationsByParent($parentIds);
also empty

Fast solution

$parentIds = $indexer->getRelationsByChild($ids);

+$parentIds = array_unique(array_merge($parentIds, $ids));

$childIds = $onlyParents ? [] : $indexer->getRelationsByParent($parentIds);

Metadata

Metadata

Assignees

Labels

Fixed in 2.2.xThe issue has been fixed in 2.2 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions