webgriffe / SyliusAkeneoPlugin

Plugin allowing to import data from Akeneo PIM to your Sylius store.
https://webgriffe.github.io/SyliusAkeneoPlugin/
MIT License
23 stars 2 forks source link

[BUG] - The webhook import dispatch does not consider filters applied on import command #194

Closed lruozzi9 closed 10 months ago

lruozzi9 commented 10 months ago

Let's assume that you filter the products to import on find products to import method by family not null. The command on crontab will only then filter on these products, but if you also have the webhook enabled and you create or change a product without a family the current webhook controller will import this.

I can think of two solutions: the first is to dispatch a custom event on the webhook controller with the $resource parameter so you can say if the resource is to import or to skip. This solution requires that you "duplicate" the search conditions. Another is to introduce a new service that, given the "product" array from Akeneo says if it is to import or not. This requires to change a little the ImportCommand, but the filter terms are maintained only on one point.