Fixed indexed product positions for anchor categories. #9393
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Indexed product positions saved in
catalog_category_product_index
table are incorrect for those products which could be found in child categories.Manual testing scenarios
Initial data:
Category
2
(category with id ==2
) is anchor.Category
37
(category with id ==37
) is category's2
child1.1. Append product to a category
2
. Set its position to 2.1.2. Run
php bin/magento indexer:reindex catalog_product_category
1.3. The result is CORRECT (both
catalog_category_product
andcatalog_category_product_index
tables shows a product position == 2)1.4. Remove a product from a category
2
2.1. Append a product to a category
37
. Set its position to 3.2.2. Run
php bin/magento indexer:reindex catalog_product_category
2.3. The result is CORRECT (position == 3 for a category
37
and 10000 + 3 for an anchor category2
)3.1. Repeat a step#1.1 ( Append product to a category
2
. Set its position to 2.)3.2. Run
php bin/magento indexer:reindex catalog_product_category
3.3. The result is INCORRECT (position for a product in a category
2
in the tablecatalog_category_product_index
should be 2. But it is 10000 + 3 like in the second scenario)Fixed Issues
Position for a product assigned to anchor categories is indexed currectly whether or not it has entries in child categories.
Contribution checklist