Magento 1.7.2 - Add custom field at Admin, Sales, Order

Magento 1.7.2 - Add custom field at Admin, Sales, Order

September 25, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento 1.7.2 - Add custom field at Admin, Sales, Order

Solving Field Visibility Issues in Magento Admin Sales Orders

If you’re following the excellent tutorial from Excellent Ecommerce to create a custom payment method, but finding that your new field isn’t appearing in the Admin panel under Sales > Order, you’ve come to the right place.

Understanding Magento’s Data Flow

Before we dive into the solution, let’s quickly recap how data flows through Magento:

  1. Quote Payment: When a customer places an order, Magento first saves the payment information temporarily in the sales_flat_quote_payment table.
  2. Order Payment: Once the order is placed successfully, Magento moves this data to the sales_flat_order_payment table.

Verifying Your Database Setup

You’ve done great work so far by adding the telefono_no field to both tables using your mysql4-install-0.1.0.php script:

$install->run("
    ALTER TABLE `".$install->getTable('sales/quote_payment')."` ADD `telefono_no` VARCHAR(7) NOT NULL DEFAULT '0000000';
    ALTER TABLE `".$install->getTable('sales/order_payment')."` ADD `telefono_no` VARCHAR(7) NOT NULL DEFAULT '0000000';
");

And you’ve configured the field to be converted between quote and order payments in your config.xml:

<fieldsets>
    <sales_convert_quote_payment>
        <telefono_no>
            <to_order_payment>*</to_order_payment>
        </telefono_no>
    </sales_convert_quote_payment>
</fieldsets>

The Missing Piece: Admin Grid Configuration

The issue lies in the admin grid configuration for orders. Magento needs to know which columns should be displayed and how they should be rendered.

You’ll need to create a new XML file under app/code/local/Xs/Pago/etc/adminhtml.xml with the following content:

<config>
    <menu>
        <sales>
            <children>
                <orders translate="title" module="adminhtml">
                    <children>
                        <xs_pago extend="order_index">
                            <title>Pago Orders</title>
                            <action>adminhtml/xs_pago_order</action>
                        </xs_pago>
                    </children>
                </orders>
            </children>
        </sales>
    </menu>

    <acl>
        <resources>
            <all translate="title" module="admin">
                <children>
                    <sales>
                        <children>
                            <order>
                                <children>
                                    <xs_pago translate="title">
                                        <title>Pago Orders</title>
                                        <sort_order>100</sort_order>
                                    </xs_pago>
                                </children>
                            </order>
                        </children>
                    </sales>
                </children>
            </all>
        </resources>
    </acl>

    <adminhtml>
        <layout>
            <updates>
                <xs_pago>
                    <file>xs_pago.xml</file>
                </xs_pago>
            </updates>
        </layout>
    </adminhtml>
</config>

This file extends the existing orders functionality to include your custom module. It also includes the necessary permissions and layout updates.

The Layout File

Create a new XML file under app/code/local/Xs/Pago/view/adminhtml/layout named xs_pago.xml:

<layout version="1.0">
    <adminhtml_sales_order_index>
        <reference name="sales_order_grid">
            <action method="addColumnAfter" ifconfig="xs_pago/active/telefono_no">
                <column id="telefono_no">
                    <header translate="label">Payment Telephone</header>
                    <type>text</type>
                    <index>telefono_no</index>
                </column>
            </action>
        </reference>
    </adminhtml_sales_order_index>
</layout>

This file adds a new column to the admin order grid for your telephone number field. The ifconfig condition ensures that the column is only added if the module’s ‘active’ configuration is set to true and the telephone number field is configured.

Enabling Your Field in Configuration

To complete the setup, you need to enable your custom payment method under System > Configuration > Sales > Payment Methods.

Once enabled, refresh your admin panel, and navigate to Sales > Orders. You should now see a new column for “Payment Telephone” with your customer’s telephone number from their order.

Conclusion

Adding custom fields to the Magento admin interface requires careful configuration of both database tables and admin grid layouts. By following this guide and understanding how data flows through Magento, you can successfully add any additional information you need about your customers’ orders.

Remember to test thoroughly before deploying these changes to a live environment. If you’re looking for more advanced customizations or need expert support with your Magento development, don’t hesitate to reach out to Laravel Company.

Happy coding!

Magento 1 Database Admin Configuration

Our network