【问题标题】:Magento Enterprise 1.12 - Accessing customer custom attributes from the V2 APIMagento Enterprise 1.12 - 从 V2 API 访问客户自定义属性
【发布时间】:2012-07-04 06:22:09
【问题描述】:

我有一个客户想使用 Magento 的 Web 服务 API 来创建和更新客户。使用 API,我们可以使用 V1 或 V2 API 轻松操作系统定义的属性 - 名字、姓氏等。我们很高兴去那里。

这就是它变得棘手的地方 - 该站点使用 Magento Enterprise 1.12,我们添加了一些自定义客户属性,用于将 Magento 客户链接到外部系统上的 CRM 数据。使用 V1 API,我可以完全访问自定义属性。但是,V2 API 不会公开它们。由于调用者来自.NET,我相信他需要使用V2 API。

使用调试器跟踪代码,我看到 V2 代码获取所有属性数据,然后在生成 Web 服务响应时丢弃所有自定义数据。我尝试将属性添加到客户 (Mage/Customer/etc/) WSDL 和 WSI 文件中,但这并没有奏效。

谁能给我一个关于我应该做什么来公开客户属性的指针?

格雷格

【问题讨论】:

  • 深入挖掘,我现在看到添加 API V2 访问自定义属性所需要做的就是将附加字段添加到客户 wsdl.xml 和 wsi.xml 文件。新问题是我无法找出覆盖核心 wsdl 的正确方法。我尝试将修改后的副本放在 app/code/local/customer/etc/wsdl.xml 中,但更改似乎不会覆盖 app/code/core/customer/etc/wsdl.xml 中的 wsdl。有什么想法吗?我担心修改核心中的 wsdl,但在这种情况下我可能不得不这样做。

标签: api magento soap


【解决方案1】:

这是我用来将 customer_number 添加到 API 的 wsdl.xml 文件的示例。

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
    <types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
          <complexType name="customerCustomerEntity">
             <all>
               <element name="customer_number" type="xsd:string" minOccurs="0" />
             </all>
          </complexType>
       </schema>
    </types>
</definitions>          

【讨论】:

    【解决方案2】:
    1. 创建一个新模块
    2. Your_Module/etc/wsdl.xmlwsi.xml 中,在与Mage_Customer wsdl.xmlwsi.xml 相同的节点中添加新属性
    3. Magento 将所有 wsdl.xmlwsi.xml 文件合并在一起

    【讨论】:

      猜你喜欢
      • 2023-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多