Sales Order Grid Customization

In this blog, we will see how to add columns to magento admin sales order grid.

In this blog i will basically share with you code snippet to add different columns to the admin sales order grid.
In this module i have added the column name

  • Product Count
  • Product Purchased
  • Shipping Method
  • Payment Method
  • Shipping Address, Postcode, Telephone, Region

Using this module source code you can easliy add other fields to the order grid as well.
The module is tested in magento 1.6 but should work on magento 1.5+


In this module i have overridden two magento core files
1. Mage_Adminhtml_Block_Sales_Order_Grid
2. Mage_Sales_Model_Mysql4_Order_Grid_Collection

the code to override these two files is written in config.xml file


Next two add columns to the grid we need to
1. First add the column values in the grid collection. This is done in the _beforeLoad() function of the sales_grid collection. In the module source code you can see that i have added joins with many tables to the collection. If you require to add other columns to the grid you need to add similar joins.
2. Second in the grid file we need to add column to grid in the _prepareColumns() function and add code so the searching can take place properly in the _addColumnFilterToCollection() function.

You can download the code snippet to see the changes in code. I have given above a brief explanation of the same, rest you need to understand the code.