want to over-ride adminhtml in Magento [duplicate] - magento

This question already has answers here:
Magento - Override adminhtml template file
(4 answers)
Closed 8 years ago.
I have set up a custom theme in Magento admin panel under "Design" tab
I can now put my custom code in
\app\design\frontend\default\MYTHEME\template
instead of
\app\design\frontend\base\default\template
I would like to do the same for the admin panel code. In other words, I would like to selectively replace vanilla code in this directory
\app\design\adminhtml\default\default\template
with custom code, likely in this directory
\app\design\adminhtml\default\MYTHEME\template
Magento does not seem to recognize this automatically.
edit - - -
For the sake of maintainability it would be beneficial to have a global over-ride like we have in 'frontend'. Over-riding module by module in the module layout may not be obvious to next person that looks at the code.

Try
In /app/code/local/MageIgniter/AdminThemeAndMod/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<MageIgniter_AdminThemeAndMod>
<version>0.1.0</version>
</MageIgniter_AdminThemeAndMod>
</modules>
<stores>
<admin>
<design>
<theme>
<default>mageigniter</default>
</theme>
</design>
</admin>
</stores>
</config>
In /app/etc/modules/MageIgniter_AdminThemeAndMod.xml
<!-- /app/etc/modules/MageIgniter_AdminThemeAndMod.xml -->
<config>
<modules>
<MageIgniter_AdminThemeAndMod>
<active>true</active>
<codePool>local</codePool>
</MageIgniter_AdminThemeAndMod>
</modules>
</config>
Then add your newly add/update files to
/app/design/adminhtml/default/mageigniter/layout/
/app/design/adminhtml/default/mageigniter/template/
/skin/adminhtml/default/mageigniter/

for "/app/etc/modules/MageIgniter_AdminThemeAndMod.xml", you mean -
<?xml version="1.0"?>
<!-- /app/etc/modules/MageIgniter_AdminThemeAndMod.xml -->
<config>
<modules>
<MageIgniter_AdminThemeAndMod>
<active>true</active>
<codePool>local</codePool>
</MageIgniter_AdminThemeAndMod>
</modules>
</config>

Related

My magento module is not shown?

I have created a new Magento module which is in
app/code/local/my_module/...
but when I goto magento backend I cant see my module?
1- Create an XML file in etc/modules/ to be able to see your Module in magento-backend
etc/modules/MyCompany_MyModuleName.xml
2- MyCompany_MyModuleName.xml
<?xml version="1.0"?>
<config>
<modules>
<MyCompany_MyModuleName>
<active>true</active>
<codePool>local</codePool>
</MyCompany_MyModuleName>
</modules>
</config>

Overriding adminhtml controller in Magento not working

Sorry for my english.
Just a question. In my magento, when i refresh statistics in Reports / Resfresh statistics, it's okay but it redirects me on the homepage of my website.
I solved this problem by changing two lines code in app/code/core/Mage/adminhtml/controllers/Report/StatisticsController.php.
But it's better to create "an override".
So i decided to create a module in app/code/local/myname/.
I have my file in app/etc/modules myname_all.xml wich contains :
<?xml version="1.0"?>
<config>
<modules>
<MyName_AdminExtras>
<active>true</active>
<codePool>local</codePool>
</MyName_AdminExtras>
Next, I create app/code/local/Myname/AdminExtras/Adminhtml/etc/config.xml which contains
<?xml version="1.0"?>
<config>
<modules>
<MyName_AdminExtras>
<version>0.1.0</version>
</MyName_AdminExtras>
</modules>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<MyName_AdminExtras before="Mage_Adminhtml">MyName_AdminExtras_Adminhtml</MyName_AdminExtras>
</modules>
</args>
</adminhtml>
</routers>
</admin>
And finally, i created a folder named controllers which contains another folder named Report and the file named StatisticsController.php which is calling the base file /app/code/core/Mage/Adminhtml/controllers/Report/StatisticController.php
But it doesn't word. File is not calling by Magento.
What's wrong ?
Hum sorry i found the answer. My folders weren't ok.
I just follow this way :
App/code/local/MyName/AdminExtras/controllers/adminhtml..
instead of
App/code/local/MyName/AdminExtras/Adminhtml/controllers

My custom CMS Layout Template in Magento is not loaded

