What function is called to save new comments and update the order status, when viewing the order in the backend.

The addComment function in app/code/core/Mage/Sales/Model/Order/Api.php looks to be what I need but that's not the case. Altering this function is having no effect here.


Go to app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php

addCommentAction is responsible for save comment.

How to save?

Go to app/code/core/Mage/Sales/Model/Order.php, check following code block

 * Add a comment to order
 * Different or default status may be specified
 * @param string $comment
 * @param string $status
 * @return Mage_Sales_Model_Order_Status_History
public function addStatusHistoryComment($comment, $status = false)
    if (false === $status) {
        $status = $this->getStatus();
    } elseif (true === $status) {
        $status = $this->getConfig()->getStateDefaultStatus($this->getState());
    } else {
    $history = Mage::getModel('sales/order_status_history')
    return $history;
  • Thanks mate that's exactly what I need. If you're looking for a particular method, how do you go about finding it? If you don't mind me asking – iamlolz Mar 8 '17 at 9:17

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.