VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: sscheidegger on November 21, 2011, 09:08:36 AM

Title: IE: Strange Add to Cart Problem
Post by: sscheidegger on November 21, 2011, 09:08:36 AM
Hi everybody

Testing J1.7.3 and VM1.9.8M (and the standard fruitshop template and the VM example data) I face a strange problem:
Things in general work very well: Adding products to the cart, checking out, etc. However, if in IE8 I press the "Add to Cart" button on the products details page twice in a row, it won't add the product twice. So I found out that I can click the add to cart button, it will add one product. If after that I click add to cart again (for the same product!), it won't add the product again until I restart IE. But if I change the number of products i.e. form 1 to 2, then it will add 2 pieces to the cart. From now on I cannot add 1 or 2 pieces of that product anymore. I'd have to change to a different number, that would work again, and so on...
In Firefox I don't have this problem.

Greets,
Stefan
Title: Re: IE: Strange Add to Cart Problem
Post by: dpodesta on November 22, 2011, 14:13:31 PM
I have the same problem in IE 9. If you click the add to cart button again you get nothing. The pop up says product added to cart though.

Also if I click compatibility mode button in IE9 the add to cart button doesn't work.

I need to restart IE and then turn it off and it starts working. I turned offStill can't add to items by clicking the button twice. the Google library and may have fixed that issue. "not really sure though".

Still can't add 2 items by click "add to cart " twice though.

http://www.1skinsolution.com/base

Any help would be greatly appreciated as I have a client emailing me about it everyday.

Title: Re: IE: Strange Add to Cart Problem
Post by: manch on November 22, 2011, 19:16:27 PM
I have this bug too in ie if i put the same product one by one in the cart...

Manch
Title: Re: IE: Strange Add to Cart Problem
Post by: Aliciah85 on November 23, 2011, 05:48:18 AM
i also have this issue!
Title: Re: IE: Strange Add to Cart Problem
Post by: edjec on November 29, 2011, 02:51:02 AM
Ditto!  Since upgrading to VM 1.1.9 our members cannot add items to their cart if using Mac's.  So far it seems OK with any PC browser though.

Is there any assistance for this issue?
Title: Re: IE: Strange Add to Cart Problem
Post by: jenkinhill on November 29, 2011, 13:24:14 PM
edjec, this thread is about VM2 - this is the VM2 section of the board. If having issues with 1.1.9 please post in the 1.1 forum area.
Title: Re: IE: Strange Add to Cart Problem
Post by: sscheidegger on December 13, 2011, 14:24:40 PM
Testing with J1.7.3 and VM RC3 K, this problem is still there...
Title: Re: IE: Strange Add to Cart Problem
Post by: PRO on December 13, 2011, 14:52:50 PM
Quote from: dpodesta on November 22, 2011, 14:13:31 PM

Still can't add 2 items by click "add to cart " twice though.

http://www.1skinsolution.com/base

Any help would be greatly appreciated as I have a client emailing me about it everyday.



I noticed on your site you are doing a template override with an error in your add to cart form.

<input type="hidden" class="pname" value="<?php echo $this->product->product_name ?>"/>

YOU are missing the "/" to close the input.

Try that
Title: Re: IE: Strange Add to Cart Problem
Post by: sscheidegger on December 19, 2011, 16:01:50 PM
Testing J1.7.3 and VM RC3, the behaviour in IE has improved. Several products can be added to the cart by repeatedly clicking the "Add to Cart" button.

However, the Cart Module does not work correctly yet. It seems to update, when clicking first time on the "Add to Cart" button. For the following clicks it doesn't update anymore. Only when the page is reloaded, the cart module updates and shows the correct content. When proceeding to the cart, it shows the correct products in the cart (corresponding to the number of clicks on "Add to Cart").

This behaviour again I found only in IE. With Firefox everything works perfectly.
Title: Re: IE: Strange Add to Cart Problem
Post by: jenkinhill on December 19, 2011, 16:59:20 PM
When you have such issues with IE then try the built in script debugger - hit F12. IE9 is much more sensitive to JS conflicts than other browsers.
Title: Re: IE: Strange Add to Cart Problem
Post by: PRO on December 19, 2011, 17:09:32 PM
Quote from: sscheidegger on December 19, 2011, 16:01:50 PM
Testing J1.7.3 and VM RC3, the behaviour in IE has improved. Several products can be added to the cart by repeatedly clicking the "Add to Cart" button.

