News:

Looking for documentation? Take a look on our wiki

Main Menu

Adding to cart resets prices of other products

Started by nerfmarius, May 28, 2013, 12:21:58 PM

Previous topic - Next topic

nerfmarius

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..

mfuller526

State your Joomla, Virtuemart and PHP versions for you to be helped. Include a URL for your cart too.
Joomla! 2.5.28, PHP 5.4.36,  MoWebSo3.2.19

Milbo

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