BitBagCommerce / SyliusElasticsearchPlugin

Elasticsearch integration for Sylius apps.
MIT License
128 stars 90 forks source link

Filtering by the global taxon #24

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hi !

I took the example of the sample data of the Sylius project. So in our taxons, we've : ---- category ------- Mugs ------- Stickers ------- Books ------- T-shirts ---------- Men ---------- Woman

If I want to have the list of the products, I use in Twig this : {{ render(url('bitbag_sylius_elasticsearch_plugin_shop_list_products', {'limit': 3, 'slug': '**MY_TAXON**'})) }} So it's imperative to put a taxon name. Like 'mugs', 'books'.

But now, If I want to do this with the main taxon 'category' which is the parent of all the others taxons. I doesn't found the solution.

BUT ! If you use the taxon : 't-shirts', you'll have the list of the two taxon 'Men' and 'Women'. I don't know what should I do, to do the same effect than T-shirts.

I tryed differents solutions and tryed to play with the taxons, but no success. I hope that I was clear and comprehensible !

bitbager commented 6 years ago

You can always write a new route like this one https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/blob/master/src/Resources/config/routing.yml.

Products added to all categories, including parents will always appear on each level of inheritance. To avoid it, don't add parent taxonomies to specific products.

ghost commented 6 years ago

It's working, thanks. I just forgot to do php bin/console fos:elastica:populate (after change my products)

bitbager commented 6 years ago

It should actually be handled automatically unless you changed something in the FOS Elastica configuration. FOS Elastica bundle listens on Doctrine events and rebuilds the index automatically. Didn't it work for you?

ghost commented 6 years ago

In my case, It didn't populate elasticsearch. When I change a product from the admin panel, and go back to the index to see the change, Elasticsearch return the same as before. so I'm wondering why because u said it's automatic !

And for example :