The Order grid in Magento admin (its under Sales -> Orders) displays following columns by default:

Order #
Purchased On
Bill to Name
Ship to Name
Shipping Country
G.T. (Base)
G.T. (Purchased)
Status
Action

Do you want to add a custom attribute / column to the Orders grid in Magento admin OR for that matter remove a column that you don’t need? Here is how you can do it:

  1. Create a copy of core Magento Grid.php to local directory – copy /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php to /app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php.

  2. Let’s assume that we need to add a ‘Shipping Country’ column. Search for _prepareCollection() function and add this line:

    $collection->getSelect()->join(`sales_flat_order_address`, 'main_table.entity_id = sales_flat_order_address.parent_id AND sales_flat_order_address.address_type = "shipping"',array('country_id'));

    just before

    return parent::_prepareCollection();

    Then the function should look like this:

    protected function _prepareCollection()
    {
    $collection = Mage::getResourceModel($this->_getCollectionClass());
    $collection->getSelect()->join(`sales_flat_order_address`, 'main_table.entity_id = sales_flat_order_address.parent_id AND sales_flat_order_address.address_type = "shipping"',array('country_id'));
    $this->setCollection($collection);
    return parent::_prepareCollection();
    }

    In the above join select statement, we have basically joined the `sales_flat_order_address` database table which contains the Shipping Country field. Please note that the same database table also contains the Billing Country field so its important in this case to specify the ‘address_type’ either as “shipping” or as “billing” based on the Country field you want to display.

  3. Now to insert this column into the order grid, edit _prepareColumns() function. This function uses addColumn method to add different columns to the Order grid. So using the addColumn method, we can add our own shipping country column as well:

    $this->addColumn('country_id', array(
    'header' => Mage::helper('sales')->__('Shipping Country'),
    'index' => 'country_id',
    ));

Customize Magento Admin Orders Grid