1

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.

  • You should be able to get comments from an order object by calling ->getAllStatusHistory() – Douglas Radburn Mar 16 '15 at 15:02
  • @DouglasRadburn why not adding it as an answer?? It is quite an answer :) – Jeroen Mar 18 '15 at 15:31
2

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.

  • It worked well. Thank you so much Douglas Radburn. – chinchu Mar 23 '15 at 5:24
1

You can get All the order comments using the following:

<?php

    foreach ($orderDetails->getAllStatusHistory() as $orderComment){

        echo $comment = $orderComment->getComment();

} ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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