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.

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

2 Answers 2

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.

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

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 and acknowledge you have read our privacy policy.

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