To change the AdminHTML Template or Theme, you will need to know how to override Magento’s core modules, and know how the templates in Magento work. This article assumes that you know how to do this. If you do not, please read the appropriate Wiki Articles on the subject before continuing.
Creating a new template inside design/adminhtml/default/ and placing template files in the folder does not automatically override the default Magento backend theme, nor is there an option in Magento’s backend to change this theme.
To correct this, we must manually instruct Magento that we want to change the selected theme, so that we can use our own template files. To do this, we are going to override a Magento block called Mage_Adminhtml_Block_Page and use our classes’ construct function to tell Magento that we want to use our own theme.
[TR]
Copy The Class
[TD][/TD]
[/TR]
The class that we are going to be changing is located inmagento/app/code/core/Mage/Adminhtml/Block/Page.php. Create a the new folders required so that you have /magento/app/code/local/MyCompany/Adminhtml/Block/ available, and copy Page.php there. (MyCompany can be whatever you want, just make sure that it’s the same the entire time you are going through the steps in this article.)
[TR]
Change The Class Name
[TD][/TD]
[/TR]
The next step is the change the class name. Right now your class name is Mage_Adminhtml_Block_Page, we are going to change it to MyCompany_Adminhtml_Block_Page. Those of you who have overridden Magento modules before know that we also need to change the class that our new class extends. We are going to do this, but rather than extend our original class, change the extending class to Mage_Adminhtml_Block_Template. Your class delaration should now read: class MyCompany_Adminhtml_Block_Page extends Mage_Adminhtml_Block_Template
[TR]
Set The Theme
[TD][/TD]
[/TR]
Now that our class named correctly, we need to actually tell Magento what theme to use. We are going to run one of Magento’s core functions called setTheme, and we are going to tell it the name of the Theme we want the backend to use. This theme should be the foldername located in magento/app/design/adminhtml/ and will most likely be called MyCompany. To do this, empty out the class and enter this:
- class MyCompany_Adminhtml_Block_Page extends Mage_Adminhtml_Block_Template
- {
- public function __construct()
- {
- Mage::getDesign()->setTheme('MyCompany');
- }
- }
[TR]
Activate The Class
[TD][/TD]
[/TR]
Open up magento/app/etc/local.xml. In this file we are going to tell Magento to use our new Class instead of the core class. You should already be familiar with how to do this, but if you are not, here is how:
Locate the blocks section of the XML file, it should be located under config and then global. In it, enter the following:
- <adminhtml>
- <rewrite>
- <page>MyCompany_Adminhtml_Block_Page</page>
- </rewrite>
- </adminhtml>
[TR]
Design Your Template
[TD][/TD]
[/TR]
Magento should now be looking in the correct folder the backend template files. The best place to start when creating a template for the backend is page.phtml, located inmagento/design/adminhtml/default/default/template/, and of course you know to copy the file tomagento/design/adminhtml/default/MyCompany/template/.
View more threads in the same category:
- Успішність діяльності фірми
- Custom Recipe Box Designs
- Significance of Medals
- Einführung in das Burning Bet Casino
- Die besten Vorteile von Apple Pay Casinos
- Food Delivery App Development
- Halloween party
- Как выбрать качественные стройматериал
- Спиннинговая ловля окуня
- Qaysi o‘yin eng yuqori to‘lovni beradi?
Bookmarks