In magento CE 1.7.0.2
Add new column to sales order grid which have a most recent order comment.
Following code used to add column
protected function _prepareColumns()
{
parent::_prepareColumns();
// Add order comment to grid
$this->addColumn('ordercomment', array(
'header' => Mage::helper('ordercomment')->__('Order Comment'),
'index' => 'ordercomment',
'filter_index' => 'ordercomment_table.comment',
));
// Fix integrity constraint violation in SELECT
foreach ($this->_ambiguousColumns as $index) {
if (isset($this->_columns[$index])) {
$this->_columns[$index]->setFilterIndex('main_table.' . $index);
}
}
return $this;
}
But comment shown in grid is first comment on order.
How most recent comment will show in this column?