There are many tutorials and suggestions including installing a custom extensions etc.
I\'ve added the shipping_description fine based on various tips and tricks by modi
The following worked in my case. Sorting now works from every single field. No core files overridden.
Step by step for someone who is in the same boat. Tested in 1.8.1
Copy your Grid.php from
/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php to /app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php
if the path doesn't exist create it.
Open your new Grid.php and add the following code into _prepareCollection()
after getResourceModel
line:
$collection->getSelect()->join(array('mt'=>'sales_flat_order'),
'mt.entity_id = main_table.entity_id',
array('mt.increment_id','mt.store_id','mt.created_at','mt.shipping_description','mt.status','mt.base_grand_total','mt.grand_total'));
$collection->getSelect()->group('main_table.entity_id');
Add the following code into _prepareColumns()
function (in between your desired addColumn()
calls)
$this->addColumn('shipping_description', array(
'header' => Mage::helper('sales')->__('Delivery'),
'type' => 'text',
'index' => 'shipping_description',
'filter_index' => 'mt.shipping_description',
));
Find addColumns()
functions for increment_id, store_id, created_at, base_grand_total, grand_total, status
and add the following argument in each:
'filter_index' => 'mt.___your_column_name____',
Any suggestion on how to optimise above code are welcome.