• 3364阅读
  • 1回复

【技术分享】关于发布\编辑商品时如何设置商品属性及SKU属性指导

发帖
214
铜币
576
威望
91
贡献值
0
昵称
API技术支持TOP
— 本帖被 API技术支持TOP 执行提前操作(2015-05-13) —
503错误:
1. 首先通过获取类目属性信息接口(接口名称:api.getAttributesResultByCateId)来获取某个类目的属性列表。 这个类目属性列表包含了2大类属性,分别是SKU属性和商品属性。"attributes"字段中每个"{"表示一个属性,
   a) 其中的"sku"字段如果为true, 则表示这个属性是SKU属性,否则这个属性是商品属性。
   b) 其中的"required"字段如果为true, 则表示这个属性是必填的,否则可以不用填这个属性。
   c) 但是如果这个商品只有一种SKU, 那么即使这个类目中SKU属性的required为false, 也必须要填这个属性,否则这个商品就没有SKU了。


2. 在发布和编辑的时候如何设置商品属性和SKU属性。
      商品属性数据结构:
        {
            attrNameId:  属性名ID
            attrName:    属性名
            attrValueId: 属性值ID
            attrValue:   属性值    
        }
      SKU属性数据结构:
        {
            skuPropertyId:                   SKU属性名ID
            propertyValueId:                 SKU属性值ID
            propertyValueDefinitionName:     SKU自定义属性值
            skuImage:                        SKU图片
        }  


   a) 首先我需要调用api.getAttributesResultByCateId接口,获取到711002这个类目下的所有属性(具体内容查看第3点)。
   b) 根据"sku"字段是否为true, 我们可以得知
         id=19007,1133,351,43,436,2,3,200000631,200000941,200006745,200006746为商品属性.
         id=497为SKU属性。
   c) 根据"required"字段得知所有的商品属性都不是必填,但是如果你想填某几个商品属性,那么就必须按照这个商品属性定义的格式进行填写。
   d) attributeShowTypeValue字段定义了这个商品的类型,有input, check_box, list_box等几种类型。
      1). 对于input类型的属性,那么你需要填写attrNameId, attrValue这两个字段。
          例如: {attrNameId: 2, attrValue: "Apple"}, 表示品牌为苹果。属性值2对应的是品牌属性。
      2). 对于check_box,list_box类型的属性,由于您从系统已经设置好的几种属性值中选取其中的一种,
          所以只需要设置attrNameId和attrValueId这个两个字段即可。
          例如:{attrNameId: 19007, attrValueId: 349885}, 表示产品状态是二手的。
   e) 对于自定义的属性(attrNameId=4),您必须要填写属性名和属性值这两个字段,例如
          商品属性: {attrName: "color", attrValue: "red"}。表示一个自定义商品属性,颜色=红色
          SKU属性: {skuPropertyId: 497, propertyValueId: 4, propertyValueDefinitionName: "32GB"}  表示自定义了一个内存容量为32GB的SKU.


   f),综上所述,我们可以在发布和编辑的时候设置商品属性为:
       aeopAeProductPropertys :
       [
               {attrNameId: 2, attrValue: "Apple"},
               {attrNameId: 19007, attrValueId: 349885},
               {attrName: "color", attrValue: "red"}
       ]  


       SKU属性为:
       aeopAeProductSKUs :
       [
               {
                   "ipmSkuStock" : 1234
                   "skuPrice": 9999.00
                   "aeopSKUProperty" :
                   [
                       {"skuPropertyId" : 497, "propertyValueId":3858},
                       {"skuPropertyId" : 497, "propertyValueId" : 4,  "propertyValueDefinitionName" : "32GB"}
                   ]
               }
       ]    


