php - How to include username of the invoiced/shipped user in order comment history? -
i'm using magento ce 1.7
. want show order invoiced or shipped person's username appear comment history. override mage_sales_ordercontroller
append username in addcommentaction(){..}
. works when user adds comments not when create / invoice order. please suggestions?
fixed it. here's solution. have overridden mage_sales_model_order
class add_ordercomment_model_order extends mage_sales_model_order { public function addstatushistorycomment($comment, $status = false) { if(mage::getsingleton('admin/session')->isloggedin()) { // getting admin username. $user = mage::getsingleton('admin/session'); $username = $user->getuser()->getusername(); $append = " <strong>(updated : ".$username.")</strong>"; } else { $append = ""; } if (false === $status) { $status = $this->getstatus(); } elseif (true === $status) { $status = $this->getconfig()->getstatedefaultstatus($this->getstate()); } else { $this->setstatus($status); } $history = mage::getmodel('sales/order_status_history') ->setstatus($status) ->setcomment($comment.$append) ->setentityname($this->_historyentityname); $this->addstatushistory($history); return $history; } }
Comments
Post a Comment