1

In magento 1.9 how we can get comment column in sale -> orders with the latest comment e.g Customer is redirected to Paypal Any idea what will be the query for this?

7

Create your custom renderer, extended from renderer abstract:

class Vendor_Module_Block_Adminhtml_Widget_Grid_Column_Renderer_History extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
    public function render(Varien_Object $row)
    {
        $orderId = $row->getId();
        $order = Mage::getModel('sales/order')->load($orderId);
        $history = $order->getStatusHistoryCollection()->getFirstItem();
        return $history->getComment();
    }
}

Then add new column to order grid, with this renderer:

$this->addColumn('history', array(
    'header' => Mage::helper('sales')->__('History status'),
    'type'  => 'text',
    'renderer' => new Vendor_Module_Block_Adminhtml_Widget_Grid_Column_Renderer_History()
));
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.