I have developed ajax addtocart functionality with a dropdown box that displays the item along with it's picture, price, etc. It also has 'close' and 'go to cart' buttons.

After the addition of an item no apparent error is raised. When I click the cart button on the main page the cart page does not display an error either. However, when I click the dropdown box's 'go to cart' button this is triggered on the next pageview (on the cart page).

               <?php if ($_rate->getErrorMessage()): ?>
                <ul class="messages"><li class="error-msg"><ul><li><?php echo $this->escapeHtml($_rate->getErrorMessage()) ?></li></ul></li></ul>

And, again, there is no error message that is displayed. It merely generated a list with the class of 'error-msg'.

Any idea as to why this might happen?

The button in question is:

<button id="checkout-btn" name="checkout-btn" type="button"><span><span><?php echo $this->__('Checkout') ?></span></span></button>

And the javascript function that handles it's onclick event is:

        setLocation('<?php echo Mage::helper('checkout/url')->getMSCheckoutUrl(); ?>');
else if(document.getElementById('checkout-btn').attachEvent){
        setLocation('<?php echo Mage::helper('checkout/url')->getMSCheckoutUrl(); ?>');

I've even tried to remove all error messages in the session in the controller before the ajax response is sent back to the user:

  • 1
    Somewhere along the line there in an addError. Check your extension to see if you have one in there. If so, comment it out to see if the blank error message still shows up. Jan 27, 2015 at 15:22
  • @seanbreeden there are no addError calls in this extension. It is only triggered when I click the above button when I go to the cart, it isn't visible on any other pageviews. Jan 27, 2015 at 15:29
  • 1
    Can you please add the contents of the controller that is called by the getMSCheckoutUrl() method? Jan 27, 2015 at 22:07
  • @jharrison.au it's nothing out of the ordinary, however, I changed the method call to getCartUrl() and the problem seems to have dissipated. Jan 28, 2015 at 13:16
  • 1
    ok that's great - I'd say the custom controller is missing some lines that generate the session messages. Can you answer this question yourself and accept it? Jan 28, 2015 at 22:18

1 Answer 1


The button that is used here uses a function that is more useful in other situations. In this certain one an error was thrown from current configurations.





Seems to dissapate this error generation (which upon closer examination was a blank string of length 84 " ".

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.