However, the Cart Module does not work correctly yet. It seems to update, when clicking first time on the "Add to Cart" button. For the following clicks it doesn't update anymore. Only when the page is reloaded, the cart module updates and shows the correct content. When proceeding to the cart, it shows the correct products in the cart (corresponding to the number of clicks on "Add to Cart").

This behaviour again I found only in IE. With Firefox everything works perfectly.


are you using a template overide that the add to cart form does not has

<form method="post" class="product js-recalculate" action="index.php" >

js-recalculate   was added
Title: Re: IE: Strange Add to Cart Problem
Post by: sscheidegger on December 20, 2011, 09:11:32 AM
Quote from: BanquetTables.pro on December 19, 2011, 17:09:32 PM

are you using a template overide that the add to cart form does not has

<form method="post" class="product js-recalculate" action="index.php" >

js-recalculate   was added


Thanks for the hint! I checked, js-recalculate is there. To further analyze I activated an original template (beez5) with no overrides. And I also checked in a clean installation of Joomla and VM RC3 (with the sample products). The problem is the same in all cases: In Firefox the cart module works as expected, in IE 8 & 9 it doesn't update correctly.

Actually, I also observed another strange behaviour: There are already some products in the cart and the cart module shows them correctly (after a refresh or some navigation on the website). When now I add again a product, all the products disappear in the cart module and it shows only one product (I think the one I had added first).

As I said, this is only a problem with the cart module. When I go to the cart, everything is there as it should be.
Title: Re: IE: Strange Add to Cart Problem
Post by: Studio 42 on December 23, 2011, 12:52:13 PM
Hi,
It was a problem with customfields plugin and cart adding.
It must be solved now in SVN files but don't know if this is exactly your problem.

Plz try to get the svn files to test and give me some news ;)
Title: Re: IE: Strange Add to Cart Problem
Post by: sscheidegger on December 29, 2011, 10:59:44 AM
Hi,

thanks a lot for having a look at this. I just installed SVN 5182 on J1.7.3. Unfortunately the problem is still there.

Are you able to reproduce this problem? I'm facing it on a clean installation of Joomla and VM. The only thing I had to do was using IE instead of my favorite browser.
Title: Re: IE: Strange Add to Cart Problem
Post by: sscheidegger on December 30, 2011, 15:56:37 PM

I had a closer look at this and found it to be an AJAX caching problem in IE!

The AJAX request in line 92 of vmprices.js is being cached by IE. As long as there is no change in the request, IE will show the cached response to that request. Therefore clicking repeatedly "Add To Cart" won't update the cart module correctly.
$.getJSON(siteurl+"index.php?option=com_virtuemart&nosef=1&view=cart&task=viewJS&format=json",

http://www.codecouch.com/2009/01/how-to-stop-internet-explorer-from-caching-ajax-requests/ (http://www.codecouch.com/2009/01/how-to-stop-internet-explorer-from-caching-ajax-requests/) suggests the common getTime() workaround and a solution using Cache-Control.

On my website I tested the getTime() workaround by changing line 92 of vmprices.js to
$.getJSON(siteurl+"index.php?option=com_virtuemart&nosef=1&view=cart&task=viewJS&format=json&dummy="+new Date().getTime(),
I found it to be working in IE8, IE8 with compatibility mode, IE9 and Firefox 9.

Happy New Year!
Title: Re: IE: Strange Add to Cart Problem
Post by: sscheidegger on February 28, 2012, 15:05:41 PM
I just tested J2.5.1 and VM2.0.2. The problem is still not fixed!?! Why?
Title: Re: IE: Strange Add to Cart Problem
Post by: Milbo on April 04, 2012, 20:12:06 PM
Thanks, please test the 2.0.3 i version. still there?
Title: Re: IE: Strange Add to Cart Problem
Post by: Studio 42 on April 04, 2012, 20:34:35 PM
Hi,
Sorry, i forgot to remove the caching in the Module update.
It's now fixed in the SVN. The next offical release come in next days ;)
Title: Re: IE: Strange Add to Cart Problem
Post by: sscheidegger on April 20, 2012, 16:00:51 PM
Yes, problem gone in VM 2.0.6.

Thanks a lot!
Title: Re: IE: Strange Add to Cart Problem
Post by: jndm on October 17, 2012, 17:11:45 PM
i have this in 2.0.10...