VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: nerfmarius on May 28, 2013, 12:21:58 PM

Title: Adding to cart resets prices of other products
Post by: nerfmarius on May 28, 2013, 12:21:58 PM
Hello,

I have this weird issue, that sometimes occurs, and the last recent ocured on latest version of Firefox.
When I add some product to cart it sometimes sets price of other products to it's price.

I had this issue before with IE9 and less, when in product title quotes were used this element were printed with double quotes, and html would become invalid like this:

<input type="hidden" class="pname" value="VALGOMIEJI POMIDORAI "BALKONZAUBER"">

I fixed this in category template using this:

<input type="hidden" class="pname" value="<?php echo htmlspecialchars($product->product_name); ?>"/>

which kind of replaces these characters, and it fixed the issue for the moment.

However, the issue still occurs sometimes and is really a big hole, since if you add cheaper product at the end, it lowers price of other products.
Maybe someone could explain a bit how cart is being updated and how is it even possible to change price and url of other products in cart.

One note: it also updates the link of the product to the one that caused it. The URL and Price is inserted to all products, but SKU remains good..
Title: Re: Adding to cart resets prices of other products
Post by: mfuller526 on June 03, 2013, 06:42:29 AM
State your Joomla, Virtuemart and PHP versions for you to be helped. Include a URL for your cart too.
Title: Re: Adding to cart resets prices of other products
Post by: Milbo on June 08, 2013, 18:57:50 PM
The reason is your "Balkonzauber", the double quotes. Yeh to use htmlspecialchars is a good idea. But as mfuller526 notes, no vm version.

But the main thing is that we do not use htmlentities($child->product_name,ENT_QUOTES); because a lot people want to use html entities in their titles. So in your case just replace the " with quot. We wont change it also because the editors work with html entities.