Retrieve products that belong to a virtual category #3555
Replies: 2 comments 1 reply
-
Hello @panzois2000, For virtual categories, you can follow the logic applied in the "Category" layered navigation filter in [[\Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\Category::applyCategoryFilterToCollection ](https://github.com/Smile-SA/elasticsuite/blob/d17070f2107bd0804eca8c1c329d0bd7f5604f7d/src/module-elasticsuite-virtual-category/Model/Layer/Filter/Category.php#L105-L114)](
Now, don't follow blindly what's done in \Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\Category::getFilterQuery because it relies on objects instanciated in the context of viewing a virtual category.
if not null, apply to your product collection (\Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection) with addQueryFilter. Regards, |
Beta Was this translation helpful? Give feedback.
-
Hello again, kind reminder. Is there a way or a workaraound, I could solve this problem? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I need to create a mechanism that exports all products along with the category thay belong to. I noticed that for the virtual categories using your module to create conditions the products are not stored in the database but instead are calculated on the fly.
So my question is how can I retrieve all the products that belong to a virtual category using your modules conditions?
Thanks in advance
Best regards
Beta Was this translation helpful? Give feedback.
All reactions