Maniprakash Chinnasamy
Maniprakash Chinnasamy

Reputation: 2776

Magento Notification Message Issues In Admin & Front-End

I have customized the new style for meagento notification messages in below path /app/code/core/Mage/Core/Block/Messages.php

Below Code is i have customized

public function getGroupedHtml()
    { 

        $types = array(
            Mage_Core_Model_Message::ERROR,
            Mage_Core_Model_Message::WARNING,
            Mage_Core_Model_Message::NOTICE,
            Mage_Core_Model_Message::SUCCESS
        );
       $html = '';
        foreach ($types as $type) {
            if ( $messages = $this->getMessages($type) ) 
            {               

                foreach ( $messages as $message ) 
                {
                    $html.= '<div class="ml-alert-2-'.$type.'">';
                    $html.= '<div class="style-2-icon '.$type.'"></div>';
                    $html.= ($this->_escapeMessageFlag) ? $this->htmlEscape($message->getText()) : $message->getText();
                    $html.= '<div class="style-2-close '.$type.'" onclick="this.parentNode.parentNode.removeChild(this.parentNode);"></div>';
                    $html.= '</div>';
                }

            }
        }


        return $html;
    }

I have replaced the Default Magento theme in above function, The Notification Theme Works fine in Fron-end, But The Admin panel Notification Themes not applied..

So How to find the message type like (Admin message,Front-end message) in above function?

Please suggest me ?

Thanks All.

Upvotes: 0

Views: 1600

Answers (1)

Peter O&#39;Callaghan
Peter O&#39;Callaghan

Reputation: 6186

The frontend and backend messages are handled by different block classes. The code you are editing is only used in the frontend of Magento. If you wish to customise the Backend messages you will need to edit/overload a different class, namely Mage_Adminhtml_Block_Messages (which is located in /app/code/core/Mage/Adminhtml/Block/Messages.php).

Upvotes: 1

Related Questions