VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: VopoloS on August 20, 2016, 06:15:49 AM

Title: How to bring new products to the module without considering the number of stock?
Post by: VopoloS on August 20, 2016, 06:15:49 AM
How to bring new products to the module without considering the number of stock = 0?
The site uses a standard module mod_virtuemart_product. And uses the parent and child items. In the rest of the parental goods warehouse is always 0. This module does not display new items. How to get around this problem?
(VM 3.0.16)
Thank you in advance for your reply.
Title: Re: How to bring new products to the module without considering the number of stock?
Post by: GJC Web Design on August 20, 2016, 11:07:34 AM
hmmm..
the module uses the std. products model and that query considers stock if that is your admin setting

if($isSite and !VmConfig::get('use_as_catalog',0)) {
if (VmConfig::get('stockhandle','none')=='disableit_children') {
$where[] = ' ( (p.`product_in_stock` - p.`product_ordered`) >"0" OR (children.`product_in_stock` - children.`product_ordered`) > "0") ';
$joinChildren = TRUE;
} else if (VmConfig::get('stockhandle','none')=='disableit') {
$where[] = ' p.`product_in_stock` - p.`product_ordered` >"0" ';
}
}


without a hack there unless u set the stock to be ignored I don't see a solution except to rewrite the module to get the latest etc directly
Title: Re: How to bring new products to the module without considering the number of stock?
Post by: VopoloS on August 20, 2016, 22:05:28 PM
Thank you for your prompt response. But I don't quite understand, which file to insert this code, that would ignore the inventory balance. Could you help me to upgrade mod_virtuemart_product?
Title: Re: How to bring new products to the module without considering the number of stock?
Post by: GJC Web Design on August 20, 2016, 22:16:25 PM
the code is the code that is already there in the products model...

it isn't simple because if u disable this check it will be global... 

you can try to see what results you get...  maybe the custom field don't show parent will prevent the parent showing

administrator\components\com_virtuemart\models\product.php    function sortSearchListQuery()

~ line 350