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).
thanks – you saved my day.
Glad to be of help.
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!
Thanks Barcaro
Hey Sid,
thanks so much for this!!!
Thanks. Just what I needed.
“email (will not be published)” Internet Explorer
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.
Thank you very much, its Great !
Thanks a lot, Sid.
Quality posts is the secret to attract the people to go to see the site, that’s what this web site is providing.