0

When I review the Sales order it show specific steps in the processing of the order. There are specific comments about the transactions that occurred during the processing of the order. I like to be able to use them to display the transaction information on the customer Invoice or Sales Order confirmation.

I just not sure where this data is stored and how to retrieve it so it sill show on the Sales Order Invoice Confirmation?

Mar 28, 2017 2:25:46 PM|Processing Customer Notification Not Applicable
Captured amount of $15.49 online. Transaction ID: "40038692970-capture". .

Mar 28, 2017 2:25:46 PM|Processing Customer Not Notified
Amount of $15.49 approved by payment gateway. Transaction ID: "40038692970". .

Mar 28, 2017 2:25:46 PM|Processing Customer Not Notified
This transaction has been approved. .


I have example above.

1
  • Hmmm, really surprised I have not any comments?
    – SKCBD5
    Commented Mar 30, 2017 at 23:59

1 Answer 1

1

Actually didn't understand your answer, this Answer applies only if you want to display Order comment to sales_order grid, this will show last comment to sales_order grid

As editing core files is not a good idea, You Have to copy files of app\code\code\Mage\Adminhtml\Block\Sales\Order\grid.php to app\code\local\Mage\Adminhtml\Block\Sales\Order\grid.php (Create the path if not exist)

After copying file to local look for _prepareColumns() function and add

    $this->addColumn('history', array(
        'header' => Mage::helper('sales')->__('Order Comment'),
        'type'  => 'text',
        'renderer' => new Mage_Adminhtml_Block_Sales_Order_Renderer_History()
    ));

After adding this code to grid.php Create a custom render( create path app\code\local\Mage\Adminhtml\Block\Sales\Order\Renderer\History.php)

inside History.php put this code

<?php class Mage_Adminhtml_Block_Sales_Order_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();
    }
}

Your order comment should be on Sales_order grid now.

I hope this will be helpful.

2
  • If this Answers helps you please Accept this as an answer, So this Answer will help upcoming viewers.
    – Lalit838
    Commented May 3, 2017 at 12:46
  • Hi, how to filter these results in the grid? Commented Oct 8, 2020 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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