2

How we can check if a session variable exists in Mangento. I know how to create a new variable.

Mage::getSingleton('core/session')->setMyValue($myValue);

My aim is to check if session variable MyValue exists. If exists do nothing otherwise create one

  • did I manage to answer your question ? If so could you please mark your question as answered. – Raphael at Digital Pianism Mar 24 '16 at 9:42
6

You can do:

if (Mage::getSingleton('core/session')->getMyValue())
{
    // Value exists, do stuff
}
else
{
    // Value does not exists, do other stuff
}

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.