【问题标题】:Magento SOAP V2 API - Additional attributes sets emptyMagento SOAP V2 API - 附加属性设置为空
【发布时间】:2014-05-18 18:40:40
【问题描述】:

几个小时以来,我一直在尝试通过带有附加属性的 SOAP V2 API 创建产品。每当我调用 catalogProductCreate 时都会添加产品,但我随请求发送的附加属性设置为空。每当我不添加其他属性时,这两个属性都设置为默认值,所以我认为这些属性正在发送和接收但未正确处理?我已经尝试了所有方法,我在 Google 上搜索过,但都是空的。

这是我的代码:(C#)

  catalogProductCreateEntity cpce = new catalogProductCreateEntity();
  associativeEntity[] attributes = new associativeEntity[2];
  attributes[0] = new associativeEntity();
  attributes[0].key = "product_state1";
  attributes[0].value = _stateofbox;

  attributes[1] = new associativeEntity();
  attributes[1].key = "product_state2";
  attributes[1].value = _stateofproduct;

  catalogProductAdditionalAttributesEntity additionalAttributes = new catalogProductAdditionalAttributesEntity();
  additionalAttributes.single_data = attributes;
  cpce.additional_attributes = additionalAttributes;

感谢您的帮助。

【问题讨论】:

    标签: c# api magento attributes


    【解决方案1】:

    修复它,我认为我必须在 associativeEntity 的值内设置预定义属性的明文/ID (0,1,2,3)。虽然,我发现 catalogProductAttributeOptions 会告诉你你的值有什么 ID。因此,您必须调用该方法才能找出您应该使用的 ID。

    【讨论】:

    • 我也遇到了同样的问题,能否详细说明一下?
    • 您需要调用catalogProductAttributeOptions 来检索 Magento 用来识别您的对象的 ID,而不是使用对象具有的索引,因为您的系统已经分配了它们。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 2011-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多