How to add tracking number column to order grid?
I tried with this code but doesn't work
$this->addColumn('tracking', array(
'header' => Mage::helper('sales')->__('tracking'),
'index' => 'tracking',
'type' => 'number',
'width' => '70px',
'options' => Mage::getModel('sales/order_shipment')->getTrackingNumbers(),
));
Any ideas please..
Update:
By the way i edit on sales grid.php
to add this code
$collection->getSelect()
->from(
array(),
array(
'track_number' => new Zend_Db_Expr('(
SELECT GROUP_CONCAT(`t`.`track_number` SEPARATOR ",")
FROM `bg8_sales_flat_shipment_track` as `t`
WHERE `main_table`.`entity_id` = `t`.`order_id`
)'),
)
);
Its working fine but the filter not working i tried to add public & protected function and its freezing when i add value to search on it.
Best Answer
If you want to add tracking no at sales grid then you need to add
sales_flat_shipment_track
table withsales grid order collection table
.Order may have multiple tracking no. ,So you need to follow Atwix blog in order to implement your requirement.
add below to observer class
Just add the following code to our layout extendedgrid.xml:
Now.change
at helper class:
then at filtertrackingno