Author Topic: Issue with VirtueMartCart::checkForQuantities or not?  (Read 647 times)

luizwbr

  • 3rd party VirtueMart Developer
  • Beginner
  • *
  • Posts: 28
  • Brazilian Programmer
    • Loja Weber Ti
  • Skype Name: luizwbr
  • VirtueMart Version: 2.6.10 - 2.9.9
Issue with VirtueMartCart::checkForQuantities or not?
« 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:

Code: [Select]
$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) :

Code: [Select]
$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:

Code: [Select]
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9842
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Issue with VirtueMartCart::checkForQuantities or not?
« Reply #1 on: June 07, 2013, 11:03:29 am »

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

Code: [Select]
$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) :

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