0

I was wondering if there was anyway of determining whether an order was placed via the website or through the admin backend (by an admin user)?

And also (optionally) the logged in admin users name that placed the order?

Something like:

$orderId = 100000010;
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
$location = $order->getWhereTheOrderWasPlaced();
$userThatDidTheOrder = $order->getUserThatDidTheOrder();

I've done a get_class_methods() call on the order $object but nothing jumps out at me.

Thanks!

sulman
  • 2,431
  • 7
  • 40
  • 62
  • I've had a look, but I can't find anything either. Could the IP address of the order be used maybe? It might not be set when an admin placed an order. – Nick Jan 27 '11 at 15:09
  • possible duplicate of [Differentiating Backend vs. Frontend Purchases in Magento](http://stackoverflow.com/questions/4570909/differentiating-backend-vs-frontend-purchases-in-magento). (Nick is right to suspect the IP address) – clockworkgeek Jan 27 '11 at 15:24

2 Answers2

2

By default magenta only store the remote_ip in table sales_flat_order for order that is place by customer (and admin order is null).

So try

if(!empty($order->getRemoteIp()){
  //place online
}
else{
  // place by admin 
}

See Programmatically differentiate between admin & customer-placed orders

Community
  • 1
  • 1
MagePal Extensions
  • 17,646
  • 2
  • 47
  • 62
0

I asked this question a while back.. here's the answer I got: Differentiating Backend vs. Frontend Purchases in Magento

Community
  • 1
  • 1
Chris
  • 1,731
  • 3
  • 24
  • 38