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');
GD Star Rating
loading...
GD Star Rating
loading...
Magento: Session Success or Failure Message after redirect - Magento HowTo, 5.8 out of 10 based on 6 ratings