【问题标题】:Magento Notification Message Issues In Admin & Front-End管理和前端中的 Magento 通知消息问题
【发布时间】:2012-10-02 11:20:37
【问题描述】:

我在/app/code/core/Mage/Core/Block/Messages.php下面的路径中为meagento通知消息自定义了新样式

下面的代码是我自定义的

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;
    }

我已经替换了上述函数中的默认 Magento 主题,通知主题在前端工作正常,但管理面板通知主题未应用..

那么如何在上面的函数中找到像(管理员消息,前端消息)这样的消息类型?

请给我建议?

谢谢大家。

【问题讨论】:

    标签: magento


    【解决方案1】:

    前端和后端消息由不同的块类处理。您正在编辑的代码仅用于 Magento 的前端。如果您希望自定义后端消息,您需要编辑/重载一个不同的类,即Mage_Adminhtml_Block_Messages(位于/app/code/core/Mage/Adminhtml/Block/Messages.php)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-04
      • 2011-08-01
      • 2019-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多