We have a table with delivery dates and i want to add it to the adminhtml in sales/order/grid. The problem that i have is that the left join examples dont work for me and im out of options.
Mage/Adminhtml/Block/Sales/Order/Grid.php
The method im trying now is to create a custom query in _prepareCollection()
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$query = 'SELECT * FROM mage_sales_flat_order_grid
left join mage_aw_deliverydate_delivery
on mage_sales_flat_order_grid.entity_id =
mage_aw_deliverydate_delivery.order_id';
$collection = $readConnection->fetchAll($query);
//$collection = Mage::getResourceModel($this->_getCollectionClass());
//$this->setCollection($collection);
return parent::_prepareCollection();
Then i add this column code in _prepareColumns()
$this->addColumn('delivery_date', array(
'header' => 'delivery_date',
'index' => 'delivery_date',
'type' => 'datetime',
'width' => '100px',
));
I dont even see the new column when i look at the orders grid in the backoffice.
Any help is appreciated!