how can I hide messages after certain time. I'm using a custom model.

$redirectMsg = Mage::getSingleton('customer/session')->addSuccess('hii');
  • You do it with js
    – PЯINCƎ
    Commented Oct 8, 2019 at 15:11
  • how please! i found this functions but where should i past it. setTimeout(function () { $redirectMsg(self.selector).find('.message').removeClass('show'); self.isHidden('false'); }, 5000);
    – Anass Hl
    Commented Oct 8, 2019 at 15:14
  • Hide all messages in all pages ?
    – PЯINCƎ
    Commented Oct 8, 2019 at 15:22
  • yes but where should i write this code I m beginner in magento
    – Anass Hl
    Commented Oct 8, 2019 at 19:38

1 Answer 1


To add your js code in all pages, let's do it as well as it should.

First, you have to create a new js file, then you declare this js file because Magento doesn't know it yet.

  1. Declare js:
    <?xml version="1.0"?>
    <layout version="0.1.0">
            <reference name="head">
                <action method="addItem"><type>skin_js</type><name>js/glob-messages.js</name></action>
  1. Create glob-messages.js file :
    /*Your js code goes here...*/

Flush cache, then your code is in place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.