Question

I wanna show the username who commented on order history

my question is like below question

https://stackoverflow.com/questions/6219620/add-username-to-order-comment-history

but it is for Magento 1.4 and it doesn't work for me. magento version 1.9.3.7

Was it helpful?

Solution

You can create a module and override file ( app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php ):

There you will find function addCommentAction:

https://github.com/MrRio/magento/blob/master/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php#L191

and / change line of code from :

$order->addStatusToHistory($data['status'], $data['comment'], $notify);

To :

$current_Admin = Mage::getSingleton('admin/session')->getUser();
    if(isset($current_Admin)) {
        $commentwithUser = '[ BY: '.$current_Admin->getUsername().' ] - '.$data['comment'];
    }
$order->addStatusToHistory($data['status'], $commentwithUser, $notify);
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top