在后端管理面板订单中获取客户详细信息 [英] Get customer details in backend admin panel order
问题描述
我做了什么:
在magento管理面板中为客户下订单后,我需要执行的自定义计算很少.我已经迷上了模块config.xml中选项卡内的sales_order_save_after事件.
I have few custom calculations to be done after placing an order for the customer in magento admin panel. I have hooked on to sales_order_save_after event inside tab inside my module's config.xml .
问题:
我需要获取在后台下订单的实际客户的customer_id.该怎么办?
I need to get the customer_id of the actual customer for whom the order is been placed on the backend. How can this be done?
$_customer = Mage::getSingleton('customer/session')->getCustomer();
$customer_id=$_customer->getId();
上面提供的是前端的customer_id,从后端订购时,我需要一种获取客户ID的方法.
The above will give me the customer_id in case of front end, I need a way to get the customer's id when ordering from backend.
以防万一,事件"adminhtml_sales_order_create_process_data"是我需要了解的,请告诉我.因为我也对要挂接的事件感到困惑.
In case, the event "adminhtml_sales_order_create_process_data", is what I need to hook on, do let me know. because I am also kind of confused about which event to hook on.
帮帮我.
推荐答案
下面的代码对我有用(感谢 Makwana Ketan 共享了此代码)
This code below works for me (Thanks to Makwana Ketan shared this code)
$sessionquoteId = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getId();
$sessionCustomerId = Mage::getModel('sales/quote')->loadByIdWithoutStore($sessionquoteId)->getCustomerId();
这篇关于在后端管理面板订单中获取客户详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!