News:

Looking for documentation? Take a look on our wiki

Main Menu

Issue with VirtueMartCart::checkForQuantities or not?

Started by luizwbr, June 05, 2013, 21:49:26 PM

Previous topic - Next topic

luizwbr

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');
http://virtuemartbrasil.com.br - Brazillian VirtueMart official Support Group
http://loja.weber.eti.br - Paid Plugins for Virtuemart Brasil
https://www.facebook.com/groups/virtuemartpro/ - Brazillian VirtueMart group on Facebook

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/