Differentiating Backend vs. Frontend Purchases in Magento

拜拜、爱过 提交于 2019-11-30 04:35:29

问题


Is there a way to tell if an order was placed through the frontend of the web site or entered through the administrative panel?


回答1:


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




回答2:


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)




回答3:


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



来源:https://stackoverflow.com/questions/4570909/differentiating-backend-vs-frontend-purchases-in-magento

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!