Sometimes the grid table in the background we want to see what shipping method is selected for the current order.
For example: Before the door to add the way, then when there are many orders need to filter out the door from the orders, first deal with those who need to send courier.
Workaround:
(It's a good idea to rewrite the module without modifying the core file.) This is no longer a reminder. )
1. Modify the _getcollectionclass function in the grid.php to
Return ' sales/order_grid_collection ';
Revision changed to
Return ' sales/order_collection ';
But it is obviously unreasonable to do so, because you will find that shipping name is empty.
Of course you can modify the $collection join Sales_flat_order_grid (I haven't tested it).
2. Most of the information found online is
Add a join for $collection for example:
protected function _preparecollection () {$collection = Mage::getresourcemodel ($this->_getcollectionclass ()); $ Collection->getselect ()->join (' Sales_flat_order ', ' main_table.entity_id = sales_flat_order.entity_id ', array (' shipping_description ')); $this->setcollection ($collection); return parent::_preparecollection ();}
Then AddColumn () in the _preparecolumns () function of grid.php
$this->addcolumnafter (' shipping_description ', Array ( ' header ' = ' mage::helper (' Sales ')->__ (' Shipping Method '), ' index ' = ' shipping_description ', ' width ' = ' 100px ', ' filter_index ' = ' sales_flat_ ' Order.shipping_description ', ), ' method ');
But in doing so you will find that many filtering (search) functions are not good enough, such as searching for an order number.
In fact, the solution is simply to rewrite all the values in the grid.php you have rewritten and take the parameters Filter_index
Example: increment_id
$this->addcolumn (' real_order_id ', Array ( ' header ' = + mage::helper (' Sales ')->__ (' Order # '), ' Width ' + ' 80px ', ' type ' = ' text ', ' index ' = ' increment_id ', ' filter_index ' = ' main_ ' table.increment_id ', ));
Magento Background Order Grid table get Shipping_description