Magento: Session Success or Failure Message after redirect – Magento HowTo

27. April 2011 at 10:14

Add a Success, Info or Error Message to the session and save this for re-direction in Magento

//A Success Message
 Mage::getSingleton('checkout/session')->addSuccess("Your cart has been updated successfully!");
 //A Error Message
 Mage::getSingleton('checkout/session')->addError("Your cart has been updated successfully!");
 //A Info Message (See link below)
 Mage::getSingleton('checkout/session')->addNotice("This is just a FYI message...");
 //These two lines are required to get it to work
 session_write_close(); //THIS LINE IS VERY IMPORTANT!
 $this->_redirect('checkout/cart');
Daniel Briegert

Daniel Briegert

xing: https://www.xing.com/profile/Daniel_Briegert

More Posts - Website

Follow Me:
TwitterFacebook