Skip to content
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

Enforce reindexing when category is set to virtual. #488

Merged
merged 2 commits into from
Aug 10, 2017

Conversation

romainruaud
Copy link
Collaborator

This is a fix for #465

Enforce reindexing (if set to Update on Save) when switching a category from normal mode to virtual mode.

Nothing done for mview, since this is actually working properly (due to the SQL trigger).

@afoucret
Copy link
Contributor

afoucret commented Aug 9, 2017

It seems there is a problem with this line :

$this->getIndexer()->reindexList($category->getPathIds());

$category->getPathIds()returns category ids and you reindex it using the product indexer. IMHO you don't reindex the products as expected.

@romainruaud
Copy link
Collaborator Author

Hmmm, this is the "catalog_category_product" indexer, and it's taking category ids for reindex : https://github.com/magento/magento2/blob/develop/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Rows.php

This is done same way by Magento on standard category model (but only if there are products attached, which is not good in our case) : https://github.com/magento/magento2/blob/develop/app/code/Magento/Catalog/Model/Category.php#L1097

This is indexing properly the products in the catalog_category_product_index table (removing them, exactly), and then the fulltext indexer does the job and removes the "category" field from documents.

@romainruaud
Copy link
Collaborator Author

PR Updated :

  • prevent reindexing of root category

  • prevent reindexing if no products were attached previously (this manage the case of a virtual category creation, since its done in 2 steps).

@afoucret afoucret merged commit 16ec29d into Smile-SA:2.3.x Aug 10, 2017
@romainruaud romainruaud deleted the fix_virtual_category_reindex branch September 8, 2017 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants