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:
if(document.getElementById('checkout-btn').addEventListener){
document.getElementById('checkout-btn').addEventListener('click',function(){
setLocation('<?php echo Mage::helper('checkout/url')->getMSCheckoutUrl(); ?>');
},false);
}
else if(document.getElementById('checkout-btn').attachEvent){
document.getElementById('checkout-btn').attachEvent("on"+'click',function(){
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:
Mage::getSingleton('checkout/session')->getMessages(true);
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
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.