Magento – How to Overwrite magento app->design->adminhtml

adminhtmlmagento-1.7

I have modified

app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml

what is the quick process to overwrite the page?thanks

Best Answer

To add a second templating directory to the adminhtml, for example: app/design/adminhtml/default/custom/ you'll have to modify the following file app/code/core/Mage/Adminhtml/Block/Template.php

add the following __construct method

public function __construct()
{
    Mage::getDesign()->setTheme('custom');
}

This will set the custom directory as primary templating directory and default as fallback

Of course it's better to overwrite it from your own extension. Create a class that extends the Mage_Adminhtml_Block_Template class with just that constructor and add the following to your config.xml

[...]
<global>
    <blocks>
        <customextension>
            <class>Your_Customextension_Block</class>
        </customextension>
        <adminhtml>
            <rewrite>
                <!-- allow for extra layer of adminhtml templating -->
                <template>Your_Customextension_Block_Mage_Adminhtml_Template</template>
            </rewrite>
        </adminhtml>
    </blocks>
</global>
[...]
Related Topic