Is there a way to tell if an order was placed through the frontend of the web site or entered through the administrative panel?
Asked
Active
Viewed 6,152 times
3 Answers
12
By default, Magento only stores the remote_ip
in table sales_flat_order
for an order that is place by customer (while admin order is set to null).
So try this:
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
-
Thanks for nice hook +1 from me @R.S – Keyur Shah Sep 25 '15 at 08:57
-
I am trying to imagine that if magento was installed on a cloud host, the order either placed by customer or admin will have a remote IP Address. I stand corrected – burntblark Oct 19 '15 at 12:08
8
Every order has a store_id
, when entered through administraction it will either be 0 (for 'admin' store) or null.
if ($order->getStoreId()) {
// was placed via frontend
}
Don't use getStore()
as that won't always return the admin store object reliably.
Does not work with latest versions of Magento. (see comment)

Alex
- 32,506
- 16
- 106
- 171

clockworkgeek
- 37,650
- 9
- 89
- 127
-
2clockworkgeek's answer is correct. I'll add one other way, that is mostly helpful to administrative users that aren't programmers. If you are looking at the order in the administration screen (Admin -> sales -> Orders) it will have a "Placed from IP" field if the order was created from the frontend, but if it was done through the admin backend screens it will not be there. – shaune Jan 05 '11 at 00:42
-
-
10Does not work with latest versions of Magento. You have to choose store id before create order within admin backend. So store_id will always have a value different from 0. – Yaroslav Rogoza Aug 08 '13 at 09:14
-
Yaroslav Rogoza is right! It will return the store id for which the order is placed, even from admin panel – Shathish Dec 24 '13 at 08:37
-
0
You can check the is_super_mode
value (I have only check on the quote : $quote->getIsSuperMode()
)

Wesley Bland
- 8,816
- 3
- 44
- 59