I have created custom CMS layout for Magento according this tutorial. On my localhost(XAMPP on Win7) it is working, but when I have uploaded all 3 files to my web:
app/code/local/Lorinc/cmsLayout/etc/config.xml
app/design/frontend/sportsfans01/default/template/page/cmsLayout.phtml
app/etc/modules/Lorinc_cmsLayout.xml
And it is not working there.
Here is the code of config.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_cmsLayout>
<version>0.1.0</version>
</Lorinc_cmsLayout>
</modules>
<global>
<page>
<layouts>
<cmsLayout translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>cmsLayout</layout_handle>
</cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
And here is Lorinc_cmsLayout.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_cmsLayout>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Page />
</depends>
</Lorinc_cmsLayout>
</modules>
</config>
I have tried everything. I have changed files and folder permissions (files 0644, folders 0755), i have used magento-cleanup.php, my cache is disabled, I have tried to logout and login again and nothing works. Any ideas what is wrong there?
just looked at your question and the first thing I saw is that you have a wrong folder structure:
The path app/design/frontend/sportsfans01/default/template/page/cmsLayout.phtml
has to be changed to
app/design/frontend/default/sportsfans01/template/page/cmsLayout.phtml
Don't know if its just a typo of yours!
Furthermore you could check the logs of magento:
var/log/exception.log
var/log/system.log
Hope this will help
Regards
Vince
Please try this. I found it in App/code/core/Mage/Page/etc/config.xml for the 1column.phtml layout
<global>
<page>
<layouts>
<cmsLayout module="page" translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>page_cmsLayout</layout_handle>
</cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
If this won't help please try with changing different theme folder.Be sure to avoid typo mistake.
Problem finally solved. I already had one custom layout (called HomeLayout) on that page so I just merged that 2 layouts. Here is the code of app/code/local/Lorinc/HomeLayout/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Lorinc_HomeLayout>
<version>0.1.0</version>
</Lorinc_HomeLayout>
</modules>
<global>
<page>
<layouts>
<Lorinc_HomeLayout translate="label">
<label>HomeLayout</label>
<template>page/HomeLayout.phtml</template>
<layout_handle>HomeLayout</layout_handle>
</Lorinc_HomeLayout>
<Lorinc_cmsLayout translate="label">
<label>cmsLayout</label>
<template>page/cmsLayout.phtml</template>
<layout_handle>cmsLayout</layout_handle>
</Lorinc_cmsLayout>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
And it works perfect.

Overriding Core Blocks

I'm try to overriding Mage_Core_Block_Messages
I'm create module
Mycompany_Core.xml and save in path app/etc/modules/Mycompany_Core.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Core>
<active>true</active>
<codepool>local</codepool>
</Mycompany_Core>
</modules>
</config>
next I was create in app/code/local/Mycompany/Core/Block/Messages.php
class Mycompany_Core_Block_Messages extends Mage_Core_Block_Messages
{
//update method
}
and add config.xml in app/code/local/Mycompany/Core/etc/config.xml
<config>
<modules>
<Mycompany_Core>
<version>0.0.1</version>
</Mycompany_Core>
</modules>
<global>
<blocks>
<core>
<rewrite>
<messages>Softdk_Core_Block_Messages</messages>
</rewrite>
</core>
</blocks>
</global>
</config>
But i don't see any result on frontend, I'm wonder where I'm make mistake.
Thx for help.
There are two things that caught my eye.
1.) In your module's registration file, it should be codePool and not codepool (as also said by David in comments)
2.) What is Softdk? If that is the name of your new module, then replace Mycompany with Softdk everywhere in your module.
Clear cache and voila!

Magento Module for new CMS layout, but in version 1.7.0.2

I'm trying to simply create a new layout option for a CMS page in Magento. I've followed the instructions here on the Magento wiki to create a module and it does not work. When I make the same addition to the actual core config.xml file, it works fine, but not as a custom module. Based on some research it looks like this would have worked in Magento 1.6, but does not work on 1.7, I'm trying to figure out why. I have the following:
app/etc/modules/Fruit_Banana.xml
<?xml version="1.0"?>
<config>
<modules>
<Fruit_Banana>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Page />
</depends>
</Fruit_Banana>
</modules>
</config>
app/code/local/Fruit/Banana/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Fruit_Banana>
<version>0.1.0</version>
</Fruit_Banana>
</modules>
<global>
<page>
<layouts>
<homepage_middle translate="label">
<label>Homepage</label>
<template>page/homepage.phtml</template>
<layout_handle>homepage_one</layout_handle>
</homepage_middle>
<!-- add more layouts here -->
</layouts>
</page>
</global>
</config>
Any ideas why it doesn't seem to be working as a module? I am using version 1.7.0.2
The local modules should be in the code directory
app/code/local/Fruit/Banana/etc/config.xml
and not in the core directory as you mentioned
app/code/core/local/Fruit/Banana/etc/config.xml
Well seems like I messed up! It does in fact work in 1.7, my problem was I had the filename for config.xml spelled confix.xml
Once I adjusted that, the custom layout popped right up! Thanks to those that chimed in.

Resources