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

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Dochr
Posts: 8
Joined: 03 Nov 2021, 17:18

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

Post by Dochr » 24 May 2022, 19:02

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

User avatar
aimeos
Administrator
Posts: 6197
Joined: 01 Jan 1970, 00:00

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

Post by aimeos » 26 May 2022, 07:50

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 :-)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Dochr
Posts: 8
Joined: 03 Nov 2021, 17:18

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

Post by Dochr » 26 May 2022, 08:26

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?
Attachments
aimeosQuestion2.jpg
aimeosQuestion2.jpg (50.83 KiB) Viewed 91 times

User avatar
aimeos
Administrator
Posts: 6197
Joined: 01 Jan 1970, 00:00

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

Post by aimeos » 26 May 2022, 08:35

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.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply