Magento: Add Column at Sales Orders Grid

Order Mode
Magento Order Grid

Magento admin orders custom field. For example, add custom field into grid as Order Type (Virtual Order Or Shipping Order).

File Path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php

protected function _prepareCollection(){

   $collection = Mage::getResourceModel($this->_getCollectionClass());

   //New Lines
   $resource = Mage::getSingleton('core/resource');
   $orderReference = $resource->getTableName('sales/order');
   $collection->getSelect()->join(array('so' => $orderReference),'main_table.entity_id = so.entity_id',array(''))
->columns('(CASE WHEN so.is_virtual = 1 THEN "Virtual Order" ELSE "Shipping Order" END) AS order_mode'); //END

   $this->setCollection($collection);
   return parent::_prepareCollection();
}
protected function _prepareColumns() {
   //Place code where you need to show field
   $this->addColumn('status_type', array(
     'header' => Mage::helper('sales')->__('Order Mode'),
     'index' => 'order_mode',
     'type' => 'text',
     'width' => '70px',
     'filter' => false,
     'sortable' => false,
   ));
}

While searching sales orders list, you are getting error as “Integrity constraint violation: 1052 Column ‘increment_id’ in where clause is ambiguous”. To resolve those errors add “filter_index” at required add column function. Use below code for increment id error, do same for “created_at”,”grand_total”,..

$this->addColumn('real_order_id', array(
    'header'=> Mage::helper('sales')->__('Order #'),
    'width' => '80px',
    'type'  => 'text',
    'index' => 'increment_id',
    'filter_index'=>'main_table.increment_id',
));