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

When a virtual category root is deleted, all products are shown #1937

Closed
amenk opened this issue Sep 1, 2020 · 11 comments
Closed

When a virtual category root is deleted, all products are shown #1937

amenk opened this issue Sep 1, 2020 · 11 comments
Assignees

Comments

@amenk
Copy link
Contributor

amenk commented Sep 1, 2020

This is just for the record, don't really expect a fix, but want to have it documented in case others stumble upon it.

Preconditions

  • Create a category A and put no products into it
  • Create a subcategory "B", parent A, and put some products into it
  • Create a virtual category "V" below A with a the category "B" as root
  • Delete the referenced category "B"

image

In the backend it shows "entity with ID doesn't exist"

In the virtual category (another their parents, because of is_anchor) now unrelated products appear

  • smile/elasticsuite 2.8.6
  • magento/product-community-edition 2.3.4-p2

Expected Result

The virtual category V is empty, because it links to an invalid category

Current Result

The virtual category V and also the parent categories seem to include all products from the catalog.

@vahonc
Copy link
Collaborator

vahonc commented Sep 7, 2020

Hello @amenk,

Could you please provide more details for your test case, maybe smth like a real detail example. Because from the current description it looks like a little bit blurry and not quite understood what you want to test and what you want to get or expect to see at the end result.

Best regards

@amenk
Copy link
Contributor Author

amenk commented Sep 7, 2020

@vahonc updated

@vahonc
Copy link
Collaborator

vahonc commented Sep 8, 2020

Hi @amenk,

Well, now it is clearer what you have now and what you expect at the end.
But for me, your test case is still a little bit blurry. Therefore, could you please describe your preconditions step by step in more details, something like this:

  1. Create category CategoryName1 as root (Notes: If I correctly understood it shouldn't be as a Subcategory under Default Category)
  2. Create a virtual category CategoryName2 under CategoryName1

and so on...

This will really help us to more accurately understand your case and determine where we have a problem and offer you a solution as soon as possible.

Best regards

@amenk
Copy link
Contributor Author

amenk commented Sep 8, 2020

@vahonc edited

@no-response no-response bot removed the needs update label Sep 8, 2020
vahonc added a commit to vahonc/elasticsuite that referenced this issue Nov 27, 2020
@vahonc
Copy link
Collaborator

vahonc commented Nov 27, 2020

Hello @amenk,

Sorry for the long silence on your problem. I have added a PR with a solution that should fix it. Could you please check it out or share your thoughts on this.

Best regards,

vahonc added a commit to vahonc/elasticsuite that referenced this issue Dec 7, 2020
@no-response
Copy link

no-response bot commented Dec 12, 2020

This issue was waiting update from the author for too long.
Without any update, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

@no-response no-response bot closed this as completed Dec 12, 2020
@romainruaud romainruaud reopened this Dec 14, 2020
@no-response
Copy link

no-response bot commented Dec 14, 2020

This issue was waiting update from the author for too long.
Without any update, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

@no-response no-response bot closed this as completed Dec 14, 2020
@vahonc vahonc reopened this Dec 14, 2020
@romainruaud romainruaud assigned romainruaud and unassigned vahonc Jan 11, 2021
@romainruaud
Copy link
Collaborator

Hello @amenk

unfortunately, we will not fix this particular case.

To be clear, "virtual root category", with the actual behavior, is just a short-hand to creating a condition on "category = X" on the rule section. It was supposed to do more (automatically generate category filters according to the childrens of the root category, etc....) but that's still not the case right now.

That being said, the "virtual root category" condition is added to the virtual rule query as a pre-filter, meaning that :

  • if you have "virtual root category = B" and "color = blue" condition. The generated query is a combination of both.
  • if you delete the category B, the resulting category will feature "blue products" across all the catalog : the generated query only fetch blue products.

The same does apply in your case, except you only have a virtual root category, meaning that if you delete your root category, you end up with a query having no filter clause at all : this will fetch the entire catalog.

So despite being quite of an edge case, it's in our opinion working as intended.

Regards

@amenk
Copy link
Contributor Author

amenk commented Jan 14, 2021

fair enough, makes sense.
@romainruaud thank you for your elaborate feedback, and keep up the great work at the module :)

@romainruaud
Copy link
Collaborator

You're welcome, I close the issue then

@amenk
Copy link
Contributor Author

amenk commented Mar 30, 2021

We had the problem again and were wondering if there is SQL query to identify such problems, so we could at least add it to the monitoring.

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

No branches or pull requests

3 participants