Stockable variant bug fix (additional charge doubling on checkout)

Started by OpenGlobal, May 22, 2012, 01:05:29 AM

Previous topic - Next topic

OpenGlobal

There is a bug in the stockable variants plugin where the additional charge is doubled at the checkout.

eg.
Base price: 10.00
Additional charge: 1.50

Product page: 11.50
BUT, Checkout: 13.00!!

I think the problem is that the plgVmOnAddToCart() function in the stockable variant plugin is adding the additional charge to the product in the cart. The additional charge is then recalculated at the checkout.

The fix is simply to stop plgVmOnAddToCart() from adding the additional charge. I've commented out the line below:


if (!empty($productCustomsPrice->custom_price)) {
//TODO adding % and more We should use here $this->interpreteMathOp
// $product->product_price +=(float)$productCustomsPrice->custom_price;

}


Can anyone think of a reason why this is not a good fix? Is there a reason why the stored cart needs to store the base price plus the additional charge?

OpenGlobal

plastique

Hey OpenGlobal,

I have the same problem.

You didn't mention, in which file to make the fix ?

Thank you
Joomla 2.5.4
Virtuemart 2.0.6

OpenGlobal

Sorry. There's only one file, but that's not obvious if you haven't been delving into it :-)

/plugins/vmcustom/stockable/stockable.php

OpenGlobal

plastique

Thanks openglobal,

Are you facing any problems after this fix ?
Joomla 2.5.4
Virtuemart 2.0.6

OpenGlobal

I'm not seeing any issues at all, but I'm not very familiar with the workings of the cart code so I'm not 100% confident in it.

OpenGlobal

plastique

Tested and working great until now..
I'll test it better and i'll post if i find any issues.

Thanks for this!
Joomla 2.5.4
Virtuemart 2.0.6

OpenGlobal

What version of Joomla and VM are you using?

Can you make some screenshots of your configuration and the results.

OpenGlobal

OpenGlobal

Can you give some screenshots of the configuration for this product too.

OpenGlobal

OpenGlobal

Those screenshots aren't for a stockable cart variant, they're for a normal cart variant.

OpenGlobal

OpenGlobal

No, you are just using "cart variants". This thread is about "Stockable cart variants" They are different types of custom field and are not related.

OpenGlobal

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/