We are rewarding our admin users by how many orders the help customers with per day. So we would need to track which admins placed which orders, I think the easiest way would be to add admin userid into sales flat order table on magento.
Asked
Active
Viewed 1,929 times
1 Answers
1
You can do this by creating an Event-Observer type module on the sales_order_save_after event, just make sure you enclose it in the <adminhtml> node instead of <global>, otherwise customers placing orders on the front-end of your website could trigger the observer function.
In Observer.php you can relate the two by:
- Calling
$observer->getEvent()->getOrder()->getId();//this fetches theentity_idvalue from thesales_flat_ordertable - Relating it to
Mage::getSingleton('admin/session')->getUser()->getUserId();//this fetches theuser_idvalue from theadmin_usertable
Alternately, it does look like there is a module already available on MagentoConnect:
Administrator Who Placed The Order
It is a paid-for extension though, implementing the Event-Observer method seems simple enough.
Moose
- 610
- 1
- 14
- 28
-
+1 Created an observer and added: class PackageName_Module_Model_Observer { public function admin(Varien_Event_Observer $observer) { $admin = Mage::getSingleton('admin/session')->getUser()->getEmail(); $order = $observer->getEvent()->getOrder()->getIncrementId(); Mage::log('Order id = '.$order. ' - Admin is: '.$admin,null,'whichadmin.log'); } } – ItsJhonny Mar 01 '19 at 14:46