Warning: Use of undefined constant wp_cumulus_widget - assumed 'wp_cumulus_widget' (this will throw an Error in a future version of PHP) in /home/blogoptimise/public_html/wp-content/plugins/wp-cumulus/wp-cumulus.php on line 375
Optimise Blog » Internet Explorer Adds Twice the Quantity to Cart
Warning: Use of undefined constant style - assumed 'style' (this will throw an Error in a future version of PHP) in /home/blogoptimise/public_html/wp-content/themes/optimblog/functions.php on line 522

Internet Explorer Adds Twice the Quantity to Cart

Written by Gordon

Topics: Magento

We all like to style our Magento add to cart button as an image button. The problem is that IE 8 (Internet Explorer 8) will add the product twice and cause the quantity of that product in the cart to double up. There is an easy fix to this problem.

Solution

<input type="image" src="<?php echo $this->getSkinUrl('add-to-basket.png') ?>"
name="image-button" onclick="productAddToCartForm.submit(); return false;" />

Notice the return false; that I’ve added after the productAddToCartForm.submit().

This will fix the problem of IE submitting the add to cart button twice.

Update (Thanks Barcaro) :
File where edit is to be made…
app/design/frontend/default/default/template/catalog/product/view/addtocart.phtml
(change /default/default/ to your custom template path).

11 Comments Comments For This Post I'd Love to Hear Yours!

  1. Matt says:

    thanks – you saved my day.

  2. Barcaro says:

    The file to patch is this one:

    app/design/frontend/default/default/template/catalog/product/view/addtocart.phtml

    (change /default/default/ to your custom template path).

    Thank you!

  3. jazkat says:

    Hey Sid,
    thanks so much for this!!!

  4. Iwin says:

    Thanks. Just what I needed.

  5. ricardo says:

    “email (will not be published)” Internet Explorer

  6. Peter says:

    You have to modify the list.phtml accordingly, for the case if someone adds to the chart direct from the listing.

    app\design\frontend\…\…\template\catalog\product\list.phtml

    <button type="button" title="__(‘Add to Cart’) ?>” class=”button btn-cart” onclick=”setLocation(‘getAddToCartUrl($_product) ?>’); return false;”>__(‘Add to Cart’) ?>

    Notice the “return false” which has been added. Around line 57.

  7. Thank you very much, its Great !

  8. amresh says:

    Thanks a lot, Sid.

  9. Quality posts is the secret to attract the people to go to see the site, that’s what this web site is providing.

11 Comments Trackbacks For This Post

  1. IE8 Adds Twice to Basket in Magento « Telescope Studios
  2. Day Four of Building a Magento Store / Sci-Fi Stuff Blog

Leave a Comment Here's Your Chance to Be Heard!