Magento SOAP V2 API -附加属性设置为空

本文关键字:属性 设置 SOAP V2 API Magento | 更新日期: 2023-09-27 18:03:50

几个小时以来,我一直在尝试通过带有附加属性的SOAP V2 API创建一个产品。每当我调用catalogProductCreate时,都会添加产品,但是我随请求发送的附加属性被设置为空。每当我不添加附加属性时,两个属性都设置为默认值,所以我认为属性正在发送和接收,但没有正确处理?我什么都试过了,我在谷歌上搜索过,但一无所获。

这是我的代码:(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;

谢谢你的帮助

Magento SOAP V2 API -附加属性设置为空

修复了它,我认为我必须在associativeEntity的值中设置预定义属性的明文/ID(0,1,2,3)。虽然,我发现catalogProductAttributeOptions将告诉您值的ID。因此,你必须调用这个方法来找出你应该使用的ID。