Magento Order Comments -
and have form in url link checkout/cart, , in page have forms has following textbox of name email telephone number comments company , deadline project. in form works , data send email. want comments data send admin panel in sales/orders. on path app/design/adminhtml/default/default/template/sales/order/view
info.phtml file. have found sample code , im using it. , ive found out sample code im looking doesnt work out. reference link im using http://www.magecorner.com/magento-order-comments/
can me figured thing out? ive been stuck in here since last week muchly appreciated
you can try using events. add below code config.xml. hope have idea of dealing observer , events.
<events> <sales_order_place_after> <!-- identifier of event want catch --> <observers> <sales_order_place_after_handler> <!-- identifier of event handler --> <type>model</type> <!-- class method call type; valid model, object , singleton --> <class>orderaudit/observer</class> <!-- observers class alias --> <method>orderplaced</method> <!-- observer's method called --> <args></args> <!-- additional arguments passed observer --> </sales_order_place_after_handler> </observers> </sales_order_place_after> <sales_order_payment_capture> <!-- identifier of event want catch --> <observers> <sales_order_payment_capture_handler> <!-- identifier of event handler --> <type>model</type> <!-- class method call type; valid model, object , singleton --> <class>orderaudit/observer</class> <!-- observers class alias --> <method>paymentcapture</method> <!-- observer's method called --> <args></args> <!-- additional arguments passed observer --> </sales_order_payment_capture_handler> </observers> </sales_order_payment_capture> <sales_order_creditmemo_refund> <!-- identifier of event want catch --> <observers> <sales_order_creditmemo_refund_handler> <!-- identifier of event handler --> <type>model</type> <!-- class method call type; valid model, object , singleton --> <class>orderaudit/observer</class> <!-- observers class alias --> <method>creditmemorefund</method> <!-- observer's method called --> <args></args> <!-- additional arguments passed observer --> </sales_order_creditmemo_refund_handler> </observers> </sales_order_creditmemo_refund> </events>
step 2: add following observer.php
public function orderplaced(varien_event_observer $observer) { if (mage::getsingleton('admin/session')->isloggedin()) { //if admin $order = $observer->getevent()->getorder(); $user = mage::getsingleton('admin/session'); $username = $user->getuser()->getusername(); $comment = "order placed <strong>".$username."</strong>"; $order->addstatushistorycomment($comment) ->setisvisibleonfront(false) ->setiscustomernotified(false); $order->save(); } else { //placed customer online $order = $observer->getevent()->getorder(); $order->addstatushistorycomment('order placed online customer') ->setisvisibleonfront(false) ->setiscustomernotified(false); $order->save(); } } public function paymentcapture(varien_event_observer $observer) { $invoice = $observer->getevent()->getinvoice(); $order = $invoice->getorder(); $user = mage::getsingleton('admin/session'); $username = $user->getuser()->getusername(); $comment = "payment captured <strong>".$username."</strong>"; $order->addstatushistorycomment($comment) ->setisvisibleonfront(false) ->setiscustomernotified(false); $order->save(); } public function creditmemorefund(varien_event_observer $observer) { $creditmemo = $observer->getevent()->getcreditmemo(); $order = $creditmemo->getorder(); $user = mage::getsingleton('admin/session'); $username = $user->getuser()->getusername(); $comment = "refund <strong>".$username."</strong>"; $order->addstatushistorycomment($comment) ->setisvisibleonfront(false) ->setiscustomernotified(false); $order->save(); }
}
Comments
Post a Comment