VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: OpenGlobal on May 22, 2012, 01:05:29 AM

Title: Stockable variant bug fix (additional charge doubling on checkout)
Post by: OpenGlobal on May 22, 2012, 01:05:29 AM
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
Title: Re: Stockable variant bug fix (additional charge doubling on checkout)
Post by: plastique on May 22, 2012, 16:32:18 PM
Hey OpenGlobal,

I have the same problem.

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

Thank you
Title: Re: Stockable variant bug fix (additional charge doubling on checkout)
Post by: OpenGlobal on May 22, 2012, 16:38:36 PM
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
Title: Re: Stockable variant bug fix (additional charge doubling on checkout)
Post by: plastique on May 22, 2012, 17:41:13 PM
Thanks openglobal,

Are you facing any problems after this fix ?
Title: Re: Stockable variant bug fix (additional charge doubling on checkout)
Post by: OpenGlobal on May 22, 2012, 17:44:42 PM
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
Title: Re: Stockable variant bug fix (additional charge doubling on checkout)
Post by: plastique on May 22, 2012, 17:53:52 PM
Tested and working great until now..
I'll test it better and i'll post if i find any issues.

Thanks for this!
Title: Re: Stockable variant bug fix (additional charge doubling on checkout)
Post by: OpenGlobal on May 29, 2012, 16:04:30 PM
What version of Joomla and VM are you using?

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

OpenGlobal
Title: Re: Stockable variant bug fix (additional charge doubling on checkout)
Post by: OpenGlobal on May 30, 2012, 12:45:10 PM
Can you give some screenshots of the configuration for this product too.

OpenGlobal
Title: Re: Stockable variant bug fix (additional charge doubling on checkout)
Post by: OpenGlobal on May 30, 2012, 18:42:30 PM
Those screenshots aren't for a stockable cart variant, they're for a normal cart variant.

OpenGlobal
Title: Re: Stockable variant bug fix (additional charge doubling on checkout)
Post by: OpenGlobal on May 30, 2012, 18:59:09 PM
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
Title: Re: Stockable variant bug fix (additional charge doubling on checkout)
Post by: Milbo on May 30, 2012, 22:24:09 PM
http://forum.virtuemart.net/index.php?topic=98140.0

strange here it is the opposite, right in the cart, but wrong in the productdetail