Using IE6 and in early versions of IE7 (but not the latest), putting “1” quantity in the qty box on the product detail page then adding it to your cart will add 2 of the items. Leaving quantity blank and clicking “add to cart” only adds 1.
Similarly, if an option is unavailable (e.g., size XL is unavailable and an error message reflecting this is shown) 1 item will still be added to the cart.
protected function _setProductQuoteQty(Mage_Catalog_Model_Product $product, $qty, $replace = false)
to
protected function _setProductQuoteQty(Mage_Catalog_Model_Product $product, $qty, $replace = true)
fixes this issue. It also changes the default functionality a bit, since it flags it to replace an existing item instead of adding another one of the same, obviously. However, it does get it wroking until the core code is updated with a more complete fix.
I’m also having this problem, but ONLY with IE8 (beta). Leave 1 in box, Add to Cart, you get 2 (along with 2 green confirmation messages at the top). Change qty in box to 2, Add to Cart, you get 4 (with 4 green confirmation messages).
This happens ONLY when adding to cart from the product detail pages, not the category pages where Add to Cart is also available - those work correctly.
I’m running the latest Magento, 1.2.1.
Funny thing is, this wasn’t happening before I upgraded. Not sure if it showed up this last upgrade, or the one before, but definitely wasn’t happening 2 upgrades ago. I haven’t changed the product detail template since then, so I have no idea what caused this.
Just in case anybody else is experiencing the same IE8 bug, you just need to add
type="button"
to the “Add to cart” button. It seems that IE8 assumes that a button without the type property is actually a submit button and fires the submit event twice (one automatically and another because of the onclick event).
So you will have:
<button type="button" class="form-button" onclick="productAddToCartForm.submit()"><span><?php echo $this->__('Add to Cart') ?></span></button>