3. 711002的类目属性:
   {
    "attributes": [{
        "spec": 0,
        "visible": true,
        "customizedName": false,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": false,
        "id": 19007,
        "values": [{
            "id": 349873,
            "names": {
                "zh": "库存",
                "en": "Stock"
            },
            "attributes": []
        }, {
            "id": 349885,
            "names": {
                "zh": "二手",
                "en": "Used"
            },
            "attributes": []
        }],
        "names": {
            "zh": "产品状态",
            "en": "Products Status"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "check_box"
    }, {
        "spec": 0,
        "visible": true,
        "customizedName": false,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": false,
        "id": 1133,
        "values": [{
            "id": 125,
            "names": {
                "zh": "Desktop",
                "en": "Desktop"
            },
            "attributes": []
        }, {
            "id": 704,
            "names": {
                "zh": "Laptop",
                "en": "Laptop"
            },
            "attributes": []
        }, {
            "id": 5851,
            "names": {
                "zh": "服务器",
                "en": "Server"
            },
            "attributes": []
        }, {
            "id": 4,
            "names": {
                "zh": "其它",
                "en": "Other"
            },
            "attributes": []
        }],
        "names": {
            "zh": "适用机型",
            "en": "Application"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "list_box"
    }, {
        "spec": 1,
        "visible": true,
        "customizedName": true,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": true,
        "id": 497,
        "values": [{
            "id": 3837,
            "names": {
                "zh": "1GB",
                "en": "1GB"
            },
            "attributes": []
        }, {
            "id": 3858,
            "names": {
                "zh": "2GB",
                "en": "2GB"
            },
            "attributes": []
        }, {
            "id": 5976,
            "names": {
                "zh": "3GB",
                "en": "3GB"
            },
            "attributes": []
        }, {
            "id": 3859,
            "names": {
                "zh": "4GB",
                "en": "4GB"
            },
            "attributes": []
        }, {
            "id": 350126,
            "names": {
                "zh": "6GB",
                "en": "6GB"
            },
            "attributes": []
        }, {
            "id": 3860,
            "names": {
                "zh": "8GB",
                "en": "8GB"
            },
            "attributes": []
        }, {
            "id": 5115,
            "names": {
                "zh": "16GB",
                "en": "16GB"
            },
            "attributes": []
        }, {
            "id": 200745268,
            "names": {
                "zh": "16GB",
                "en": "16 GB"
            },
            "attributes": []
        }, {
            "id": 5826,
            "names": {
                "zh": "128MB",
                "en": "128 MB"
            },
            "attributes": []
        }, {
            "id": 200746233,
            "names": {
                "zh": "128MB及以下",
                "en": ">128 MB"
            },
            "attributes": []
        }, {
            "id": 5827,
            "names": {
                "zh": "256MB",
                "en": "256 MB"
            },
            "attributes": []
        }, {
            "id": 5828,
            "names": {
                "zh": "512MB",
                "en": "512 MB"
            },
            "attributes": []
        }, {
            "id": 200746229,
            "names": {
                "zh": "4GBx3根",
                "en": "4 GB x3"
            },
            "attributes": []
        }, {
            "id": 200746227,
            "names": {
                "zh": "2GBx2根",
                "en": "2 GB x2"
            },
            "attributes": []
        }, {
            "id": 200746228,
            "names": {
                "zh": "2GBx3根",
                "en": "2 GB x3"
            },
            "attributes": []
        }, {
            "id": 200746226,
            "names": {
                "zh": "1GBx3根",
                "en": "1 GB x3"
            },
            "attributes": []
        }, {
            "id": 200746231,
            "names": {
                "zh": "8GBx2根",
                "en": "8 GB x2"
            },
            "attributes": []
        }, {
            "id": 200746230,
            "names": {
                "zh": "4GBx4根",
                "en": "4 GB x4"
            },
            "attributes": []
        }, {
            "id": 200746232,
            "names": {
                "zh": "8GBx4根",
                "en": "8 GB x4"
            },
            "attributes": []
        }, {
            "id": 4,
            "names": {
                "zh": "其它",
                "en": "Other"
            },
            "attributes": []
        }],
        "names": {
            "zh": "内存容量",
            "en": "Memory Capacity"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "list_box"
    }, {
        "spec": 0,
        "visible": true,
        "customizedName": false,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": false,
        "id": 351,
        "values": [{
            "id": 5820,
            "names": {
                "zh": "DDR",
                "en": "DDR"
            },
            "attributes": []
        }, {
            "id": 5821,
            "names": {
                "zh": "DDR2",
                "en": "DDR2"
            },
            "attributes": []
        }, {
            "id": 5822,
            "names": {
                "zh": "DDR3",
                "en": "DDR3"
            },
            "attributes": []
        }, {
            "id": 5854,
            "names": {
                "zh": "SDRAM",
                "en": "SDRAM"
            },
            "attributes": []
        }, {
            "id": 350127,
            "names": {
                "zh": "RDRAM",
                "en": "RDRAM"
            },
            "attributes": []
        }, {
            "id": 200746249,
            "names": {
                "zh": "REG DDR",
                "en": "REG DDR"
            },
            "attributes": []
        }, {
            "id": 200005429,
            "names": {
                "zh": "RAMBUS",
                "en": "RAMBUS"
            },
            "attributes": []
        }, {
            "id": 200746250,
            "names": {
                "zh": "REG SDRAM",
                "en": "REG SDRAM"
            },
            "attributes": []
        }, {
            "id": 4,
            "names": {
                "zh": "其它",
                "en": "Other"
            },
            "attributes": []
        }],
        "names": {
            "zh": "类型",
            "en": "Type"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "list_box"
    }, {
        "spec": 0,
        "visible": true,
        "customizedName": false,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": false,
        "id": 43,
        "values": [{
            "id": 8178,
            "names": {
                "zh": "ECC",
                "en": "ECC"
            },
            "attributes": []
        }, {
            "id": 100012178,
            "names": {
                "zh": "REG ECC",
                "en": "REG ECC"
            },
            "attributes": []
        }],
        "names": {
            "zh": "功能",
            "en": "Function"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "list_box"
    }, {
        "spec": 0,
        "visible": true,
        "customizedName": false,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": false,
        "id": 436,
        "names": {
            "zh": "频率",
            "en": "Frequency"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "input"
    }, {
        "spec": 0,
        "visible": true,
        "customizedName": false,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": false,
        "id": 2,
        "names": {
            "zh": "品牌",
            "en": "Brand Name"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "input"
    }, {
        "spec": 0,
        "visible": true,
        "customizedName": false,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": false,
        "id": 3,
        "names": {
            "zh": "型号",
            "en": "Model Number"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "input"
    }, {
        "spec": 0,
        "visible": true,
        "customizedName": false,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": false,
        "id": 200000631,
        "values": [{
            "id": 349907,
            "names": {
                "zh": "是",
                "en": "Yes"
            },
            "attributes": []
        }],
        "names": {
            "zh": "是否可定制",
            "en": "is_customized"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "list_box"
    }, {
        "spec": 0,
        "visible": true,
        "customizedName": false,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": false,
        "id": 200000941,
        "values": [{
            "id": 350216,
            "names": {
                "zh": "有",
                "en": "Yes"
            },
            "attributes": []
        }, {
            "id": 100018975,
            "names": {
                "zh": "无",
                "en": "No"
            },
            "attributes": []
        }],
        "names": {
            "zh": "是否有包装",
            "en": "Package"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "list_box"
    }, {
        "spec": 0,
        "visible": true,
        "customizedName": false,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": false,
        "id": 200006745,
        "values": [{
            "id": 200746223,
            "names": {
                "zh": "三通道3根",
                "en": "3x Three-channels"
            },
            "attributes": []
        }, {
            "id": 200746224,
            "names": {
                "zh": "四通道4根",
                "en": "4x Four-channels"
            },
            "attributes": []
        }, {
            "id": 200746225,
            "names": {
                "zh": "单条",
                "en": "Single"
            },
            "attributes": []
        }, {
            "id": 200746222,
            "names": {
                "zh": "双通道2根",
                "en": "2x Dual-channel"
            },
            "attributes": []
        }],
        "names": {
            "zh": "组合形式",
            "en": "Combination Form"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "list_box"
    }, {
        "spec": 0,
        "visible": true,
        "customizedName": false,
        "customizedPic": false,
        "keyAttribute": false,
        "sku": false,
        "id": 200006746,
        "values": [{
            "id": 200746235,
            "names": {
                "zh": "133MHz",
                "en": "133 MHz"
            },
            "attributes": []
        }, {
            "id": 200746240,
            "names": {
                "zh": "2333MHz",
                "en": "2333 MHz"
            },
            "attributes": []
        }, {
            "id": 200744985,
            "names": {
                "zh": "200MHz",
                "en": "200 MHz"
            },
            "attributes": []
        }, {
            "id": 200746242,
            "names": {
                "zh": "266MHz",
                "en": "266 MHz"
            },
            "attributes": []
        }, {
            "id": 200746245,
            "names": {
                "zh": "333MHz",
                "en": "333 MHz"
            },
            "attributes": []
        }, {
            "id": 200745313,
            "names": {
                "zh": "400MHz",
                "en": "400 MHz"
            },
            "attributes": []
        }, {
            "id": 200745314,
            "names": {
                "zh": "533MHz",
                "en": "533 MHz"
            },
            "attributes": []
        }, {
            "id": 200746246,
            "names": {
                "zh": "667MHz",
                "en": "667 MHz"
            },
            "attributes": []
        }, {
            "id": 200746247,
            "names": {
                "zh": "800MHz",
                "en": "800 MHz"
            },
            "attributes": []
        }, {
            "id": 200745371,
            "names": {
                "zh": "1000MHz",
                "en": "1000 MHz"
            },
            "attributes": []
        }, {
            "id": 200745310,
            "names": {
                "zh": "1066MHz",
                "en": "1066 MHz"
            },
            "attributes": []
        }, {
            "id": 200745387,
            "names": {
                "zh": "1100MHz",
                "en": "1100 MHz"
            },
            "attributes": []
        }, {
            "id": 200746248,
            "names": {
                "zh": "100MHz及以下",
                "en": ">= 100 MHz"
            },
            "attributes": []
        }, {
            "id": 200745311,
            "names": {
                "zh": "1333MHz",
                "en": "1333 MHz"
            },
            "attributes": []
        }, {
            "id": 200745740,
            "names": {
                "zh": "1800MHz",
                "en": "1800 MHz"
            },
            "attributes": []
        }, {
            "id": 200745392,
            "names": {
                "zh": "1150MHz",
                "en": "1150 MHz"
            },
            "attributes": []
        }, {
            "id": 200745735,
            "names": {
                "zh": "1200MHz",
                "en": "1200 MHz"
            },
            "attributes": []
        }, {
            "id": 200746236,
            "names": {
                "zh": "1625MHz",
                "en": "1625 MHz"
            },
            "attributes": []
        }, {
            "id": 200745312,
            "names": {
                "zh": "1600MHz",
                "en": "1600 MHz"
            },
            "attributes": []
        }, {
            "id": 200746238,
            "names": {
                "zh": "2000MHz",
                "en": "2000 MHz"
            },
            "attributes": []
        }, {
            "id": 200746234,
            "names": {
                "zh": "1142MHz",
                "en": "1142 MHz"
            },
            "attributes": []
        }, {
            "id": 200746241,
            "names": {
                "zh": "2400MHz",
                "en": "2400 MHz"
            },
            "attributes": []
        }, {
            "id": 200746237,
            "names": {
                "zh": "1866MHz",
                "en": "1866 MHz"
            },
            "attributes": []
        }, {
            "id": 200746239,
            "names": {
                "zh": "2133MHz",
                "en": "2133 MHz"
            },
            "attributes": []
        }, {
            "id": 200746243,
            "names": {
                "zh": "2666MHz",
                "en": "2666 MHz"
            },
            "attributes": []
        }, {
            "id": 200746244,
            "names": {
                "zh": "2800MHz",
                "en": "2800 MHz"
            },
            "attributes": []
        }],
        "names": {
            "zh": "内存频率",
            "en": "Memory Frequency"
        },
        "inputType": "STRING",
        "required": false,
        "attributeShowTypeValue": "list_box"
    }],
    "success": true
}








api.uploadImage接口例子程序:
-------------------------------------
说明:你需要将<your_app_key>, <your_access_token>, <your_signature>, <your_file_name>, <image_file_path>替换成你信息的信息。


代码:
PostMethod post = new PostMethod("http://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.uploadImage/<your_app_key>?access_token=<your_access_token>&_aop_signature=<your_signature>&fileName=<your_file_name>");
try {
    File file = new File(<image_file_path>);
    FileInputStream instream = new FileInputStream(file);
    post.setRequestEntity(new InputStreamRequestEntity(instream));
    HttpClient httpClient = new HttpClient();
    httpClient.executeMethod(post);


    int statusCode = post.getStatusCode();
    System.out.println("Response status code: "   statusCode);
    String responseString = post.getResponseBodyAsString();
    System.out.println("Response string: "   responseString);
} finally {
    post.releaseConnection();
}




api.uploadTempImage接口例子程序:
-------------------------------------
说明:你需要将<your_app_key>, <your_access_token>, <your_signature>, <your_file_name>, <image_file_path>替换成你信息的信息。


代码:
PostMethod post = new PostMethod("http://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.uploadTempImage/<your_app_key>?access_token=<your_access_token>&_aop_signature=<your_signature>&srcFileName=<your_file_name>");
try {
    File file = new File(<image_file_path>);
    FileInputStream instream = new FileInputStream(file);
    post.setRequestEntity(new InputStreamRequestEntity(instream));
    HttpClient httpClient = new HttpClient();
    httpClient.executeMethod(post);


    int statusCode = post.getStatusCode();
    System.out.println("Response status code: "   statusCode);
    String responseString = post.getResponseBodyAsString();
    System.out.println("Response string: "   responseString);
} finally {
    post.releaseConnection();
}


[ 此帖被API技术支持TOP在2016-03-29 17:47重新编辑 ]
本帖最近评分记录: 1 条评分 铜币 +1 隐藏
爆款QQ群498633725 铜币 +1 2015-11-29 【速卖通0到100单秘籍】爆款打造方法,加QQ群:498633725领取,仅限前88名!
分享到:
级别: 天使
发帖
604
铜币
602
威望
602
贡献值
0
昵称
爆款QQ群498633725
只看该作者 沙发  发表于: 2015-11-29
【速卖通0到100单秘籍】爆款打造方法,加QQ群:498633725领取,仅限前88名!
描述
快速回复

您目前还是游客,请 登录注册
如果您在写长篇帖子又不马上发表,建议存为草稿