Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Unset Magento Error Message Session?

Tags:

magento

I need to unset the error message session in magento for below code.

Mage::getSingleton('core/session')->addError($message);

Can any one help me?

like image 904
Maniprakash Chinnasamy Avatar asked Mar 08 '13 09:03

Maniprakash Chinnasamy


People also ask

How to unset session in Magento 2?

Unset sessions in Magento 2 In case you want to unset those sessions, let do as the following: $block->getCatalogSession()->unsMyName(); $block->getCheckoutSession()->unsTestData(); $block->getCustomerSession()->unsTestHello();

How many types of sessions are there in Magento 2?

Magento2 provides five types of sessions: Magento\Backend\Model\Session– This session is used for Magento backend. Magento\Catalog\Model\Session– Catalog session is used for the frontend for product filters. Magento\Checkout\Model\Session– Checkout session is used to store checkout related information.


1 Answers

You should be able to use the following code, though it will return all messages (it will not echo them), it will clear them:

Mage::getSingleton('core/session')->getMessages(true); // The true is for clearing them after loading them

I hope this answers your question. ^_^

like image 186
Menno Avatar answered Oct 20 '22 17:10

Menno