Page 1 of 1

How to automatically disable "select" product with disabled variants ("default")?

Posted: 24 May 2022, 19:02
by Dochr
Hi,

Is there a way to automatically disable select products with 0 stock for all their variants?
I am looking for a similar mechanism that disables default product, which has 0 stock.
What I am expecting to see, is that when all variants of a select product are disabled due to 0 stock, the select product is also disabled.

Thanks

Re: How to automatically disable "select" product with disabled variants ("default")?

Posted: 26 May 2022, 07:50
by aimeos
You mean that the "add to basket" button is disabled?
You can change the JS code to disable the button if the stock levels of all variant attributes is zero and the "stock-out" CSS class has been added.

You can find the relevant JS code in this file:
https://github.com/aimeos/ai-client-htm ... #L137-L144

If you create a pull request with your changes, we will be happy to merge them into the Aimeos core :-)

Re: How to automatically disable "select" product with disabled variants ("default")?

Posted: 26 May 2022, 08:26
by Dochr
Thank you for the answer.

I was referring to setting the Status of the "select" product to "Disabled". For "default" products it happens automatically, if the stock level is 0.
In this case (please see attached picture), the whole product can be disabled, and I was looking for an automated process.
When the "select" product is disabled, it no longer shows on the Category page, which is the expected outcome, so disabling the "add to basket" button is no longer needed.

So to rephrase my question - is such automated mechanism of disabling "select" type products when all of it "default" type products are disabled, implemented in Aimeos?

Re: How to automatically disable "select" product with disabled variants ("default")?

Posted: 26 May 2022, 08:35
by aimeos
Dochr wrote: 26 May 2022, 08:26 I was referring to setting the Status of the "select" product to "Disabled". For "default" products it happens automatically, if the stock level is 0.
The status for products of type "default" is not set to "disabled" automatically if their stock level reaches 0. If that's the case, it's a custom implementation in your setup.