vuestorefront / magento2-vsbridge-indexer

This is official Vue Storefront, native, Magento2 indexer
https://vuestorefront.io
MIT License
69 stars 89 forks source link

Impossible to disable a product #272

Closed Fifciu closed 4 years ago

Fifciu commented 4 years ago

If the moderator disables product after the first reindex - it will not be disabled in the ES. I mean that value of status attribute won't be changed to 2 (disabled).

I believe the source of problem is in the class StatusSelectModifier, in this line:

)->where($checkSql . ' = ?', Status::STATUS_ENABLED);

You filter products and leave only ones that are enabled. Unfortunately, this way it won't update status attribute of products I've just disabled.

My quickfix for that was changing line above to the:

)->where($checkSql . ' IN (?)', array(Status::STATUS_ENABLED, Status::STATUS_DISABLED));

Unfortunately, it slows down reindex significantly so I believe there is a better way to fix it. It also does not send invalidate request

afirlejczyk commented 4 years ago

Disabled products are note exported to ES at all. Products with status disabled are automatically removed from ES. I don't plan to change this behavior.

So if I change the product from Enabled to Disable - the product should disappear from ES all together. This is how it works from the beginning. I might check if sth didn't break the meantime.

afirlejczyk commented 4 years ago

I just did a quick test - I disable product in Magento backend and it disappears from ES. Before: screenshot-localhost_5601-2020 05 11-07_00_11 (1)

After: screenshot-localhost_5601-2020 05 11-07_00_11

simonmaass commented 4 years ago

can confirm that disabled products are not exported

Fifciu commented 4 years ago

Hmmm maybe it is related to some of my custom modification... Could you please make sure invalidate cache for just disabled item also works properly? @afirlejczyk @simonmaass

afirlejczyk commented 4 years ago

Yes, it is. The request for invalidating cache is sent.