cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9 - How to get Order Comments History?

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Magento 1.9 - How to get Order Comments History?

My code :

 

<?php 

require_once('app/Mage.php');
umask(0);
Mage::app();


// try{

$orders = Mage::getModel('sales/order')->load('10');
foreach ($orders as $order) {
    $orderComments = $order->getAllStatusHistory();
    print_r($orderComments);

    }

// }catch(Exception $e){
//  echo $e->getMessage();
// }

How to get Comments History of the order Pending->Processing->Awaiting Shipment->Shipped->Complete

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Magento 1.9 - How to get Order Comments History?

@Aveeva 

The screenshot is not accessible.

 

You may get order details in the sales\order\info.phtml file by using following code.

<?php  $_order = $this->getOrder() ?>

 After getting $_order you can the order increment id or real order id.

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

View solution in original post

3 REPLIES 3

Re: Magento 1.9 - How to get Order Comments History?

Hi @Aveeva 


You may try following code

<?php
require_once('app/Mage.php');
umask(0);
Mage::app();
$orders = Mage::getModel('sales/order')->load('10');
$statusHistory = $order->getStatusHistoryCollection()->getData();
$details = array();
foreach($statusHistory as $status)
{
    $details [] = $status['entity_name'].','.$status['status'].','.$status['comment'];
}
echo "<pre>";
print_r($details);

 

 

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

Re: Magento 1.9 - How to get Order Comments History?

@Mukesh Tiwari  If i use this script to my customer order account, how to load current order id,

screenshot : https://snipboard.io/EAGve0.jpg

Re: Magento 1.9 - How to get Order Comments History?

@Aveeva 

The screenshot is not accessible.

 

You may get order details in the sales\order\info.phtml file by using following code.

<?php  $_order = $this->getOrder() ?>

 After getting $_order you can the order increment id or real order id.

---
Problem Solved Click Accept as Solution!:Magento Community India Forum