Differentiate Backend Virtualization in Magento Purchases

Is there a way to find out if an order was placed via the website interface or entered through the admin panel?

+7
source share
3 answers

By default, Magento only saves the remote_ip in the sales_flat_order table for an order that is placed by the customer (while the administrator order is set to null).

So try the following:

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

See Programmatically Distinguish Administrative and Client Orders

+10
source

Each order has store_id , when it is entered through the administrator, it will be either 0 (for admin storage) or null.

 if ($order->getStoreId()) { // was placed via frontend } 

Do not use getStore() , as this will not always reliably return an admin storage object.

It does not work with the latest versions of Magento. (see comment)

+8
source

You can check the value of is_super_mode (I only check the quote: $quote->getIsSuperMode() )

0
source

All Articles