Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let dang = JSON.parse('{\n' +
- ' "status":{\n' +
- ' "request":"getProducts",\n' +
- ' "requestUnixTime":1529340735,\n' +
- ' "responseStatus":"ok",\n' +
- ' "errorCode":0,\n' +
- ' "generationTime":0.13909101486206,\n' +
- ' "recordsTotal":11,\n' +
- ' "recordsInResponse":11\n' +
- ' },\n' +
- ' "records":[\n' +
- ' {\n' +
- ' "productID":1,\n' +
- ' "name":"N\u00e4idistoode",\n' +
- ' "code":"001",\n' +
- ' "code2":"3711234567890",\n' +
- ' "code3":"",\n' +
- ' "supplierCode":"",\n' +
- ' "groupID":1,\n' +
- ' "price":10,\n' +
- ' "active":1,\n' +
- ' "displayedInWebshop":1,\n' +
- ' "seriesID":1,\n' +
- ' "supplierID":0,\n' +
- ' "unitID":1,\n' +
- ' "vatrateID":1,\n' +
- ' "hasQuickSelectButton":1,\n' +
- ' "isGiftCard":0,\n' +
- ' "manufacturerName":"",\n' +
- ' "priorityGroupID":"0",\n' +
- ' "countryOfOriginID":"46",\n' +
- ' "brandID":0,\n' +
- ' "length":"180",\n' +
- ' "width":"180",\n' +
- ' "height":"65",\n' +
- ' "netWeight":"0.25",\n' +
- ' "grossWeight":"0.34",\n' +
- ' "volume":"250",\n' +
- ' "locationInWarehouseID":"0",\n' +
- ' "locationInWarehouseName":"",\n' +
- ' "locationInWarehouseText":"",\n' +
- ' "description":"",\n' +
- ' "longdesc":"",\n' +
- ' "descriptionENG":"",\n' +
- ' "longdescENG":"",\n' +
- ' "descriptionRUS":"",\n' +
- ' "longdescRUS":"",\n' +
- ' "descriptionFIN":"",\n' +
- ' "longdescFIN":"",\n' +
- ' "containerID":0,\n' +
- ' "cost":0,\n' +
- ' "added":0,\n' +
- ' "addedByUsername":"",\n' +
- ' "lastModified":1529327949,\n' +
- ' "lastModifiedByUsername":"karli.udso@erply",\n' +
- ' "vatrate":20,\n' +
- ' "priceWithVat":12,\n' +
- ' "unitName":"tk",\n' +
- ' "brandName":null,\n' +
- ' "seriesName":"Vaikimisi seeria",\n' +
- ' "groupName":"Vaikimisi grupp",\n' +
- ' "supplierName":null,\n' +
- ' "categoryID":1,\n' +
- ' "categoryName":"Vaikimisi seeria",\n' +
- ' "status":"ACTIVE",\n' +
- ' "taxFree":0,\n' +
- ' "backbarCharges":0,\n' +
- ' "isRegularGiftCard":0,\n' +
- ' "cashierMustEnterPrice":0,\n' +
- ' "nonStockProduct":0,\n' +
- ' "rewardPointsNotAllowed":0,\n' +
- ' "longAttributes":[\n' +
- '\n' +
- ' ],\n' +
- ' "type":"MATRIX"\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":2,\n' +
- ' "name":"toode_1",\n' +
- ' "code":"2",\n' +
- ' "code2":"",\n' +
- ' "code3":"",\n' +
- ' "supplierCode":"",\n' +
- ' "groupID":1,\n' +
- ' "price":25,\n' +
- ' "active":1,\n' +
- ' "displayedInWebshop":1,\n' +
- ' "seriesID":0,\n' +
- ' "supplierID":0,\n' +
- ' "unitID":0,\n' +
- ' "vatrateID":1,\n' +
- ' "hasQuickSelectButton":0,\n' +
- ' "isGiftCard":0,\n' +
- ' "manufacturerName":"",\n' +
- ' "priorityGroupID":"0",\n' +
- ' "countryOfOriginID":"0",\n' +
- ' "brandID":0,\n' +
- ' "length":"0",\n' +
- ' "width":"0",\n' +
- ' "height":"0",\n' +
- ' "netWeight":"",\n' +
- ' "grossWeight":"0",\n' +
- ' "volume":"0",\n' +
- ' "locationInWarehouseID":"0",\n' +
- ' "locationInWarehouseName":"",\n' +
- ' "locationInWarehouseText":"",\n' +
- ' "description":"",\n' +
- ' "longdesc":"",\n' +
- ' "descriptionENG":"",\n' +
- ' "longdescENG":"",\n' +
- ' "descriptionRUS":"",\n' +
- ' "longdescRUS":"",\n' +
- ' "descriptionFIN":"",\n' +
- ' "longdescFIN":"",\n' +
- ' "containerID":0,\n' +
- ' "cost":0,\n' +
- ' "added":1529325214,\n' +
- ' "addedByUsername":"karli.udso@erply",\n' +
- ' "lastModified":1529327949,\n' +
- ' "lastModifiedByUsername":"karli.udso@erply",\n' +
- ' "vatrate":20,\n' +
- ' "priceWithVat":30,\n' +
- ' "unitName":null,\n' +
- ' "brandName":null,\n' +
- ' "seriesName":null,\n' +
- ' "groupName":"Vaikimisi grupp",\n' +
- ' "supplierName":null,\n' +
- ' "categoryID":0,\n' +
- ' "categoryName":null,\n' +
- ' "status":"ACTIVE",\n' +
- ' "taxFree":0,\n' +
- ' "backbarCharges":0,\n' +
- ' "isRegularGiftCard":0,\n' +
- ' "cashierMustEnterPrice":0,\n' +
- ' "nonStockProduct":0,\n' +
- ' "rewardPointsNotAllowed":0,\n' +
- ' "longAttributes":[\n' +
- '\n' +
- ' ],\n' +
- ' "type":"MATRIX"\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":3,\n' +
- ' "name":"t-shirt",\n' +
- ' "code":"3",\n' +
- ' "code2":"",\n' +
- ' "code3":"",\n' +
- ' "supplierCode":"",\n' +
- ' "groupID":2,\n' +
- ' "price":60,\n' +
- ' "active":1,\n' +
- ' "displayedInWebshop":1,\n' +
- ' "seriesID":1,\n' +
- ' "supplierID":0,\n' +
- ' "unitID":1,\n' +
- ' "vatrateID":1,\n' +
- ' "hasQuickSelectButton":0,\n' +
- ' "isGiftCard":0,\n' +
- ' "manufacturerName":"",\n' +
- ' "priorityGroupID":"1",\n' +
- ' "countryOfOriginID":"47",\n' +
- ' "brandID":0,\n' +
- ' "length":"0",\n' +
- ' "width":"0",\n' +
- ' "height":"0",\n' +
- ' "netWeight":"",\n' +
- ' "grossWeight":"0",\n' +
- ' "volume":"0",\n' +
- ' "locationInWarehouseID":"0",\n' +
- ' "locationInWarehouseName":"",\n' +
- ' "locationInWarehouseText":"",\n' +
- ' "description":"",\n' +
- ' "longdesc":"",\n' +
- ' "descriptionENG":"",\n' +
- ' "longdescENG":"",\n' +
- ' "descriptionRUS":"",\n' +
- ' "longdescRUS":"",\n' +
- ' "descriptionFIN":"",\n' +
- ' "longdescFIN":"",\n' +
- ' "containerID":0,\n' +
- ' "cost":0,\n' +
- ' "added":1529328260,\n' +
- ' "addedByUsername":"karli.udso@erply",\n' +
- ' "lastModified":0,\n' +
- ' "lastModifiedByUsername":"",\n' +
- ' "vatrate":20,\n' +
- ' "priceWithVat":72,\n' +
- ' "unitName":"tk",\n' +
- ' "brandName":null,\n' +
- ' "seriesName":"Vaikimisi seeria",\n' +
- ' "groupName":"clothes",\n' +
- ' "supplierName":null,\n' +
- ' "categoryID":1,\n' +
- ' "categoryName":"Vaikimisi seeria",\n' +
- ' "status":"ACTIVE",\n' +
- ' "taxFree":0,\n' +
- ' "backbarCharges":0,\n' +
- ' "isRegularGiftCard":0,\n' +
- ' "cashierMustEnterPrice":0,\n' +
- ' "nonStockProduct":0,\n' +
- ' "rewardPointsNotAllowed":0,\n' +
- ' "longAttributes":[\n' +
- '\n' +
- ' ],\n' +
- ' "productVariations":[\n' +
- ' "4",\n' +
- ' "5",\n' +
- ' "6",\n' +
- ' "7",\n' +
- ' "8",\n' +
- ' "9",\n' +
- ' "10",\n' +
- ' "11"\n' +
- ' ],\n' +
- ' "variationList":[\n' +
- ' {\n' +
- ' "productID":"4",\n' +
- ' "name":"t-shirt Extra large Red",\n' +
- ' "code":"3-XL-red",\n' +
- ' "code2":null,\n' +
- ' "dimensions":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Extra large",\n' +
- ' "code":"XL",\n' +
- ' "dimensionID":"8",\n' +
- ' "dimensionValueID":16\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Red",\n' +
- ' "code":"red",\n' +
- ' "dimensionID":"1",\n' +
- ' "dimensionValueID":2\n' +
- ' }\n' +
- ' ]\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":"5",\n' +
- ' "name":"t-shirt Extra large Green",\n' +
- ' "code":"3-XL-green",\n' +
- ' "code2":null,\n' +
- ' "dimensions":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Extra large",\n' +
- ' "code":"XL",\n' +
- ' "dimensionID":"8",\n' +
- ' "dimensionValueID":16\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Green",\n' +
- ' "code":"green",\n' +
- ' "dimensionID":"1",\n' +
- ' "dimensionValueID":5\n' +
- ' }\n' +
- ' ]\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":"6",\n' +
- ' "name":"t-shirt Large Red",\n' +
- ' "code":"3-L-red",\n' +
- ' "code2":null,\n' +
- ' "dimensions":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Large",\n' +
- ' "code":"L",\n' +
- ' "dimensionID":"8",\n' +
- ' "dimensionValueID":9\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Red",\n' +
- ' "code":"red",\n' +
- ' "dimensionID":"1",\n' +
- ' "dimensionValueID":2\n' +
- ' }\n' +
- ' ]\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":"7",\n' +
- ' "name":"t-shirt Large Green",\n' +
- ' "code":"3-L-green",\n' +
- ' "code2":null,\n' +
- ' "dimensions":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Large",\n' +
- ' "code":"L",\n' +
- ' "dimensionID":"8",\n' +
- ' "dimensionValueID":9\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Green",\n' +
- ' "code":"green",\n' +
- ' "dimensionID":"1",\n' +
- ' "dimensionValueID":5\n' +
- ' }\n' +
- ' ]\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":"8",\n' +
- ' "name":"t-shirt Medium Red",\n' +
- ' "code":"3-M-red",\n' +
- ' "code2":null,\n' +
- ' "dimensions":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Medium",\n' +
- ' "code":"M",\n' +
- ' "dimensionID":"8",\n' +
- ' "dimensionValueID":12\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Red",\n' +
- ' "code":"red",\n' +
- ' "dimensionID":"1",\n' +
- ' "dimensionValueID":2\n' +
- ' }\n' +
- ' ]\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":"9",\n' +
- ' "name":"t-shirt Medium Green",\n' +
- ' "code":"3-M-green",\n' +
- ' "code2":null,\n' +
- ' "dimensions":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Medium",\n' +
- ' "code":"M",\n' +
- ' "dimensionID":"8",\n' +
- ' "dimensionValueID":12\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Green",\n' +
- ' "code":"green",\n' +
- ' "dimensionID":"1",\n' +
- ' "dimensionValueID":5\n' +
- ' }\n' +
- ' ]\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":"10",\n' +
- ' "name":"t-shirt Small Red",\n' +
- ' "code":"3-S-red",\n' +
- ' "code2":null,\n' +
- ' "dimensions":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Small",\n' +
- ' "code":"S",\n' +
- ' "dimensionID":"8",\n' +
- ' "dimensionValueID":15\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Red",\n' +
- ' "code":"red",\n' +
- ' "dimensionID":"1",\n' +
- ' "dimensionValueID":2\n' +
- ' }\n' +
- ' ]\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":"11",\n' +
- ' "name":"t-shirt Small Green",\n' +
- ' "code":"3-S-green",\n' +
- ' "code2":null,\n' +
- ' "dimensions":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Small",\n' +
- ' "code":"S",\n' +
- ' "dimensionID":"8",\n' +
- ' "dimensionValueID":15\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Green",\n' +
- ' "code":"green",\n' +
- ' "dimensionID":"1",\n' +
- ' "dimensionValueID":5\n' +
- ' }\n' +
- ' ]\n' +
- ' }\n' +
- ' ],\n' +
- ' "type":"MATRIX"\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":4,\n' +
- ' "name":"t-shirt Extra large Red",\n' +
- ' "code":"3-XL-red",\n' +
- ' "code2":null,\n' +
- ' "code3":null,\n' +
- ' "supplierCode":null,\n' +
- ' "groupID":2,\n' +
- ' "price":60,\n' +
- ' "active":1,\n' +
- ' "displayedInWebshop":1,\n' +
- ' "seriesID":1,\n' +
- ' "supplierID":0,\n' +
- ' "unitID":1,\n' +
- ' "vatrateID":1,\n' +
- ' "hasQuickSelectButton":0,\n' +
- ' "isGiftCard":0,\n' +
- ' "manufacturerName":"",\n' +
- ' "priorityGroupID":"1",\n' +
- ' "countryOfOriginID":"47",\n' +
- ' "brandID":0,\n' +
- ' "length":"0",\n' +
- ' "width":"0",\n' +
- ' "height":"0",\n' +
- ' "netWeight":"",\n' +
- ' "grossWeight":"0",\n' +
- ' "volume":"0",\n' +
- ' "locationInWarehouseID":"0",\n' +
- ' "locationInWarehouseName":"",\n' +
- ' "locationInWarehouseText":"",\n' +
- ' "description":"",\n' +
- ' "longdesc":"",\n' +
- ' "descriptionENG":"",\n' +
- ' "longdescENG":"",\n' +
- ' "descriptionRUS":"",\n' +
- ' "longdescRUS":"",\n' +
- ' "descriptionFIN":"",\n' +
- ' "longdescFIN":"",\n' +
- ' "containerID":0,\n' +
- ' "cost":0,\n' +
- ' "added":1529329812,\n' +
- ' "addedByUsername":"karli.udso@erply",\n' +
- ' "lastModified":0,\n' +
- ' "lastModifiedByUsername":"",\n' +
- ' "vatrate":20,\n' +
- ' "priceWithVat":72,\n' +
- ' "unitName":"tk",\n' +
- ' "brandName":null,\n' +
- ' "seriesName":"Vaikimisi seeria",\n' +
- ' "groupName":"clothes",\n' +
- ' "supplierName":null,\n' +
- ' "categoryID":1,\n' +
- ' "categoryName":"Vaikimisi seeria",\n' +
- ' "status":"ACTIVE",\n' +
- ' "taxFree":0,\n' +
- ' "backbarCharges":0,\n' +
- ' "isRegularGiftCard":0,\n' +
- ' "cashierMustEnterPrice":0,\n' +
- ' "nonStockProduct":0,\n' +
- ' "rewardPointsNotAllowed":0,\n' +
- ' "longAttributes":[\n' +
- '\n' +
- ' ],\n' +
- ' "variationDescription":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Extra large",\n' +
- ' "dimensionID":"8",\n' +
- ' "variationID":16\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Red",\n' +
- ' "dimensionID":"1",\n' +
- ' "variationID":2\n' +
- ' }\n' +
- ' ],\n' +
- ' "parentProductID":3,\n' +
- ' "type":"PRODUCT"\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":5,\n' +
- ' "name":"t-shirt Extra large Green",\n' +
- ' "code":"3-XL-green",\n' +
- ' "code2":null,\n' +
- ' "code3":null,\n' +
- ' "supplierCode":null,\n' +
- ' "groupID":2,\n' +
- ' "price":60,\n' +
- ' "active":1,\n' +
- ' "displayedInWebshop":1,\n' +
- ' "seriesID":1,\n' +
- ' "supplierID":0,\n' +
- ' "unitID":1,\n' +
- ' "vatrateID":1,\n' +
- ' "hasQuickSelectButton":0,\n' +
- ' "isGiftCard":0,\n' +
- ' "manufacturerName":"",\n' +
- ' "priorityGroupID":"1",\n' +
- ' "countryOfOriginID":"47",\n' +
- ' "brandID":0,\n' +
- ' "length":"0",\n' +
- ' "width":"0",\n' +
- ' "height":"0",\n' +
- ' "netWeight":"",\n' +
- ' "grossWeight":"0",\n' +
- ' "volume":"0",\n' +
- ' "locationInWarehouseID":"0",\n' +
- ' "locationInWarehouseName":"",\n' +
- ' "locationInWarehouseText":"",\n' +
- ' "description":"",\n' +
- ' "longdesc":"",\n' +
- ' "descriptionENG":"",\n' +
- ' "longdescENG":"",\n' +
- ' "descriptionRUS":"",\n' +
- ' "longdescRUS":"",\n' +
- ' "descriptionFIN":"",\n' +
- ' "longdescFIN":"",\n' +
- ' "containerID":0,\n' +
- ' "cost":0,\n' +
- ' "added":1529329812,\n' +
- ' "addedByUsername":"karli.udso@erply",\n' +
- ' "lastModified":0,\n' +
- ' "lastModifiedByUsername":"",\n' +
- ' "vatrate":20,\n' +
- ' "priceWithVat":72,\n' +
- ' "unitName":"tk",\n' +
- ' "brandName":null,\n' +
- ' "seriesName":"Vaikimisi seeria",\n' +
- ' "groupName":"clothes",\n' +
- ' "supplierName":null,\n' +
- ' "categoryID":1,\n' +
- ' "categoryName":"Vaikimisi seeria",\n' +
- ' "status":"ACTIVE",\n' +
- ' "taxFree":0,\n' +
- ' "backbarCharges":0,\n' +
- ' "isRegularGiftCard":0,\n' +
- ' "cashierMustEnterPrice":0,\n' +
- ' "nonStockProduct":0,\n' +
- ' "rewardPointsNotAllowed":0,\n' +
- ' "longAttributes":[\n' +
- '\n' +
- ' ],\n' +
- ' "variationDescription":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Extra large",\n' +
- ' "dimensionID":"8",\n' +
- ' "variationID":16\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Green",\n' +
- ' "dimensionID":"1",\n' +
- ' "variationID":5\n' +
- ' }\n' +
- ' ],\n' +
- ' "parentProductID":3,\n' +
- ' "type":"PRODUCT"\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":6,\n' +
- ' "name":"t-shirt Large Red",\n' +
- ' "code":"3-L-red",\n' +
- ' "code2":null,\n' +
- ' "code3":null,\n' +
- ' "supplierCode":null,\n' +
- ' "groupID":2,\n' +
- ' "price":60,\n' +
- ' "active":1,\n' +
- ' "displayedInWebshop":1,\n' +
- ' "seriesID":1,\n' +
- ' "supplierID":0,\n' +
- ' "unitID":1,\n' +
- ' "vatrateID":1,\n' +
- ' "hasQuickSelectButton":0,\n' +
- ' "isGiftCard":0,\n' +
- ' "manufacturerName":"",\n' +
- ' "priorityGroupID":"1",\n' +
- ' "countryOfOriginID":"47",\n' +
- ' "brandID":0,\n' +
- ' "length":"0",\n' +
- ' "width":"0",\n' +
- ' "height":"0",\n' +
- ' "netWeight":"",\n' +
- ' "grossWeight":"0",\n' +
- ' "volume":"0",\n' +
- ' "locationInWarehouseID":"0",\n' +
- ' "locationInWarehouseName":"",\n' +
- ' "locationInWarehouseText":"",\n' +
- ' "description":"",\n' +
- ' "longdesc":"",\n' +
- ' "descriptionENG":"",\n' +
- ' "longdescENG":"",\n' +
- ' "descriptionRUS":"",\n' +
- ' "longdescRUS":"",\n' +
- ' "descriptionFIN":"",\n' +
- ' "longdescFIN":"",\n' +
- ' "containerID":0,\n' +
- ' "cost":0,\n' +
- ' "added":1529329812,\n' +
- ' "addedByUsername":"karli.udso@erply",\n' +
- ' "lastModified":0,\n' +
- ' "lastModifiedByUsername":"",\n' +
- ' "vatrate":20,\n' +
- ' "priceWithVat":72,\n' +
- ' "unitName":"tk",\n' +
- ' "brandName":null,\n' +
- ' "seriesName":"Vaikimisi seeria",\n' +
- ' "groupName":"clothes",\n' +
- ' "supplierName":null,\n' +
- ' "categoryID":1,\n' +
- ' "categoryName":"Vaikimisi seeria",\n' +
- ' "status":"ACTIVE",\n' +
- ' "taxFree":0,\n' +
- ' "backbarCharges":0,\n' +
- ' "isRegularGiftCard":0,\n' +
- ' "cashierMustEnterPrice":0,\n' +
- ' "nonStockProduct":0,\n' +
- ' "rewardPointsNotAllowed":0,\n' +
- ' "longAttributes":[\n' +
- '\n' +
- ' ],\n' +
- ' "variationDescription":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Large",\n' +
- ' "dimensionID":"8",\n' +
- ' "variationID":9\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Red",\n' +
- ' "dimensionID":"1",\n' +
- ' "variationID":2\n' +
- ' }\n' +
- ' ],\n' +
- ' "parentProductID":3,\n' +
- ' "type":"PRODUCT"\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":7,\n' +
- ' "name":"t-shirt Large Green",\n' +
- ' "code":"3-L-green",\n' +
- ' "code2":null,\n' +
- ' "code3":null,\n' +
- ' "supplierCode":null,\n' +
- ' "groupID":2,\n' +
- ' "price":60,\n' +
- ' "active":1,\n' +
- ' "displayedInWebshop":1,\n' +
- ' "seriesID":1,\n' +
- ' "supplierID":0,\n' +
- ' "unitID":1,\n' +
- ' "vatrateID":1,\n' +
- ' "hasQuickSelectButton":0,\n' +
- ' "isGiftCard":0,\n' +
- ' "manufacturerName":"",\n' +
- ' "priorityGroupID":"1",\n' +
- ' "countryOfOriginID":"47",\n' +
- ' "brandID":0,\n' +
- ' "length":"0",\n' +
- ' "width":"0",\n' +
- ' "height":"0",\n' +
- ' "netWeight":"",\n' +
- ' "grossWeight":"0",\n' +
- ' "volume":"0",\n' +
- ' "locationInWarehouseID":"0",\n' +
- ' "locationInWarehouseName":"",\n' +
- ' "locationInWarehouseText":"",\n' +
- ' "description":"",\n' +
- ' "longdesc":"",\n' +
- ' "descriptionENG":"",\n' +
- ' "longdescENG":"",\n' +
- ' "descriptionRUS":"",\n' +
- ' "longdescRUS":"",\n' +
- ' "descriptionFIN":"",\n' +
- ' "longdescFIN":"",\n' +
- ' "containerID":0,\n' +
- ' "cost":0,\n' +
- ' "added":1529329812,\n' +
- ' "addedByUsername":"karli.udso@erply",\n' +
- ' "lastModified":0,\n' +
- ' "lastModifiedByUsername":"",\n' +
- ' "vatrate":20,\n' +
- ' "priceWithVat":72,\n' +
- ' "unitName":"tk",\n' +
- ' "brandName":null,\n' +
- ' "seriesName":"Vaikimisi seeria",\n' +
- ' "groupName":"clothes",\n' +
- ' "supplierName":null,\n' +
- ' "categoryID":1,\n' +
- ' "categoryName":"Vaikimisi seeria",\n' +
- ' "status":"ACTIVE",\n' +
- ' "taxFree":0,\n' +
- ' "backbarCharges":0,\n' +
- ' "isRegularGiftCard":0,\n' +
- ' "cashierMustEnterPrice":0,\n' +
- ' "nonStockProduct":0,\n' +
- ' "rewardPointsNotAllowed":0,\n' +
- ' "longAttributes":[\n' +
- '\n' +
- ' ],\n' +
- ' "variationDescription":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Large",\n' +
- ' "dimensionID":"8",\n' +
- ' "variationID":9\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Green",\n' +
- ' "dimensionID":"1",\n' +
- ' "variationID":5\n' +
- ' }\n' +
- ' ],\n' +
- ' "parentProductID":3,\n' +
- ' "type":"PRODUCT"\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":8,\n' +
- ' "name":"t-shirt Medium Red",\n' +
- ' "code":"3-M-red",\n' +
- ' "code2":null,\n' +
- ' "code3":null,\n' +
- ' "supplierCode":null,\n' +
- ' "groupID":2,\n' +
- ' "price":60,\n' +
- ' "active":1,\n' +
- ' "displayedInWebshop":1,\n' +
- ' "seriesID":1,\n' +
- ' "supplierID":0,\n' +
- ' "unitID":1,\n' +
- ' "vatrateID":1,\n' +
- ' "hasQuickSelectButton":0,\n' +
- ' "isGiftCard":0,\n' +
- ' "manufacturerName":"",\n' +
- ' "priorityGroupID":"1",\n' +
- ' "countryOfOriginID":"47",\n' +
- ' "brandID":0,\n' +
- ' "length":"0",\n' +
- ' "width":"0",\n' +
- ' "height":"0",\n' +
- ' "netWeight":"",\n' +
- ' "grossWeight":"0",\n' +
- ' "volume":"0",\n' +
- ' "locationInWarehouseID":"0",\n' +
- ' "locationInWarehouseName":"",\n' +
- ' "locationInWarehouseText":"",\n' +
- ' "description":"",\n' +
- ' "longdesc":"",\n' +
- ' "descriptionENG":"",\n' +
- ' "longdescENG":"",\n' +
- ' "descriptionRUS":"",\n' +
- ' "longdescRUS":"",\n' +
- ' "descriptionFIN":"",\n' +
- ' "longdescFIN":"",\n' +
- ' "containerID":0,\n' +
- ' "cost":0,\n' +
- ' "added":1529329812,\n' +
- ' "addedByUsername":"karli.udso@erply",\n' +
- ' "lastModified":0,\n' +
- ' "lastModifiedByUsername":"",\n' +
- ' "vatrate":20,\n' +
- ' "priceWithVat":72,\n' +
- ' "unitName":"tk",\n' +
- ' "brandName":null,\n' +
- ' "seriesName":"Vaikimisi seeria",\n' +
- ' "groupName":"clothes",\n' +
- ' "supplierName":null,\n' +
- ' "categoryID":1,\n' +
- ' "categoryName":"Vaikimisi seeria",\n' +
- ' "status":"ACTIVE",\n' +
- ' "taxFree":0,\n' +
- ' "backbarCharges":0,\n' +
- ' "isRegularGiftCard":0,\n' +
- ' "cashierMustEnterPrice":0,\n' +
- ' "nonStockProduct":0,\n' +
- ' "rewardPointsNotAllowed":0,\n' +
- ' "longAttributes":[\n' +
- '\n' +
- ' ],\n' +
- ' "variationDescription":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Medium",\n' +
- ' "dimensionID":"8",\n' +
- ' "variationID":12\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Red",\n' +
- ' "dimensionID":"1",\n' +
- ' "variationID":2\n' +
- ' }\n' +
- ' ],\n' +
- ' "parentProductID":3,\n' +
- ' "type":"PRODUCT"\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":9,\n' +
- ' "name":"t-shirt Medium Green",\n' +
- ' "code":"3-M-green",\n' +
- ' "code2":null,\n' +
- ' "code3":null,\n' +
- ' "supplierCode":null,\n' +
- ' "groupID":2,\n' +
- ' "price":60,\n' +
- ' "active":1,\n' +
- ' "displayedInWebshop":1,\n' +
- ' "seriesID":1,\n' +
- ' "supplierID":0,\n' +
- ' "unitID":1,\n' +
- ' "vatrateID":1,\n' +
- ' "hasQuickSelectButton":0,\n' +
- ' "isGiftCard":0,\n' +
- ' "manufacturerName":"",\n' +
- ' "priorityGroupID":"1",\n' +
- ' "countryOfOriginID":"47",\n' +
- ' "brandID":0,\n' +
- ' "length":"0",\n' +
- ' "width":"0",\n' +
- ' "height":"0",\n' +
- ' "netWeight":"",\n' +
- ' "grossWeight":"0",\n' +
- ' "volume":"0",\n' +
- ' "locationInWarehouseID":"0",\n' +
- ' "locationInWarehouseName":"",\n' +
- ' "locationInWarehouseText":"",\n' +
- ' "description":"",\n' +
- ' "longdesc":"",\n' +
- ' "descriptionENG":"",\n' +
- ' "longdescENG":"",\n' +
- ' "descriptionRUS":"",\n' +
- ' "longdescRUS":"",\n' +
- ' "descriptionFIN":"",\n' +
- ' "longdescFIN":"",\n' +
- ' "containerID":0,\n' +
- ' "cost":0,\n' +
- ' "added":1529329812,\n' +
- ' "addedByUsername":"karli.udso@erply",\n' +
- ' "lastModified":0,\n' +
- ' "lastModifiedByUsername":"",\n' +
- ' "vatrate":20,\n' +
- ' "priceWithVat":72,\n' +
- ' "unitName":"tk",\n' +
- ' "brandName":null,\n' +
- ' "seriesName":"Vaikimisi seeria",\n' +
- ' "groupName":"clothes",\n' +
- ' "supplierName":null,\n' +
- ' "categoryID":1,\n' +
- ' "categoryName":"Vaikimisi seeria",\n' +
- ' "status":"ACTIVE",\n' +
- ' "taxFree":0,\n' +
- ' "backbarCharges":0,\n' +
- ' "isRegularGiftCard":0,\n' +
- ' "cashierMustEnterPrice":0,\n' +
- ' "nonStockProduct":0,\n' +
- ' "rewardPointsNotAllowed":0,\n' +
- ' "longAttributes":[\n' +
- '\n' +
- ' ],\n' +
- ' "variationDescription":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Medium",\n' +
- ' "dimensionID":"8",\n' +
- ' "variationID":12\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Green",\n' +
- ' "dimensionID":"1",\n' +
- ' "variationID":5\n' +
- ' }\n' +
- ' ],\n' +
- ' "parentProductID":3,\n' +
- ' "type":"PRODUCT"\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":10,\n' +
- ' "name":"t-shirt Small Red",\n' +
- ' "code":"3-S-red",\n' +
- ' "code2":null,\n' +
- ' "code3":null,\n' +
- ' "supplierCode":null,\n' +
- ' "groupID":2,\n' +
- ' "price":60,\n' +
- ' "active":1,\n' +
- ' "displayedInWebshop":1,\n' +
- ' "seriesID":1,\n' +
- ' "supplierID":0,\n' +
- ' "unitID":1,\n' +
- ' "vatrateID":1,\n' +
- ' "hasQuickSelectButton":0,\n' +
- ' "isGiftCard":0,\n' +
- ' "manufacturerName":"",\n' +
- ' "priorityGroupID":"1",\n' +
- ' "countryOfOriginID":"47",\n' +
- ' "brandID":0,\n' +
- ' "length":"0",\n' +
- ' "width":"0",\n' +
- ' "height":"0",\n' +
- ' "netWeight":"",\n' +
- ' "grossWeight":"0",\n' +
- ' "volume":"0",\n' +
- ' "locationInWarehouseID":"0",\n' +
- ' "locationInWarehouseName":"",\n' +
- ' "locationInWarehouseText":"",\n' +
- ' "description":"",\n' +
- ' "longdesc":"",\n' +
- ' "descriptionENG":"",\n' +
- ' "longdescENG":"",\n' +
- ' "descriptionRUS":"",\n' +
- ' "longdescRUS":"",\n' +
- ' "descriptionFIN":"",\n' +
- ' "longdescFIN":"",\n' +
- ' "containerID":0,\n' +
- ' "cost":0,\n' +
- ' "added":1529329812,\n' +
- ' "addedByUsername":"karli.udso@erply",\n' +
- ' "lastModified":0,\n' +
- ' "lastModifiedByUsername":"",\n' +
- ' "vatrate":20,\n' +
- ' "priceWithVat":72,\n' +
- ' "unitName":"tk",\n' +
- ' "brandName":null,\n' +
- ' "seriesName":"Vaikimisi seeria",\n' +
- ' "groupName":"clothes",\n' +
- ' "supplierName":null,\n' +
- ' "categoryID":1,\n' +
- ' "categoryName":"Vaikimisi seeria",\n' +
- ' "status":"ACTIVE",\n' +
- ' "taxFree":0,\n' +
- ' "backbarCharges":0,\n' +
- ' "isRegularGiftCard":0,\n' +
- ' "cashierMustEnterPrice":0,\n' +
- ' "nonStockProduct":0,\n' +
- ' "rewardPointsNotAllowed":0,\n' +
- ' "longAttributes":[\n' +
- '\n' +
- ' ],\n' +
- ' "variationDescription":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Small",\n' +
- ' "dimensionID":"8",\n' +
- ' "variationID":15\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Red",\n' +
- ' "dimensionID":"1",\n' +
- ' "variationID":2\n' +
- ' }\n' +
- ' ],\n' +
- ' "parentProductID":3,\n' +
- ' "type":"PRODUCT"\n' +
- ' },\n' +
- ' {\n' +
- ' "productID":11,\n' +
- ' "name":"t-shirt Small Green",\n' +
- ' "code":"3-S-green",\n' +
- ' "code2":null,\n' +
- ' "code3":null,\n' +
- ' "supplierCode":null,\n' +
- ' "groupID":2,\n' +
- ' "price":60,\n' +
- ' "active":1,\n' +
- ' "displayedInWebshop":1,\n' +
- ' "seriesID":1,\n' +
- ' "supplierID":0,\n' +
- ' "unitID":1,\n' +
- ' "vatrateID":1,\n' +
- ' "hasQuickSelectButton":0,\n' +
- ' "isGiftCard":0,\n' +
- ' "manufacturerName":"",\n' +
- ' "priorityGroupID":"1",\n' +
- ' "countryOfOriginID":"47",\n' +
- ' "brandID":0,\n' +
- ' "length":"0",\n' +
- ' "width":"0",\n' +
- ' "height":"0",\n' +
- ' "netWeight":"",\n' +
- ' "grossWeight":"0",\n' +
- ' "volume":"0",\n' +
- ' "locationInWarehouseID":"0",\n' +
- ' "locationInWarehouseName":"",\n' +
- ' "locationInWarehouseText":"",\n' +
- ' "description":"",\n' +
- ' "longdesc":"",\n' +
- ' "descriptionENG":"",\n' +
- ' "longdescENG":"",\n' +
- ' "descriptionRUS":"",\n' +
- ' "longdescRUS":"",\n' +
- ' "descriptionFIN":"",\n' +
- ' "longdescFIN":"",\n' +
- ' "containerID":0,\n' +
- ' "cost":0,\n' +
- ' "added":1529329812,\n' +
- ' "addedByUsername":"karli.udso@erply",\n' +
- ' "lastModified":0,\n' +
- ' "lastModifiedByUsername":"",\n' +
- ' "vatrate":20,\n' +
- ' "priceWithVat":72,\n' +
- ' "unitName":"tk",\n' +
- ' "brandName":null,\n' +
- ' "seriesName":"Vaikimisi seeria",\n' +
- ' "groupName":"clothes",\n' +
- ' "supplierName":null,\n' +
- ' "categoryID":1,\n' +
- ' "categoryName":"Vaikimisi seeria",\n' +
- ' "status":"ACTIVE",\n' +
- ' "taxFree":0,\n' +
- ' "backbarCharges":0,\n' +
- ' "isRegularGiftCard":0,\n' +
- ' "cashierMustEnterPrice":0,\n' +
- ' "nonStockProduct":0,\n' +
- ' "rewardPointsNotAllowed":0,\n' +
- ' "longAttributes":[\n' +
- '\n' +
- ' ],\n' +
- ' "variationDescription":[\n' +
- ' {\n' +
- ' "name":"Size",\n' +
- ' "value":"Small",\n' +
- ' "dimensionID":"8",\n' +
- ' "variationID":15\n' +
- ' },\n' +
- ' {\n' +
- ' "name":"Color",\n' +
- ' "value":"Green",\n' +
- ' "dimensionID":"1",\n' +
- ' "variationID":5\n' +
- ' }\n' +
- ' ],\n' +
- ' "parentProductID":3,\n' +
- ' "type":"PRODUCT"\n' +
- ' }\n' +
- ' ]\n' +
- '}');
- function findMatrixVariationRecords(response) {
- // console.log(response);
- let records = response.records;
- console.log(records);
- let matrixProducts = [];
- records.forEach(item => {
- let isMatrixProduct = item.type === 'MATRIX' && item.productVariations !== undefined;
- if (isMatrixProduct) {
- matrixProducts.push(item.productVariations);
- }
- });
- console.log(matrixProducts);
- // let variations = item.productVariations;
- // console.log(records);
- matrixProducts.sort((a, b) => {
- console.log(a + " " + b);
- // console.log(variations);
- // console.log(records[a - 1].variationDescription);
- let firstID = records[a - 1].variationDescription[0].variationID;
- let secondID = records[b - 1].variationDescription[0].variationID;
- if (firstID < secondID) {
- let temp = records[a - 1];
- records[a - 1] = records[b - 1];
- records[b - 1] = temp;
- console.log("Switching: " + (a-1) + " and " + (b - 1));
- }
- });
- // console.log(matrixProducts);
- return records;
- }
- function main() {
- let result = findMatrixVariationRecords(dang);
- console.log(result);
- }
- main();
Add Comment
Please, Sign In to add comment