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?

closed as too broad by Keyul Shah, Keyur Shah, liyakat, Marius Apr 6 '15 at 12:53

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

6

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()
));
  • Hi, @zhartaunik I need the same for Magento 2 Is that possible ? – Ask Bytes May 5 at 9:49

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