Magento:getSingleton('customer / session')在通过SOAP调用时不返回信息

时间:2014-07-26 22:50:17

标签: magento session soap singleton

我目前正在尝试在提交订单并使用Observer捕获checkout_submit_all_after事件后获取客户数据。如果我通过前端发出订单,Mage::getSingleton('customer/session')Mage::getSingleton('checkout/session') 在观察者内部运行给我提供了大量信息,但是当我通过SOAP下订单时,这些方法会返回没有。我也试过了Mage::helper('customer')->getCustomer()但它也没有返回任何东西。

我可以通过其他方式获取上次提交订单的数据吗?具体来说,我需要会话中的客户和最后一个订单ID ala Mage::getSingleton('checkout/session')->getLastRealOrderId()

1 个答案:

答案 0 :(得分:0)

看看这个废话:quote-> customer_email字段最初是用电子邮件填充的,然后用SOAP方法设置地址' shoppingCartCustomerAddresses',来自Checkout / Model / Api / Resource /的_prepareGuestQuote Customer.php使用" $ quote-> getBillingAddress() - > getEmail())覆盖它。哪个必须是空白的!为什么?那么请查看地址对象的wsdl定义:

         <complexType name="shoppingCartCustomerAddressEntity">
            <all>
                <element name="mode" type="xsd:string" minOccurs="0"/>
                <element name="address_id" type="xsd:string" minOccurs="0"/>
                <element name="firstname" type="xsd:string" minOccurs="0"/>
                <element name="lastname" type="xsd:string" minOccurs="0"/>
                <element name="company" type="xsd:string" minOccurs="0"/>
                <element name="street" type="xsd:string" minOccurs="0"/>
                <element name="city" type="xsd:string" minOccurs="0"/>
                <element name="region" type="xsd:string" minOccurs="0"/>
                <element name="region_id" type="xsd:string" minOccurs="0"/>
                <element name="postcode" type="xsd:string" minOccurs="0"/>
                <element name="country_id" type="xsd:string" minOccurs="0"/>
                <element name="telephone" type="xsd:string" minOccurs="0"/>
                <element name="fax" type="xsd:string" minOccurs="0"/>
                <element name="is_default_billing" type="xsd:int" minOccurs="0"/>
                <element name="is_default_shipping" type="xsd:int" minOccurs="0"/>
            </all>
        </complexType>

你看到了一封电子邮件&#39;在那里?我肯定不会! 所以现在我必须覆盖这个东西只是为了使它成为FUNCTIONAL。严重Magento,wtf?