0

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

$redirectMsg = Mage::getSingleton('customer/session')->addSuccess('hii');
4
  • You do it with js
    – PЯINCƎ
    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
    Oct 8, 2019 at 15:14
  • Hide all messages in all pages ?
    – PЯINCƎ
    Oct 8, 2019 at 15:22
  • yes but where should i write this code I m beginner in magento
    – Anass Hl
    Oct 8, 2019 at 19:38

1 Answer 1

0

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:
    app/design/frontend/{your_package_theme}/{your_theme_name}/layout/local.xml
    <?xml version="1.0"?>
    <layout version="0.1.0">
        <default>
            <reference name="head">
                <action method="addItem"><type>skin_js</type><name>js/glob-messages.js</name></action>
            </reference>
        </default>
    </layout>
  1. Create glob-messages.js file :
    skin/frontend/{your_package_theme}/{your_theme_name}/js/glob-messages.js
    /*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, privacy policy and cookie policy

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