monsieurbiz / SyliusSearchPlugin

A search plugin using Elasticsearch for Sylius
MIT License
45 stars 38 forks source link

inStock query filter does not check for StockableInterface #106

Closed seizan8 closed 1 year ago

seizan8 commented 2 years ago

I upgraded the searchPlugin (from 0.2.5 => 1.0 RC8) and I noticed something. The queries from the bundles have changed. All queries now filter for inStick by default.

In my project we don't use stocks. We don't implement the StockableInterface of Sylius. And this breaks the bundles. It shows no filters at all in my taxon index or search page. Not even the price filter or options filter. Also shows no products AT ALL. I had to overwrite the queries and remove the inStock filter and now it works as intended.

I also haven't found anything in the docs about this. Using stocks is not default in Sylius and not a necessity. I think the plugin should check if Produkt implements Sylius' StockableInterface if the inStock filter is used. And not add it, if it's not implemented. Maybe there are other solutions, better solutions. Even a config "filter_in_stock" or so would be better than nothing.

Ideally the plugin should work for project using stocks and project not using them.

maximehuran commented 1 year ago

Done in v2