// get the last order $lastOrderId = $this->_getOnepage()->getCheckout()->getLastOrderId(); $order = Mage::getModel('sales/order')->load($lastOrderId);
// Add the comment and save the order (last parameter will determine if comment will be sent to customer) $order->addStatusHistoryComment('This comment is programatically added to last order in this Magento setup'); $order->save();