VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: kogos on July 22, 2017, 18:10:51 PM

Title: How to get multi variant childs stock
Post by: kogos on July 22, 2017, 18:10:51 PM
Hi all,
i already asked once in forum, but i got no answer because my question was too complicated (i think)...

So, i'm asking once again, and hope for an answer.

I am using multi variant custom field to select size and color of clothes. How can i get the stock level (product_in_stock - product_ordered) from multi variant childs?

I tried to implement various methods with no luck.

Any help would be greatly appreciated.

Thanks in advance
Title: Re: How to get multi variant childs stock
Post by: loppan on July 23, 2017, 13:54:36 PM
I'm using Breakdesign's Stockable custom fields plugin for this exact purpose... works great :) https://breakdesigns.net/extensions/joomla/stockable-custom-fields
Title: Re: How to get multi variant childs stock
Post by: kogos on July 26, 2017, 20:14:57 PM
million thanks for the reply m8. I will definitely check it out. Appreciated
Title: Re: How to get multi variant childs stock
Post by: johnkont on July 27, 2017, 11:17:42 AM
I think only if you use custom multivariant fields you can use the availability per product.
Title: Re: How to get multi variant childs stock
Post by: kogos on July 28, 2017, 08:46:36 AM
thats the custom field type i am using, multivariant type. But my problem is that when a product is out of stock, you can either hide it, or change the "add to cart" button to "notify"... and there is no way to show the product variant with line-through, no matter what is done with overrides or css...

I think that my problem will be solved with Breakdesign's Stockable custom fields plugin, as loppan suggested, but unfortunately i did not have the time to test it yet.

However, i will get back with results once it's tested for future reference, in case someone else has the same demand/problem
Title: Re: How to get multi variant childs stock
Post by: Studio 42 on July 28, 2017, 16:30:14 PM
CSS line-through is not possible in select list , you can only "disable" an option but i think that VM do not include this.
See https://www.w3schools.com/tags/att_option_disabled.asp for the disable atribute
So you have to components\com_virtuemart\sublayouts\customfield.php
Or you can change the color with CSS .yourclass {color:red;} but need to add the class in the option tag