VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: luizwbr on June 05, 2013, 21:49:26 PM

Title: Issue with VirtueMartCart::checkForQuantities or not?
Post by: luizwbr on June 05, 2013, 21:49:26 PM
Hi, that's weird...

I'm using a third party plugin ( One Page Checkout ), and this plugin uses the method VirtueMartCart::updateProductCart which call VirtueMartCart::checkForQuantities to check if product's quantity can be bought or not ( You already know this ) using an ajax call.

But in method checkForQuantities, on the line: 617 has this code:

$stockhandle = VmConfig::get('stockhandle','none');

This variable always return 'none'.

But if i change to this code below, the $stockhandle loads the right VM configuration (disableadd) :


$config = VmConfig::loadConfig();
$stockhandle = $config->get('stockhandle');


It's a VM bug, or it's caused by third party plugin?

Ps: in helper.php ( One page's helper ), it loads the VirtueMartCart:

require_once JPATH_SITE.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'cart.php';
if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php');
Title: Re: Issue with VirtueMartCart::checkForQuantities or not?
Post by: Milbo on June 07, 2013, 11:03:29 AM
Quote from: luizwbr on June 05, 2013, 21:49:26 PM

But in method checkForQuantities, on the line: 617 has this code:

$stockhandle = VmConfig::get('stockhandle','none');

This variable always return 'none'.

But if i change to this code below, the $stockhandle loads the right VM configuration (disableadd) :


$config = VmConfig::loadConfig();
$stockhandle = $config->get('stockhandle');


This is really strange. The difference is just that you use the dynamic method to load the config, which is "wrong" because the function is declared as static. To use VmConfig::get('value',default) is everywhere else working.