News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

IE: Strange Add to Cart Problem

Started by sscheidegger, November 21, 2011, 09:08:36 AM

Previous topic - Next topic

sscheidegger

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

dpodesta

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.


manch

I have this bug too in ie if i put the same product one by one in the cart...

Manch

Aliciah85


edjec

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?

jenkinhill

#5
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.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

sscheidegger

Testing with J1.7.3 and VM RC3 K, this problem is still there...

PRO

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

sscheidegger

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.

jenkinhill

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.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

PRO

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

sscheidegger

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.

Studio 42

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 ;)

sscheidegger

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.

sscheidegger


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/ 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!