6

I would like to override app/design/adminhtml/default/default/template/page.phtml

i'm currently using an extension that overrides app/design/adminhtml/default/default/template/page/header.phtml with a file in app/design/adminhtml/default/default/template/extname/page/header.phtml

i have recently made changes to the page.phtml file, but i would like to override it in the right way, but i'm not sure how. i was going through the codes to see how the extension developers override header.phtml but i cant figure it out.

can anyone tell me how to override this specific file?

3 Answers 3

4

Go to your extension's admin layout file or create one if you don't have yet.

default/default/layout/your_xml.xml

and add this in default section:

<layout>
    <default>
       <reference name="root">
          <action method="setTemplate">
              <template>your_path/page.phtml</template>
          </action>
       </reference>
    </default>
</layout>

I haven't tested but should work. Good luck.

1
  • Why do we need an extension to override adminhtml, but we don't need one for frontend theme?
    – Black
    Feb 3, 2020 at 16:01
38

You can declare a new primary theme for your admin area by customizing config (e.g. app/etc/local.xml) with the following:

<config>
    <stores>
        <admin>
            <design>
                <theme>
                    <default>your_theme</default>
                </theme>
            </design>
        </admin>
    </stores>
</config>

This will just set another level of fallback, and you can copy this and other custom templates/layout/etc under the right path in app/design/adminhtml/default/your_theme/

2
  • 2
    Thank you for this, this should be the accepted answer in my opinion as it allows for much easier modification of ALL adminhtml template files without having to explicitly configure a new view script for each file. Mar 9, 2016 at 21:29
  • 2
    It should be "<template>your_theme</template>".
    – hellcode
    Sep 29, 2017 at 11:38
1

First of all I'm not believe this is the correct way of overriding adminhtml templates. But I try this approach and it works, So just wanna share.

Add this to your custom Module config.xml

<stores>
        <admin>
            <design>
                <theme>
                    <default>default</default>
                    <template>mycustom</template>
                </theme>
            </design>
        </admin>
</stores>

Now You can just override by copying templates from default to mycustom app\design\adminhtml\default\default\template\sales\order\view\history.phtml app\design\adminhtml\default\mycustom\template\sales\order\view\history.phtml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.