10

How Do i ask magento to use a custom layout package/theme for my custom admin module?

What's the Structure and content that i have to include inside local.xml file if i have to use it for defining a custom design package?

Please tell if there are also other ways of doing this..

16

add these lines in app/etc/local.xml (or) {yourPKG/yourModule/etc/config.xml} file under <config> tag

Its better If you add it inside your module's Config folder for the reasons specied by @Marius under the comments..

 <stores>
        <admin>
            <design>
                <package>
                    <name>default</name>
                </package>
                <theme>
                    <default>MyCustomTheme</default>
                </theme>
            </design>
        </admin>
</stores>

where MyCustomTHeme is your theme folder inside app/design/adminhtml/default/MyCustomTheme

This method takes your MyCustomTheme as default theme and uses FallBack for any layout that is not found.

Adding the above line's inside app/etc/config.xml showed no effect.

And changing the Package folder name from default to "myNewPAckage" had overridden the default and required me to copy whole default into myNewPAckage folder else nothing worked.

So, to have FallBack effect, keep the package as default and give theme as yourCustomTheme.

  • 3
    +1 for this with a minor comment. You shouldn't add this in app/etc/local.xml. Usually this file is not copied between instances (dev, staging, prod) and you might lose the functionality. Use the config.xml file of a custom module. – Marius Jan 30 '14 at 7:09
  • I thought that i would override the default admin layout folder, but it actually works, we can add these lines in our modules config file too. :) thanks – user3151033 Jan 30 '14 at 10:08
  • @user3151033 it works because Magento will combine the XML from every extension's etc/config.xml together, along with app/etc/local.xml to a single all inclusive XML configuration. app/etc/local.xml is loaded first, AND then loaded again last. The reason for this is so that it can receive it's initial configuration values, and so that it also has the last say in configuration (by loading it again always last). – Darren Felton Mar 15 '16 at 19:22

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.