Setting custom Admin theme from a Module

Last modified by sneeuwitje on Fri, June 25, 2010 07:10
Source|Old Revisions  

Frontend templates are simple to change via Admin, from default/default to default/mytheme. The Admin templates take a little more work, but it’s easy to do. This method was tested under Magento 1.3.2.3.

These steps apply within a Magento module. There are many tutorials on creating a basic module, so we will not repeat it here. All you need are the basic module directories, the module’s xml file under /app/etc/modules, and a skeleton config.xml for your module.

Create a Theme Directory

Create a directory for your theme /app/design/adminhtml/default/mytheme and copy any templates, layouts, and locale you need. This works the same way as the frontend themes.

Edit your config.xml

In your config.xml file, under the <config> section, add this:

  1. <stores>
  2.     <admin>
  3.         <design>
  4.             <package>
  5.                 <name>mytheme</name>
  6.             </package>
  7.             <theme>
  8.                 <default>mytheme</default>
  9.             </theme>
  10.         </design>
  11.     </admin>
  12. </stores>

Or leave default Magento install intact –and extend default– by creating /app/etc/local.xml ( start with a duplicate of /app/etc/config.xml ), and add:

  1.     <stores>
  2.         <admin>
  3.             <design>
  4.                 <package>
  5.                     <name>default</name>
  6.                 </package>
  7.                 <theme>
  8.                     <default>mytheme</default>
  9.                 </theme>
  10.             </design>
  11.         </admin>
  12.     </stores>

You’ll also have to create folders:

  • /app/design/adminhtml/default/mytheme
  • /skin/adminhtml/default/mytheme

And add stuff you need customized there. This last approach will give you fall-back to the default package (or whatever package you wish to extend).

An advantage of extending a package is that you only have to add things you need changed. Magento will use the extended package when no alternative is available in the extending theme. This might not always be what you want, because Magento will not throw exceptions anymore if a module is unimplemented in your theme.




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs