VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: jflash on November 04, 2016, 21:11:44 PM

Title: Child Products and Stock
Post by: jflash on November 04, 2016, 21:11:44 PM
Hello!

My english is bad but i try :) I have enabled option ' Do not Display Product, if child products also out of stock'. In VM 3.0.16 all works like i need: i see product and only child products where 'in stock' number bigger then 0 (or 'in stock' != 'booked, orderd'). Today i updated VM to 3.0.18 and now i see all child products. When i choose some custom field, it shows me 'in stock - 0' and shows add-to-cart button. If i add something to cart, message appears to choose to go cart or shop again. I choose go to cart but product does not go into cart (because 'in stock' = 0). Why i see add-to-cart button?

Now i made some research and found in file /components/com_virtuemart/sublayouts/customfield.php on row 92 new code:
Version 3.0.16:
if($stockhandle == 'disableit_children'){
$q .= ' OR (`product_in_stock` - `product_ordered`) <= "0"';
}

This code in version 3.0.18:
if($stockhandle == 'disableit'){
$q .= ' AND (`product_in_stock` - `product_ordered`) > "0"';
}


Now i made this file overwrite to template folder (/templates/gk_storebox/html/com_virtuemart/sublayouts/customfield.php) and put code from 3.0.16 after 3.0.18 code and my problem solved. Now i see only products where 'in stock' are bigger then 0. Is there some problem with  'disableit_children' and  'disableit'?
Joomla 3.6.4
Title: Re: Child Products and Stock
Post by: Milbo on November 07, 2016, 15:32:42 PM
Seems we did an error here. I am not really happy with both options.