0

Problem relates to Internet Explorer 11 and Google Chrome (but sometimes it works in Google chrome and sometimes not).

The add-to-cart buttons on the product list on the homepage of Magento 1.8 does not update the "total cart sum" and there's no green box pop-up with the "product-x added to cart!" confirmation text.

But after clicking on a category the green box suddenly turn up with confirmations on all products added on the homepage, and the "total cart sum" is correct.

Add-to-cart buttons in category products lists works fine as well as add-to-cart buttons on product pages.

Current html for the add-to-cart buttons on the product list on the homepage:

<div class="actions clearer">
<button type="button" title="Buy" class="button btn-cart" onclick="setLocation('http://mydomain.nu/index.php/checkout/cart/add/uenc/aHR0cDovL3N1bmRhcmUubnUvaW5kZXgucGhwLw,,/product/13/form_key/8Epibh9PEQSDwzRy/')">
<span><span>Buy</span></span></button>
</div>

Current html for the add-to-cart buttons in the product list on categories:

<div class="actions clearer">
<button type="button" title="Buy" class="button btn-cart" onclick="setLocation('http://mydomain.nu/index.php/checkout/cart/add/uenc/aHR0cDovL3N1bmRhcmUubnUvaW5kZXgucGhwL21pbmVyYWxzLmh0bWw,/product/134/form_key/8Epibh9PEQSDwzRy/')">
<span><span>Buy</span></span></button>
</div>
  • Your code is HTML, not CSS! Obligatory pedantry ;-) – Joseph Leedy Jul 20 '14 at 3:41
  • Correct, maybe the "actions clearer" class is not involved in the issue though – MagDev Jul 20 '14 at 10:05
1

I think that both links work correctly and it is only the messages that are not being displayed.

Make sure you add the messages block into your homepage via layout xml.

  • 1
    But the message is showing on the first page in google chrome some times. – MagDev Jul 20 '14 at 8:17
0

It looks like you have hard-coded the form key into that link. It must be unique for each and every visitor. Additionally, make sure that you have caching disabled for the block that is inserting that link. How you do that depends on how the block is being inserted.

This is the method you can use to get the URL with a unique form key:

Mage::helper('checkout/cart')->getAddUrl($_product);
  • 1
    How do I disable the cash for the block that is inserting that link? System - cash management? In what file would I implement that method? – MagDev Jul 20 '14 at 10:13
  • That method goes into whichever template is outputting the cart link, inside of the setLocation() function. Because there are different ways to disable the cache for a block, it is hard to tell you which to use without knowing how you are including that block. If you can, please update the question with the code that is outputting that block (preferably layout XML). – Joseph Leedy Jul 20 '14 at 13:45
  • form_key value is cached and not updating, thats why my Add to Cart buttons not working, is there a way to disabled cache or any other workaround? – Tahir Yasin Jul 16 '15 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.