1

I would like to move the notification toolbar thats located under the menu of Magento's admin panel and place it in a div i have in the header.

I tried achieving this by cutting the following line from app/design/adminhtml/default/default/template/page.phtml

<?php echo $this->getChildHtml('notifications'); ?>

and pasting it in app/design/adminhtml/default/default/template/page/header.phtml

but that didn't work.

could someone advise me on how to move the notification block to the header section, please.

1

First, you should not edit core files. Instead create a custom admin theme as described here: https://magento.stackexchange.com/a/80533/243

Then copy the modified header.phtml to app/design/adminhtml/default/yourname/template/page/header.phtml

And create app/design/adminhtml/default/yourname/layout/local.xml with the following content:

<?xml version="1.0"?>
<layout>
    <default>
        <reference name="root">
            <action method="unsetChild"><block>notifications</block></action>
        </reference>
        <reference name="header">
            <action method="append"><block>notifications</block></action>
        </reference>
    </default>
</layout>

This will remove the notifications block from its current position in the layout hierarchy (as child of root) and add it as as child of header instead.

1

You also have to edit your xml. To call any childHtml in header.phtml, you must have that block defined inside of your header block section in corresponding xml file.

Open your main.xml and find

<block type="adminhtml/page_header" name="header" as="header"></block>

and replace it with:

        <block type="adminhtml/page_header" name="header" as="header">
            <block type="index/adminhtml_notifications" name="index_notifications" template="index/notifications.phtml"></block>
        </block>

After this you may call <?php echo $this->getChildHtml('index_notifications');?> in your header.phtml file.

Remember you shouldn't edit the core files. Instead you should extend the file.

Hope this will do the trick.

  • sorry, but this method didn't seem to work for me! – Nxlevel Sep 3 '15 at 0:04

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.