【问题标题】:How to add brand to existing eBay item?如何将品牌添加到现有的 eBay 商品?
【发布时间】:2016-04-15 12:05:19
【问题描述】:

在我的应用程序中,我想通过 C# 上的 API 将品牌和 MPN 添加到现有的 eBay 项目,因此,我运行代码:

        string eCommerceID = (dr["eCommerceID"] ?? "").ToString().Trim();
        string upc = (dr["UPC"] ?? "").ToString().Trim();
        string manufacturerName = (dr["ManufacturerName"] ?? "").ToString().Trim();
        string brandMPN = (dr["BrandMPN"] ?? "").ToString().Trim();

        ReviseItemRequestType reviseItemRequestType = new ReviseItemRequestType();
        reviseItemRequestType.Version = version;
        reviseItemRequestType.Item = new ItemType();
        reviseItemRequestType.Item.ItemID = eCommerceID;
        reviseItemRequestType.Item.ProductListingDetails = new ProductListingDetailsType();
        reviseItemRequestType.Item.ProductListingDetails.UPC = upc;

        reviseItemRequestType.Item.ProductListingDetails.BrandMPN = new BrandMPNType();
        reviseItemRequestType.Item.ProductListingDetails.BrandMPN.Brand = manufacturerName;
        reviseItemRequestType.Item.ProductListingDetails.BrandMPN.MPN = brandMPN;

        ReviseItemResponseType reviseItemResponseType = ebayService.ReviseItem(reviseItemRequestType);

但是当我执行这段代码时,eBay 会返回错误:

“商品特定品牌丢失。将品牌添加到此列表中,输入有效值,然后重试。”

我做错了什么?

感谢任何帮助。谢谢。

错误:

【问题讨论】:

    标签: c# asp.net ebay-api


    【解决方案1】:

    正如错误消息所说:

    商品特定品牌缺失

    请勿在您的请求中使用Item.ProductListingDetails.BrandMPN。相反,您需要创建两个 Item Specifics,分别称为 Band 和 MPN。

    <ItemSpecifics>
        <NameValueList>
            <Name>Brand</Name>
            <Value>[BRAND VALUE]</Value>
        </NameValueList>
        <NameValueList>
            <Name>MPN</Name>
           <Value>[MPN VALUE]</Value>
        </NameValueList>
    </ItemSpecifics>
    

    【讨论】:

      【解决方案2】:

      这里是C#解决方案的复制粘贴代码sn-p。

      ItemType itemType = new ItemType();   // = class eBay.Service.Core.Soap.ItemType
      Int32 condCodeAsInt = 1000; // upto you to derrive this from your use case.
      String myBrandValue = "Some BRAND";
      String myMpnValue = "some MPN"; 
      String myUpcValue = "Does not apply";
      

      ....

      //if condition is "New" or "New with Details" then we need to set extra REQUIRED fields
      
                  if (condCodeAsInt == 1000 || condCodeAsInt == 1500)
                  {
      
                      //if it is "new" then remove inputted desc text completely REQUIRED
                      if (condCodeAsInt == 1000)
                      {
                          itemType.ConditionDescription = "";
                      }
      
                      // set UPC value HERE, not in ItemSpecifics. 
                      ProductListingDetailsType pldt =  new ProductListingDetailsType();
                      pldt.UPC = myUpcValue;
      
                      itemType.ProductListingDetails = pldt;
      
                      //init Item specifics ( and set BRAND and MPN )
                      itemType.ItemSpecifics = new NameValueListTypeCollection();
      
                      //brand
                      NameValueListType nvBrand = new NameValueListType();
                      nvBrand.Name = "Brand";
                      StringCollection brandStringCol = new StringCollection();
                      brandStringCol.Add(myBrandValue);
                      nvBrand.Value = brandStringCol;
      
                      itemType.ItemSpecifics.Add(nvBrand);
      
                      //MPN
                      NameValueListType nvMpn = new NameValueListType();
                      nvMpn.Name = "MPN";
                      StringCollection mpnStringCol = new StringCollection();
                      mpnStringCol.Add(myMpnValue);
                      nvMpn.Value = mpnStringCol;
      
                      itemType.ItemSpecifics.Add(nvMpn);
      
                  }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-05-27
        • 1970-01-01
        • 2022-11-27
        • 2019-11-23
        • 1970-01-01
        • 2015-04-29
        • 2016-12-19
        相关资源
        最近更新 更多