Magento Provides configuration options to change the frontend logo. However to customize the admin panel login form and logo core files needs to be edited.
To overcome this limitation we can override the adminhtml files in a custom module. The custom module is named as Mydons_Customadminlogo
Step 1: Upload the custom logo in media directory. For this example i have uploaded my custom logo in media directory with the name MYDONS.png.
Step 2: Now we write our custom module config.xml file inapp/code/local/Mydons/Customadminlogo/etc/config.xml file. In this file we are overriding the admin controller to change the default template.
Note: In magento version 1.5 the admin login template files are rendered from the admin controller. For the latest versions say magento 1.7, the admin login template files are rendered from main.xml layout. So to work in latest version the customadminlogo.xml layout file is used.
HTML Code:
<?xml version="1.0"?>
<config>
<frontend>
<routers>
<customadminlogo>
<use>standard</use>
<args>
<module>Mydons_Customadminlogo</module>
<frontName>customadminlogo</frontName>
</args>
</customadminlogo>
</routers>
</frontend>
<adminhtml>
<layout>
<updates>
<customadminlogo>
<file>customadminlogo.xml</file>
</customadminlogo>
</updates>
</layout>
</adminhtml>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<Mydons_Customadminlogo for="Mage_Adminhtml">Mydons_Customadminlogo</Mydons_Customadminlogo>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
Step 3: The admin controller subclass is created inapp/code/local/Mydons/Customadminlogo/controllers/IndexController.php. This file is needed for overriding admin templates in magento 1.5 version.
PHP Code:
<?php
require_once 'Mage/Adminhtml/controllers/IndexController.php';
class Mydons_Customadminlogo_IndexController extends
Mage_Adminhtml_IndexController
{
protected function _outTemplate($tplName, $data=array())
{
$this->_initLayoutMessages('adminhtml/session');
if($tplName=="login")
$block = $this->getLayout()->createBlock('adminhtml/template')
->setTemplate("customadminlogo/$tplName.phtml");
else if($tplName=='forgotpassword')
$block = $this->getLayout()->createBlock('adminhtml/template')
->setTemplate("customadminlogo/$tplName.phtml");
else
$block = $this->getLayout()->createBlock('adminhtml/template')
->setTemplate("$tplName.phtml");
foreach ($data as $index=>$value) {
$block->assign($index, $value);
}
$html = $block->toHtml();
Mage::getSingleton('core/translate_inline')
->processResponseBody($html);
$this->getResponse()->setBody($html);
}
}
Step 4: For the latest versions to override the admin templates we use our own layout xml file inapp/design/adminhtml/default/default/customadminlogo.xml
HTML Code:
<?xml version="1.0"?>
<layout>
<adminhtml_index_login>
<block type="core/text_list" name="root" output="toHtml">
<block type="adminhtml/template" name="content" template="customadminlogo/login.phtml">
<block type="core/text_list" name="form.additional.info" />
</block>
</block>
</adminhtml_index_login>
<adminhtml_index_forgotpassword>
<block type="core/text_list" name="root" output="toHtml">
<block type="adminhtml/template" name="content" template="customadminlogo/forgotpassword.phtml">
<block type="core/text_list" name="form.additional.info" />
</block>
</block>
</adminhtml_index_forgotpassword>
</layout>
Step 5: Now copy your login.phtml and forgotpassword.phtml template files to the below directory
app/design/adminhtml/default/default/customadminlogo/
Now we can customize the template files to our wish.
View more threads in the same category:
Bookmarks