How to Make Custom admin theme in Magento


Follow these steps :-
 
Step 1:- Save this file in app/etc/modules/Smart_Admintheme.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Smart_Admintheme>
            <active>true</active>
            <codePool>local</codePool>
        </Smart_Admintheme>
    </modules>
</config>


Step 2 :- now create folder and save file in this way app\code\local\Smart\Adminthem\etc\config.xml

<?xml version="1.0"?>
<config>
  <global>
    <models>
        <smartdminthemecontroller>
             <class>Smart_Admintheme_Controller</class>
        </smartdminthemecontroller>
    </models>
    <events>
      <adminhtml_controller_action_predispatch_start>
        <observers>
          <smart_themeoverride_observer>
            <type>singleton</type>
            <!-- inchooadminthemecontroller/observer  -->
            <class>Smart_Admintheme_Controller_Observer</class>
            <method>overrideTheme</method>
          </smart_themeoverride_observer>
        </observers>
      </adminhtml_controller_action_predispatch_start>     
    </events>
  </global>

</config>

Step 3 :- now create folder and save file in this way app\code\local\Smart\Adminthem\etc\system.xml

<?xml version="1.0"?>
<config>
    <sections>
        <design>
            <groups>
                <admin translate="label">
                    <label>Admin Theme</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <fields>
                        <theme translate="label comment">
                            <label>Admin theme name</label>
                            <comment>Override default admin theme.</comment>
                            <frontend_type>text</frontend_type>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                        </theme>
                    </fields>
                </admin>
            </groups>
        </design>
    </sections>
</config>


Step 4 :- now create folder and save file in this way app\code\local\Smart\Adminthem\Controller\Observer.php

<?php
class Smart_Admintheme_Controller_Observer
{
    //Event: adminhtml_controller_action_predispatch_start
    public function overrideTheme()
    {
        Mage::getDesign()->setArea('adminhtml')
            ->setTheme((string)Mage::getStoreConfig('design/admin/theme'));
    }
}


Now goto System->Configuration->General->Design (Default Config scope) .Your theme goes in app/design/adminhtml/default/yourthemename folder. It doesn’t need to be whole theme of course, just the files you’re changing.

No comments:

Post a Comment