Magento - 确定订单是否通过管理员下达

时间:2011-01-27 14:22:15

标签: magento location

我想知道是否无论如何确定订单是通过网站还是通过管理员后端(由管理员用户)发出的?

还有(可选)登记管理员用户名下订单?

类似的东西:

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

我在订单$对象上做了一个get_class_methods()调用,但没有任何东西跳出来。

谢谢!

2 个答案:

答案 0 :(得分:2)

默认情况下,magenta仅将remote_ip存储在表sales_flat_order中,以供客户下订单(且管理订单为空)。

所以试试

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

请参阅Programmatically differentiate between admin & customer-placed orders

答案 1 :(得分:0)

我回答了这个问题..这是我得到的答案:Differentiating Backend vs. Frontend Purchases in Magento