如何更改magento中的消息位置?

时间:2012-09-26 14:39:50

标签: magento

我需要在magento中更改消息(错误/成功)位置。默认情况下,mangero消息(错误/成功)显示在包装器或内容中。但我需要在页面顶部显示消息。任何人都可以帮我解决这个问题。

由于

2 个答案:

答案 0 :(得分:5)

有几种方法可以做到这一点。这是一个需要一点布局xml和一个新模板至少......

布局:

<layout>
    <default>
        <reference name="after_body_start">
            <block type="core/template" name="top.messages" template="core/messages/top.phtml" before="-" />
        </reference>
    </default>
</layout>

模板:(app / design / frontend / your_package / your_theme / template / core / messages / top.phtml)

<?php $_messageCollection = $this->getMessagesBlock()->getMessageCollection() ?>

<?php if ($_messageCollection->count()): ?>
<div>
<?php
    echo $this->getMessagesBlock()->getGroupedHtml();
    $_messageCollection->clear();
?>
</div>
<?php endif; ?>

答案 1 :(得分:0)

您只需在布局xml文件中移动块即可。不幸的是,我手头没有Magento告诉你块名是什么,以及它的定义。

相关问题