Magento 1 – How to Add Order Comments in PDF Invoice

magento-1orderspdf

I have created an extension to modify invoice PDF, in that want to add order comments. I am extending
Mage/Sales/Model/Order/Pdf/Invoice.php and Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php files.
What is the method to fetch order comments. I have tried the following method

 $commentHistory =  $order->getStatusHistoryCollection(true);

Please help.

Best Answer

You can get all order comments from calling ->getAllStatusHistory() - as long as you have an ordr object, try calling:

$commentHistory = $order->getAllStatusHistory(true);

Then loop through the array you get back.