0

I'm following the tutorial link below (first method), but I am not succeeding:

http://www.magentocommerce.com/wiki/5_-_modules_and_development/admin/how_to_customize_backend_template_f.e._sales_order_information

I start creating my module on app/etc/modules/Fouron_Sales.xml:

<?xml version="1.0" encoding="utf-8"?>
<config>
    <modules>
        <Fouron_Sales> 
            <active>true</active>
            <codePool>local</codePool>
        </Fouron_Sales>
    </modules>
    <default>
        <blocks>
            <adminhtml>
                <rewrite>
                    <sales_order_view_info>Mage_Fouron_Sales_Block_Sales_Order_View_Info</sales_order_view_info>
                </rewrite>
            </adminhtml>
        </blocks>
    </default>
</config>

After I created at app/code/local/Fouron/Sales/Block/Sales/Order/View/Info.php:

<?php

class Mage_Fouron_Sales_Block_Sales_Order_View_Info extends Mage_Adminhtml_Block_Sales_Order_View_Info
{
    protected function _construct()
    {
        $this->setTemplate('fouron/sales/order/view/info.phtml');
    }     
}

And finally the file app/design/adminhtml/default/default/fouron/sales/order/view/info.phtml

I spend hours with this and tried some other modifications unsuccessfully, any help will be great. Thanks.

2
  • What is your Question?
    – SH-
    Feb 26, 2014 at 19:44
  • My code isn't working and I don't found my error...
    – Eduardo
    Feb 26, 2014 at 20:08

2 Answers 2

4

Another way to accomplish this since a lot of other paid module my customize this files, is to create a custom admin theme

In /app/etc/local.xml

 <stores>
    <admin>
        <design>
            <package>
                <name>default</name>
            </package>
            <theme>
                <default>fouron</default>
            </theme>
        </design>
    </admin>
</stores>

Then copy

app/design/adminhtml/default/default/sales/order/view/info.phtml

to (and then make all your changes to this file)

app/design/adminhtml/default/fouron/sales/order/view/info.phtml

1

The <default> node is used for calls from getStoreConfig, not for setting rewrites:

wrong:

<default>
    <blocks>
        <adminhtml>
            <rewrite>
                <sales_order_view_info>Mage_Fouron_Sales_Block_Sales_Order_View_Info</sales_order_view_info>
            </rewrite>
        </adminhtml>
    </blocks>
</default>

correct:

<global>
    <blocks>
        <adminhtml>
            <rewrite>
                <sales_order_view_info>Mage_Fouron_Sales_Block_Sales_Order_View_Info</sales_order_view_info>
            </rewrite>
        </adminhtml>
    </blocks>
</global>

Edit:

Additionally, you should create your own namespace, e.g. Fouron_MyModule instead of Mage_Fouron so as to avoid confusion. Mage should be reserved for core modules only.

Even if you don't, however, your rewrite block is not located properly:

Wrong:

app/code/local/Fouron/Sales/Block/Sales/Order/View/Info.php

Correct:

app/code/local/Mage/Fouron/Sales/Block/Sales/Order/View/Info.php
6
  • Thanks for your reply philwinkle, but still not work: i.stack.imgur.com/ikgy2.jpg
    – Eduardo
    Feb 26, 2014 at 20:20
  • See my edit above.
    – philwinkle
    Feb 26, 2014 at 20:27
  • I changed the folder and remove the Mage_ from Info.php and Fouron_Sales.xml... But now I am getting blank page... Maybe the setTemplate isn't finding info.phtml?
    – Eduardo
    Feb 26, 2014 at 20:40
  • philwinkle the folder below is right, I only remove Mage_ from my files... app/code/local/Fouron/Sales/Block/Sales/Order/View/Info.php But now is not picking up the correct file, but this appeared right block ... I'm confused, please see the image below: s16.postimg.org/3q7n2iq4l/erro.jpg
    – Eduardo
    Feb 26, 2014 at 21:03
  • Is there a warning in magento system.log for a missing template file?
    – philwinkle
    Feb 26, 2014 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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