Guest User

Untitled

a guest
Jun 20th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.64 KB | None | 0 0
  1. let dang = JSON.parse('{\n' +
  2. ' "status":{\n' +
  3. ' "request":"getProducts",\n' +
  4. ' "requestUnixTime":1529340735,\n' +
  5. ' "responseStatus":"ok",\n' +
  6. ' "errorCode":0,\n' +
  7. ' "generationTime":0.13909101486206,\n' +
  8. ' "recordsTotal":11,\n' +
  9. ' "recordsInResponse":11\n' +
  10. ' },\n' +
  11. ' "records":[\n' +
  12. ' {\n' +
  13. ' "productID":1,\n' +
  14. ' "name":"N\u00e4idistoode",\n' +
  15. ' "code":"001",\n' +
  16. ' "code2":"3711234567890",\n' +
  17. ' "code3":"",\n' +
  18. ' "supplierCode":"",\n' +
  19. ' "groupID":1,\n' +
  20. ' "price":10,\n' +
  21. ' "active":1,\n' +
  22. ' "displayedInWebshop":1,\n' +
  23. ' "seriesID":1,\n' +
  24. ' "supplierID":0,\n' +
  25. ' "unitID":1,\n' +
  26. ' "vatrateID":1,\n' +
  27. ' "hasQuickSelectButton":1,\n' +
  28. ' "isGiftCard":0,\n' +
  29. ' "manufacturerName":"",\n' +
  30. ' "priorityGroupID":"0",\n' +
  31. ' "countryOfOriginID":"46",\n' +
  32. ' "brandID":0,\n' +
  33. ' "length":"180",\n' +
  34. ' "width":"180",\n' +
  35. ' "height":"65",\n' +
  36. ' "netWeight":"0.25",\n' +
  37. ' "grossWeight":"0.34",\n' +
  38. ' "volume":"250",\n' +
  39. ' "locationInWarehouseID":"0",\n' +
  40. ' "locationInWarehouseName":"",\n' +
  41. ' "locationInWarehouseText":"",\n' +
  42. ' "description":"",\n' +
  43. ' "longdesc":"",\n' +
  44. ' "descriptionENG":"",\n' +
  45. ' "longdescENG":"",\n' +
  46. ' "descriptionRUS":"",\n' +
  47. ' "longdescRUS":"",\n' +
  48. ' "descriptionFIN":"",\n' +
  49. ' "longdescFIN":"",\n' +
  50. ' "containerID":0,\n' +
  51. ' "cost":0,\n' +
  52. ' "added":0,\n' +
  53. ' "addedByUsername":"",\n' +
  54. ' "lastModified":1529327949,\n' +
  55. ' "lastModifiedByUsername":"karli.udso@erply",\n' +
  56. ' "vatrate":20,\n' +
  57. ' "priceWithVat":12,\n' +
  58. ' "unitName":"tk",\n' +
  59. ' "brandName":null,\n' +
  60. ' "seriesName":"Vaikimisi seeria",\n' +
  61. ' "groupName":"Vaikimisi grupp",\n' +
  62. ' "supplierName":null,\n' +
  63. ' "categoryID":1,\n' +
  64. ' "categoryName":"Vaikimisi seeria",\n' +
  65. ' "status":"ACTIVE",\n' +
  66. ' "taxFree":0,\n' +
  67. ' "backbarCharges":0,\n' +
  68. ' "isRegularGiftCard":0,\n' +
  69. ' "cashierMustEnterPrice":0,\n' +
  70. ' "nonStockProduct":0,\n' +
  71. ' "rewardPointsNotAllowed":0,\n' +
  72. ' "longAttributes":[\n' +
  73. '\n' +
  74. ' ],\n' +
  75. ' "type":"MATRIX"\n' +
  76. ' },\n' +
  77. ' {\n' +
  78. ' "productID":2,\n' +
  79. ' "name":"toode_1",\n' +
  80. ' "code":"2",\n' +
  81. ' "code2":"",\n' +
  82. ' "code3":"",\n' +
  83. ' "supplierCode":"",\n' +
  84. ' "groupID":1,\n' +
  85. ' "price":25,\n' +
  86. ' "active":1,\n' +
  87. ' "displayedInWebshop":1,\n' +
  88. ' "seriesID":0,\n' +
  89. ' "supplierID":0,\n' +
  90. ' "unitID":0,\n' +
  91. ' "vatrateID":1,\n' +
  92. ' "hasQuickSelectButton":0,\n' +
  93. ' "isGiftCard":0,\n' +
  94. ' "manufacturerName":"",\n' +
  95. ' "priorityGroupID":"0",\n' +
  96. ' "countryOfOriginID":"0",\n' +
  97. ' "brandID":0,\n' +
  98. ' "length":"0",\n' +
  99. ' "width":"0",\n' +
  100. ' "height":"0",\n' +
  101. ' "netWeight":"",\n' +
  102. ' "grossWeight":"0",\n' +
  103. ' "volume":"0",\n' +
  104. ' "locationInWarehouseID":"0",\n' +
  105. ' "locationInWarehouseName":"",\n' +
  106. ' "locationInWarehouseText":"",\n' +
  107. ' "description":"",\n' +
  108. ' "longdesc":"",\n' +
  109. ' "descriptionENG":"",\n' +
  110. ' "longdescENG":"",\n' +
  111. ' "descriptionRUS":"",\n' +
  112. ' "longdescRUS":"",\n' +
  113. ' "descriptionFIN":"",\n' +
  114. ' "longdescFIN":"",\n' +
  115. ' "containerID":0,\n' +
  116. ' "cost":0,\n' +
  117. ' "added":1529325214,\n' +
  118. ' "addedByUsername":"karli.udso@erply",\n' +
  119. ' "lastModified":1529327949,\n' +
  120. ' "lastModifiedByUsername":"karli.udso@erply",\n' +
  121. ' "vatrate":20,\n' +
  122. ' "priceWithVat":30,\n' +
  123. ' "unitName":null,\n' +
  124. ' "brandName":null,\n' +
  125. ' "seriesName":null,\n' +
  126. ' "groupName":"Vaikimisi grupp",\n' +
  127. ' "supplierName":null,\n' +
  128. ' "categoryID":0,\n' +
  129. ' "categoryName":null,\n' +
  130. ' "status":"ACTIVE",\n' +
  131. ' "taxFree":0,\n' +
  132. ' "backbarCharges":0,\n' +
  133. ' "isRegularGiftCard":0,\n' +
  134. ' "cashierMustEnterPrice":0,\n' +
  135. ' "nonStockProduct":0,\n' +
  136. ' "rewardPointsNotAllowed":0,\n' +
  137. ' "longAttributes":[\n' +
  138. '\n' +
  139. ' ],\n' +
  140. ' "type":"MATRIX"\n' +
  141. ' },\n' +
  142. ' {\n' +
  143. ' "productID":3,\n' +
  144. ' "name":"t-shirt",\n' +
  145. ' "code":"3",\n' +
  146. ' "code2":"",\n' +
  147. ' "code3":"",\n' +
  148. ' "supplierCode":"",\n' +
  149. ' "groupID":2,\n' +
  150. ' "price":60,\n' +
  151. ' "active":1,\n' +
  152. ' "displayedInWebshop":1,\n' +
  153. ' "seriesID":1,\n' +
  154. ' "supplierID":0,\n' +
  155. ' "unitID":1,\n' +
  156. ' "vatrateID":1,\n' +
  157. ' "hasQuickSelectButton":0,\n' +
  158. ' "isGiftCard":0,\n' +
  159. ' "manufacturerName":"",\n' +
  160. ' "priorityGroupID":"1",\n' +
  161. ' "countryOfOriginID":"47",\n' +
  162. ' "brandID":0,\n' +
  163. ' "length":"0",\n' +
  164. ' "width":"0",\n' +
  165. ' "height":"0",\n' +
  166. ' "netWeight":"",\n' +
  167. ' "grossWeight":"0",\n' +
  168. ' "volume":"0",\n' +
  169. ' "locationInWarehouseID":"0",\n' +
  170. ' "locationInWarehouseName":"",\n' +
  171. ' "locationInWarehouseText":"",\n' +
  172. ' "description":"",\n' +
  173. ' "longdesc":"",\n' +
  174. ' "descriptionENG":"",\n' +
  175. ' "longdescENG":"",\n' +
  176. ' "descriptionRUS":"",\n' +
  177. ' "longdescRUS":"",\n' +
  178. ' "descriptionFIN":"",\n' +
  179. ' "longdescFIN":"",\n' +
  180. ' "containerID":0,\n' +
  181. ' "cost":0,\n' +
  182. ' "added":1529328260,\n' +
  183. ' "addedByUsername":"karli.udso@erply",\n' +
  184. ' "lastModified":0,\n' +
  185. ' "lastModifiedByUsername":"",\n' +
  186. ' "vatrate":20,\n' +
  187. ' "priceWithVat":72,\n' +
  188. ' "unitName":"tk",\n' +
  189. ' "brandName":null,\n' +
  190. ' "seriesName":"Vaikimisi seeria",\n' +
  191. ' "groupName":"clothes",\n' +
  192. ' "supplierName":null,\n' +
  193. ' "categoryID":1,\n' +
  194. ' "categoryName":"Vaikimisi seeria",\n' +
  195. ' "status":"ACTIVE",\n' +
  196. ' "taxFree":0,\n' +
  197. ' "backbarCharges":0,\n' +
  198. ' "isRegularGiftCard":0,\n' +
  199. ' "cashierMustEnterPrice":0,\n' +
  200. ' "nonStockProduct":0,\n' +
  201. ' "rewardPointsNotAllowed":0,\n' +
  202. ' "longAttributes":[\n' +
  203. '\n' +
  204. ' ],\n' +
  205. ' "productVariations":[\n' +
  206. ' "4",\n' +
  207. ' "5",\n' +
  208. ' "6",\n' +
  209. ' "7",\n' +
  210. ' "8",\n' +
  211. ' "9",\n' +
  212. ' "10",\n' +
  213. ' "11"\n' +
  214. ' ],\n' +
  215. ' "variationList":[\n' +
  216. ' {\n' +
  217. ' "productID":"4",\n' +
  218. ' "name":"t-shirt Extra large Red",\n' +
  219. ' "code":"3-XL-red",\n' +
  220. ' "code2":null,\n' +
  221. ' "dimensions":[\n' +
  222. ' {\n' +
  223. ' "name":"Size",\n' +
  224. ' "value":"Extra large",\n' +
  225. ' "code":"XL",\n' +
  226. ' "dimensionID":"8",\n' +
  227. ' "dimensionValueID":16\n' +
  228. ' },\n' +
  229. ' {\n' +
  230. ' "name":"Color",\n' +
  231. ' "value":"Red",\n' +
  232. ' "code":"red",\n' +
  233. ' "dimensionID":"1",\n' +
  234. ' "dimensionValueID":2\n' +
  235. ' }\n' +
  236. ' ]\n' +
  237. ' },\n' +
  238. ' {\n' +
  239. ' "productID":"5",\n' +
  240. ' "name":"t-shirt Extra large Green",\n' +
  241. ' "code":"3-XL-green",\n' +
  242. ' "code2":null,\n' +
  243. ' "dimensions":[\n' +
  244. ' {\n' +
  245. ' "name":"Size",\n' +
  246. ' "value":"Extra large",\n' +
  247. ' "code":"XL",\n' +
  248. ' "dimensionID":"8",\n' +
  249. ' "dimensionValueID":16\n' +
  250. ' },\n' +
  251. ' {\n' +
  252. ' "name":"Color",\n' +
  253. ' "value":"Green",\n' +
  254. ' "code":"green",\n' +
  255. ' "dimensionID":"1",\n' +
  256. ' "dimensionValueID":5\n' +
  257. ' }\n' +
  258. ' ]\n' +
  259. ' },\n' +
  260. ' {\n' +
  261. ' "productID":"6",\n' +
  262. ' "name":"t-shirt Large Red",\n' +
  263. ' "code":"3-L-red",\n' +
  264. ' "code2":null,\n' +
  265. ' "dimensions":[\n' +
  266. ' {\n' +
  267. ' "name":"Size",\n' +
  268. ' "value":"Large",\n' +
  269. ' "code":"L",\n' +
  270. ' "dimensionID":"8",\n' +
  271. ' "dimensionValueID":9\n' +
  272. ' },\n' +
  273. ' {\n' +
  274. ' "name":"Color",\n' +
  275. ' "value":"Red",\n' +
  276. ' "code":"red",\n' +
  277. ' "dimensionID":"1",\n' +
  278. ' "dimensionValueID":2\n' +
  279. ' }\n' +
  280. ' ]\n' +
  281. ' },\n' +
  282. ' {\n' +
  283. ' "productID":"7",\n' +
  284. ' "name":"t-shirt Large Green",\n' +
  285. ' "code":"3-L-green",\n' +
  286. ' "code2":null,\n' +
  287. ' "dimensions":[\n' +
  288. ' {\n' +
  289. ' "name":"Size",\n' +
  290. ' "value":"Large",\n' +
  291. ' "code":"L",\n' +
  292. ' "dimensionID":"8",\n' +
  293. ' "dimensionValueID":9\n' +
  294. ' },\n' +
  295. ' {\n' +
  296. ' "name":"Color",\n' +
  297. ' "value":"Green",\n' +
  298. ' "code":"green",\n' +
  299. ' "dimensionID":"1",\n' +
  300. ' "dimensionValueID":5\n' +
  301. ' }\n' +
  302. ' ]\n' +
  303. ' },\n' +
  304. ' {\n' +
  305. ' "productID":"8",\n' +
  306. ' "name":"t-shirt Medium Red",\n' +
  307. ' "code":"3-M-red",\n' +
  308. ' "code2":null,\n' +
  309. ' "dimensions":[\n' +
  310. ' {\n' +
  311. ' "name":"Size",\n' +
  312. ' "value":"Medium",\n' +
  313. ' "code":"M",\n' +
  314. ' "dimensionID":"8",\n' +
  315. ' "dimensionValueID":12\n' +
  316. ' },\n' +
  317. ' {\n' +
  318. ' "name":"Color",\n' +
  319. ' "value":"Red",\n' +
  320. ' "code":"red",\n' +
  321. ' "dimensionID":"1",\n' +
  322. ' "dimensionValueID":2\n' +
  323. ' }\n' +
  324. ' ]\n' +
  325. ' },\n' +
  326. ' {\n' +
  327. ' "productID":"9",\n' +
  328. ' "name":"t-shirt Medium Green",\n' +
  329. ' "code":"3-M-green",\n' +
  330. ' "code2":null,\n' +
  331. ' "dimensions":[\n' +
  332. ' {\n' +
  333. ' "name":"Size",\n' +
  334. ' "value":"Medium",\n' +
  335. ' "code":"M",\n' +
  336. ' "dimensionID":"8",\n' +
  337. ' "dimensionValueID":12\n' +
  338. ' },\n' +
  339. ' {\n' +
  340. ' "name":"Color",\n' +
  341. ' "value":"Green",\n' +
  342. ' "code":"green",\n' +
  343. ' "dimensionID":"1",\n' +
  344. ' "dimensionValueID":5\n' +
  345. ' }\n' +
  346. ' ]\n' +
  347. ' },\n' +
  348. ' {\n' +
  349. ' "productID":"10",\n' +
  350. ' "name":"t-shirt Small Red",\n' +
  351. ' "code":"3-S-red",\n' +
  352. ' "code2":null,\n' +
  353. ' "dimensions":[\n' +
  354. ' {\n' +
  355. ' "name":"Size",\n' +
  356. ' "value":"Small",\n' +
  357. ' "code":"S",\n' +
  358. ' "dimensionID":"8",\n' +
  359. ' "dimensionValueID":15\n' +
  360. ' },\n' +
  361. ' {\n' +
  362. ' "name":"Color",\n' +
  363. ' "value":"Red",\n' +
  364. ' "code":"red",\n' +
  365. ' "dimensionID":"1",\n' +
  366. ' "dimensionValueID":2\n' +
  367. ' }\n' +
  368. ' ]\n' +
  369. ' },\n' +
  370. ' {\n' +
  371. ' "productID":"11",\n' +
  372. ' "name":"t-shirt Small Green",\n' +
  373. ' "code":"3-S-green",\n' +
  374. ' "code2":null,\n' +
  375. ' "dimensions":[\n' +
  376. ' {\n' +
  377. ' "name":"Size",\n' +
  378. ' "value":"Small",\n' +
  379. ' "code":"S",\n' +
  380. ' "dimensionID":"8",\n' +
  381. ' "dimensionValueID":15\n' +
  382. ' },\n' +
  383. ' {\n' +
  384. ' "name":"Color",\n' +
  385. ' "value":"Green",\n' +
  386. ' "code":"green",\n' +
  387. ' "dimensionID":"1",\n' +
  388. ' "dimensionValueID":5\n' +
  389. ' }\n' +
  390. ' ]\n' +
  391. ' }\n' +
  392. ' ],\n' +
  393. ' "type":"MATRIX"\n' +
  394. ' },\n' +
  395. ' {\n' +
  396. ' "productID":4,\n' +
  397. ' "name":"t-shirt Extra large Red",\n' +
  398. ' "code":"3-XL-red",\n' +
  399. ' "code2":null,\n' +
  400. ' "code3":null,\n' +
  401. ' "supplierCode":null,\n' +
  402. ' "groupID":2,\n' +
  403. ' "price":60,\n' +
  404. ' "active":1,\n' +
  405. ' "displayedInWebshop":1,\n' +
  406. ' "seriesID":1,\n' +
  407. ' "supplierID":0,\n' +
  408. ' "unitID":1,\n' +
  409. ' "vatrateID":1,\n' +
  410. ' "hasQuickSelectButton":0,\n' +
  411. ' "isGiftCard":0,\n' +
  412. ' "manufacturerName":"",\n' +
  413. ' "priorityGroupID":"1",\n' +
  414. ' "countryOfOriginID":"47",\n' +
  415. ' "brandID":0,\n' +
  416. ' "length":"0",\n' +
  417. ' "width":"0",\n' +
  418. ' "height":"0",\n' +
  419. ' "netWeight":"",\n' +
  420. ' "grossWeight":"0",\n' +
  421. ' "volume":"0",\n' +
  422. ' "locationInWarehouseID":"0",\n' +
  423. ' "locationInWarehouseName":"",\n' +
  424. ' "locationInWarehouseText":"",\n' +
  425. ' "description":"",\n' +
  426. ' "longdesc":"",\n' +
  427. ' "descriptionENG":"",\n' +
  428. ' "longdescENG":"",\n' +
  429. ' "descriptionRUS":"",\n' +
  430. ' "longdescRUS":"",\n' +
  431. ' "descriptionFIN":"",\n' +
  432. ' "longdescFIN":"",\n' +
  433. ' "containerID":0,\n' +
  434. ' "cost":0,\n' +
  435. ' "added":1529329812,\n' +
  436. ' "addedByUsername":"karli.udso@erply",\n' +
  437. ' "lastModified":0,\n' +
  438. ' "lastModifiedByUsername":"",\n' +
  439. ' "vatrate":20,\n' +
  440. ' "priceWithVat":72,\n' +
  441. ' "unitName":"tk",\n' +
  442. ' "brandName":null,\n' +
  443. ' "seriesName":"Vaikimisi seeria",\n' +
  444. ' "groupName":"clothes",\n' +
  445. ' "supplierName":null,\n' +
  446. ' "categoryID":1,\n' +
  447. ' "categoryName":"Vaikimisi seeria",\n' +
  448. ' "status":"ACTIVE",\n' +
  449. ' "taxFree":0,\n' +
  450. ' "backbarCharges":0,\n' +
  451. ' "isRegularGiftCard":0,\n' +
  452. ' "cashierMustEnterPrice":0,\n' +
  453. ' "nonStockProduct":0,\n' +
  454. ' "rewardPointsNotAllowed":0,\n' +
  455. ' "longAttributes":[\n' +
  456. '\n' +
  457. ' ],\n' +
  458. ' "variationDescription":[\n' +
  459. ' {\n' +
  460. ' "name":"Size",\n' +
  461. ' "value":"Extra large",\n' +
  462. ' "dimensionID":"8",\n' +
  463. ' "variationID":16\n' +
  464. ' },\n' +
  465. ' {\n' +
  466. ' "name":"Color",\n' +
  467. ' "value":"Red",\n' +
  468. ' "dimensionID":"1",\n' +
  469. ' "variationID":2\n' +
  470. ' }\n' +
  471. ' ],\n' +
  472. ' "parentProductID":3,\n' +
  473. ' "type":"PRODUCT"\n' +
  474. ' },\n' +
  475. ' {\n' +
  476. ' "productID":5,\n' +
  477. ' "name":"t-shirt Extra large Green",\n' +
  478. ' "code":"3-XL-green",\n' +
  479. ' "code2":null,\n' +
  480. ' "code3":null,\n' +
  481. ' "supplierCode":null,\n' +
  482. ' "groupID":2,\n' +
  483. ' "price":60,\n' +
  484. ' "active":1,\n' +
  485. ' "displayedInWebshop":1,\n' +
  486. ' "seriesID":1,\n' +
  487. ' "supplierID":0,\n' +
  488. ' "unitID":1,\n' +
  489. ' "vatrateID":1,\n' +
  490. ' "hasQuickSelectButton":0,\n' +
  491. ' "isGiftCard":0,\n' +
  492. ' "manufacturerName":"",\n' +
  493. ' "priorityGroupID":"1",\n' +
  494. ' "countryOfOriginID":"47",\n' +
  495. ' "brandID":0,\n' +
  496. ' "length":"0",\n' +
  497. ' "width":"0",\n' +
  498. ' "height":"0",\n' +
  499. ' "netWeight":"",\n' +
  500. ' "grossWeight":"0",\n' +
  501. ' "volume":"0",\n' +
  502. ' "locationInWarehouseID":"0",\n' +
  503. ' "locationInWarehouseName":"",\n' +
  504. ' "locationInWarehouseText":"",\n' +
  505. ' "description":"",\n' +
  506. ' "longdesc":"",\n' +
  507. ' "descriptionENG":"",\n' +
  508. ' "longdescENG":"",\n' +
  509. ' "descriptionRUS":"",\n' +
  510. ' "longdescRUS":"",\n' +
  511. ' "descriptionFIN":"",\n' +
  512. ' "longdescFIN":"",\n' +
  513. ' "containerID":0,\n' +
  514. ' "cost":0,\n' +
  515. ' "added":1529329812,\n' +
  516. ' "addedByUsername":"karli.udso@erply",\n' +
  517. ' "lastModified":0,\n' +
  518. ' "lastModifiedByUsername":"",\n' +
  519. ' "vatrate":20,\n' +
  520. ' "priceWithVat":72,\n' +
  521. ' "unitName":"tk",\n' +
  522. ' "brandName":null,\n' +
  523. ' "seriesName":"Vaikimisi seeria",\n' +
  524. ' "groupName":"clothes",\n' +
  525. ' "supplierName":null,\n' +
  526. ' "categoryID":1,\n' +
  527. ' "categoryName":"Vaikimisi seeria",\n' +
  528. ' "status":"ACTIVE",\n' +
  529. ' "taxFree":0,\n' +
  530. ' "backbarCharges":0,\n' +
  531. ' "isRegularGiftCard":0,\n' +
  532. ' "cashierMustEnterPrice":0,\n' +
  533. ' "nonStockProduct":0,\n' +
  534. ' "rewardPointsNotAllowed":0,\n' +
  535. ' "longAttributes":[\n' +
  536. '\n' +
  537. ' ],\n' +
  538. ' "variationDescription":[\n' +
  539. ' {\n' +
  540. ' "name":"Size",\n' +
  541. ' "value":"Extra large",\n' +
  542. ' "dimensionID":"8",\n' +
  543. ' "variationID":16\n' +
  544. ' },\n' +
  545. ' {\n' +
  546. ' "name":"Color",\n' +
  547. ' "value":"Green",\n' +
  548. ' "dimensionID":"1",\n' +
  549. ' "variationID":5\n' +
  550. ' }\n' +
  551. ' ],\n' +
  552. ' "parentProductID":3,\n' +
  553. ' "type":"PRODUCT"\n' +
  554. ' },\n' +
  555. ' {\n' +
  556. ' "productID":6,\n' +
  557. ' "name":"t-shirt Large Red",\n' +
  558. ' "code":"3-L-red",\n' +
  559. ' "code2":null,\n' +
  560. ' "code3":null,\n' +
  561. ' "supplierCode":null,\n' +
  562. ' "groupID":2,\n' +
  563. ' "price":60,\n' +
  564. ' "active":1,\n' +
  565. ' "displayedInWebshop":1,\n' +
  566. ' "seriesID":1,\n' +
  567. ' "supplierID":0,\n' +
  568. ' "unitID":1,\n' +
  569. ' "vatrateID":1,\n' +
  570. ' "hasQuickSelectButton":0,\n' +
  571. ' "isGiftCard":0,\n' +
  572. ' "manufacturerName":"",\n' +
  573. ' "priorityGroupID":"1",\n' +
  574. ' "countryOfOriginID":"47",\n' +
  575. ' "brandID":0,\n' +
  576. ' "length":"0",\n' +
  577. ' "width":"0",\n' +
  578. ' "height":"0",\n' +
  579. ' "netWeight":"",\n' +
  580. ' "grossWeight":"0",\n' +
  581. ' "volume":"0",\n' +
  582. ' "locationInWarehouseID":"0",\n' +
  583. ' "locationInWarehouseName":"",\n' +
  584. ' "locationInWarehouseText":"",\n' +
  585. ' "description":"",\n' +
  586. ' "longdesc":"",\n' +
  587. ' "descriptionENG":"",\n' +
  588. ' "longdescENG":"",\n' +
  589. ' "descriptionRUS":"",\n' +
  590. ' "longdescRUS":"",\n' +
  591. ' "descriptionFIN":"",\n' +
  592. ' "longdescFIN":"",\n' +
  593. ' "containerID":0,\n' +
  594. ' "cost":0,\n' +
  595. ' "added":1529329812,\n' +
  596. ' "addedByUsername":"karli.udso@erply",\n' +
  597. ' "lastModified":0,\n' +
  598. ' "lastModifiedByUsername":"",\n' +
  599. ' "vatrate":20,\n' +
  600. ' "priceWithVat":72,\n' +
  601. ' "unitName":"tk",\n' +
  602. ' "brandName":null,\n' +
  603. ' "seriesName":"Vaikimisi seeria",\n' +
  604. ' "groupName":"clothes",\n' +
  605. ' "supplierName":null,\n' +
  606. ' "categoryID":1,\n' +
  607. ' "categoryName":"Vaikimisi seeria",\n' +
  608. ' "status":"ACTIVE",\n' +
  609. ' "taxFree":0,\n' +
  610. ' "backbarCharges":0,\n' +
  611. ' "isRegularGiftCard":0,\n' +
  612. ' "cashierMustEnterPrice":0,\n' +
  613. ' "nonStockProduct":0,\n' +
  614. ' "rewardPointsNotAllowed":0,\n' +
  615. ' "longAttributes":[\n' +
  616. '\n' +
  617. ' ],\n' +
  618. ' "variationDescription":[\n' +
  619. ' {\n' +
  620. ' "name":"Size",\n' +
  621. ' "value":"Large",\n' +
  622. ' "dimensionID":"8",\n' +
  623. ' "variationID":9\n' +
  624. ' },\n' +
  625. ' {\n' +
  626. ' "name":"Color",\n' +
  627. ' "value":"Red",\n' +
  628. ' "dimensionID":"1",\n' +
  629. ' "variationID":2\n' +
  630. ' }\n' +
  631. ' ],\n' +
  632. ' "parentProductID":3,\n' +
  633. ' "type":"PRODUCT"\n' +
  634. ' },\n' +
  635. ' {\n' +
  636. ' "productID":7,\n' +
  637. ' "name":"t-shirt Large Green",\n' +
  638. ' "code":"3-L-green",\n' +
  639. ' "code2":null,\n' +
  640. ' "code3":null,\n' +
  641. ' "supplierCode":null,\n' +
  642. ' "groupID":2,\n' +
  643. ' "price":60,\n' +
  644. ' "active":1,\n' +
  645. ' "displayedInWebshop":1,\n' +
  646. ' "seriesID":1,\n' +
  647. ' "supplierID":0,\n' +
  648. ' "unitID":1,\n' +
  649. ' "vatrateID":1,\n' +
  650. ' "hasQuickSelectButton":0,\n' +
  651. ' "isGiftCard":0,\n' +
  652. ' "manufacturerName":"",\n' +
  653. ' "priorityGroupID":"1",\n' +
  654. ' "countryOfOriginID":"47",\n' +
  655. ' "brandID":0,\n' +
  656. ' "length":"0",\n' +
  657. ' "width":"0",\n' +
  658. ' "height":"0",\n' +
  659. ' "netWeight":"",\n' +
  660. ' "grossWeight":"0",\n' +
  661. ' "volume":"0",\n' +
  662. ' "locationInWarehouseID":"0",\n' +
  663. ' "locationInWarehouseName":"",\n' +
  664. ' "locationInWarehouseText":"",\n' +
  665. ' "description":"",\n' +
  666. ' "longdesc":"",\n' +
  667. ' "descriptionENG":"",\n' +
  668. ' "longdescENG":"",\n' +
  669. ' "descriptionRUS":"",\n' +
  670. ' "longdescRUS":"",\n' +
  671. ' "descriptionFIN":"",\n' +
  672. ' "longdescFIN":"",\n' +
  673. ' "containerID":0,\n' +
  674. ' "cost":0,\n' +
  675. ' "added":1529329812,\n' +
  676. ' "addedByUsername":"karli.udso@erply",\n' +
  677. ' "lastModified":0,\n' +
  678. ' "lastModifiedByUsername":"",\n' +
  679. ' "vatrate":20,\n' +
  680. ' "priceWithVat":72,\n' +
  681. ' "unitName":"tk",\n' +
  682. ' "brandName":null,\n' +
  683. ' "seriesName":"Vaikimisi seeria",\n' +
  684. ' "groupName":"clothes",\n' +
  685. ' "supplierName":null,\n' +
  686. ' "categoryID":1,\n' +
  687. ' "categoryName":"Vaikimisi seeria",\n' +
  688. ' "status":"ACTIVE",\n' +
  689. ' "taxFree":0,\n' +
  690. ' "backbarCharges":0,\n' +
  691. ' "isRegularGiftCard":0,\n' +
  692. ' "cashierMustEnterPrice":0,\n' +
  693. ' "nonStockProduct":0,\n' +
  694. ' "rewardPointsNotAllowed":0,\n' +
  695. ' "longAttributes":[\n' +
  696. '\n' +
  697. ' ],\n' +
  698. ' "variationDescription":[\n' +
  699. ' {\n' +
  700. ' "name":"Size",\n' +
  701. ' "value":"Large",\n' +
  702. ' "dimensionID":"8",\n' +
  703. ' "variationID":9\n' +
  704. ' },\n' +
  705. ' {\n' +
  706. ' "name":"Color",\n' +
  707. ' "value":"Green",\n' +
  708. ' "dimensionID":"1",\n' +
  709. ' "variationID":5\n' +
  710. ' }\n' +
  711. ' ],\n' +
  712. ' "parentProductID":3,\n' +
  713. ' "type":"PRODUCT"\n' +
  714. ' },\n' +
  715. ' {\n' +
  716. ' "productID":8,\n' +
  717. ' "name":"t-shirt Medium Red",\n' +
  718. ' "code":"3-M-red",\n' +
  719. ' "code2":null,\n' +
  720. ' "code3":null,\n' +
  721. ' "supplierCode":null,\n' +
  722. ' "groupID":2,\n' +
  723. ' "price":60,\n' +
  724. ' "active":1,\n' +
  725. ' "displayedInWebshop":1,\n' +
  726. ' "seriesID":1,\n' +
  727. ' "supplierID":0,\n' +
  728. ' "unitID":1,\n' +
  729. ' "vatrateID":1,\n' +
  730. ' "hasQuickSelectButton":0,\n' +
  731. ' "isGiftCard":0,\n' +
  732. ' "manufacturerName":"",\n' +
  733. ' "priorityGroupID":"1",\n' +
  734. ' "countryOfOriginID":"47",\n' +
  735. ' "brandID":0,\n' +
  736. ' "length":"0",\n' +
  737. ' "width":"0",\n' +
  738. ' "height":"0",\n' +
  739. ' "netWeight":"",\n' +
  740. ' "grossWeight":"0",\n' +
  741. ' "volume":"0",\n' +
  742. ' "locationInWarehouseID":"0",\n' +
  743. ' "locationInWarehouseName":"",\n' +
  744. ' "locationInWarehouseText":"",\n' +
  745. ' "description":"",\n' +
  746. ' "longdesc":"",\n' +
  747. ' "descriptionENG":"",\n' +
  748. ' "longdescENG":"",\n' +
  749. ' "descriptionRUS":"",\n' +
  750. ' "longdescRUS":"",\n' +
  751. ' "descriptionFIN":"",\n' +
  752. ' "longdescFIN":"",\n' +
  753. ' "containerID":0,\n' +
  754. ' "cost":0,\n' +
  755. ' "added":1529329812,\n' +
  756. ' "addedByUsername":"karli.udso@erply",\n' +
  757. ' "lastModified":0,\n' +
  758. ' "lastModifiedByUsername":"",\n' +
  759. ' "vatrate":20,\n' +
  760. ' "priceWithVat":72,\n' +
  761. ' "unitName":"tk",\n' +
  762. ' "brandName":null,\n' +
  763. ' "seriesName":"Vaikimisi seeria",\n' +
  764. ' "groupName":"clothes",\n' +
  765. ' "supplierName":null,\n' +
  766. ' "categoryID":1,\n' +
  767. ' "categoryName":"Vaikimisi seeria",\n' +
  768. ' "status":"ACTIVE",\n' +
  769. ' "taxFree":0,\n' +
  770. ' "backbarCharges":0,\n' +
  771. ' "isRegularGiftCard":0,\n' +
  772. ' "cashierMustEnterPrice":0,\n' +
  773. ' "nonStockProduct":0,\n' +
  774. ' "rewardPointsNotAllowed":0,\n' +
  775. ' "longAttributes":[\n' +
  776. '\n' +
  777. ' ],\n' +
  778. ' "variationDescription":[\n' +
  779. ' {\n' +
  780. ' "name":"Size",\n' +
  781. ' "value":"Medium",\n' +
  782. ' "dimensionID":"8",\n' +
  783. ' "variationID":12\n' +
  784. ' },\n' +
  785. ' {\n' +
  786. ' "name":"Color",\n' +
  787. ' "value":"Red",\n' +
  788. ' "dimensionID":"1",\n' +
  789. ' "variationID":2\n' +
  790. ' }\n' +
  791. ' ],\n' +
  792. ' "parentProductID":3,\n' +
  793. ' "type":"PRODUCT"\n' +
  794. ' },\n' +
  795. ' {\n' +
  796. ' "productID":9,\n' +
  797. ' "name":"t-shirt Medium Green",\n' +
  798. ' "code":"3-M-green",\n' +
  799. ' "code2":null,\n' +
  800. ' "code3":null,\n' +
  801. ' "supplierCode":null,\n' +
  802. ' "groupID":2,\n' +
  803. ' "price":60,\n' +
  804. ' "active":1,\n' +
  805. ' "displayedInWebshop":1,\n' +
  806. ' "seriesID":1,\n' +
  807. ' "supplierID":0,\n' +
  808. ' "unitID":1,\n' +
  809. ' "vatrateID":1,\n' +
  810. ' "hasQuickSelectButton":0,\n' +
  811. ' "isGiftCard":0,\n' +
  812. ' "manufacturerName":"",\n' +
  813. ' "priorityGroupID":"1",\n' +
  814. ' "countryOfOriginID":"47",\n' +
  815. ' "brandID":0,\n' +
  816. ' "length":"0",\n' +
  817. ' "width":"0",\n' +
  818. ' "height":"0",\n' +
  819. ' "netWeight":"",\n' +
  820. ' "grossWeight":"0",\n' +
  821. ' "volume":"0",\n' +
  822. ' "locationInWarehouseID":"0",\n' +
  823. ' "locationInWarehouseName":"",\n' +
  824. ' "locationInWarehouseText":"",\n' +
  825. ' "description":"",\n' +
  826. ' "longdesc":"",\n' +
  827. ' "descriptionENG":"",\n' +
  828. ' "longdescENG":"",\n' +
  829. ' "descriptionRUS":"",\n' +
  830. ' "longdescRUS":"",\n' +
  831. ' "descriptionFIN":"",\n' +
  832. ' "longdescFIN":"",\n' +
  833. ' "containerID":0,\n' +
  834. ' "cost":0,\n' +
  835. ' "added":1529329812,\n' +
  836. ' "addedByUsername":"karli.udso@erply",\n' +
  837. ' "lastModified":0,\n' +
  838. ' "lastModifiedByUsername":"",\n' +
  839. ' "vatrate":20,\n' +
  840. ' "priceWithVat":72,\n' +
  841. ' "unitName":"tk",\n' +
  842. ' "brandName":null,\n' +
  843. ' "seriesName":"Vaikimisi seeria",\n' +
  844. ' "groupName":"clothes",\n' +
  845. ' "supplierName":null,\n' +
  846. ' "categoryID":1,\n' +
  847. ' "categoryName":"Vaikimisi seeria",\n' +
  848. ' "status":"ACTIVE",\n' +
  849. ' "taxFree":0,\n' +
  850. ' "backbarCharges":0,\n' +
  851. ' "isRegularGiftCard":0,\n' +
  852. ' "cashierMustEnterPrice":0,\n' +
  853. ' "nonStockProduct":0,\n' +
  854. ' "rewardPointsNotAllowed":0,\n' +
  855. ' "longAttributes":[\n' +
  856. '\n' +
  857. ' ],\n' +
  858. ' "variationDescription":[\n' +
  859. ' {\n' +
  860. ' "name":"Size",\n' +
  861. ' "value":"Medium",\n' +
  862. ' "dimensionID":"8",\n' +
  863. ' "variationID":12\n' +
  864. ' },\n' +
  865. ' {\n' +
  866. ' "name":"Color",\n' +
  867. ' "value":"Green",\n' +
  868. ' "dimensionID":"1",\n' +
  869. ' "variationID":5\n' +
  870. ' }\n' +
  871. ' ],\n' +
  872. ' "parentProductID":3,\n' +
  873. ' "type":"PRODUCT"\n' +
  874. ' },\n' +
  875. ' {\n' +
  876. ' "productID":10,\n' +
  877. ' "name":"t-shirt Small Red",\n' +
  878. ' "code":"3-S-red",\n' +
  879. ' "code2":null,\n' +
  880. ' "code3":null,\n' +
  881. ' "supplierCode":null,\n' +
  882. ' "groupID":2,\n' +
  883. ' "price":60,\n' +
  884. ' "active":1,\n' +
  885. ' "displayedInWebshop":1,\n' +
  886. ' "seriesID":1,\n' +
  887. ' "supplierID":0,\n' +
  888. ' "unitID":1,\n' +
  889. ' "vatrateID":1,\n' +
  890. ' "hasQuickSelectButton":0,\n' +
  891. ' "isGiftCard":0,\n' +
  892. ' "manufacturerName":"",\n' +
  893. ' "priorityGroupID":"1",\n' +
  894. ' "countryOfOriginID":"47",\n' +
  895. ' "brandID":0,\n' +
  896. ' "length":"0",\n' +
  897. ' "width":"0",\n' +
  898. ' "height":"0",\n' +
  899. ' "netWeight":"",\n' +
  900. ' "grossWeight":"0",\n' +
  901. ' "volume":"0",\n' +
  902. ' "locationInWarehouseID":"0",\n' +
  903. ' "locationInWarehouseName":"",\n' +
  904. ' "locationInWarehouseText":"",\n' +
  905. ' "description":"",\n' +
  906. ' "longdesc":"",\n' +
  907. ' "descriptionENG":"",\n' +
  908. ' "longdescENG":"",\n' +
  909. ' "descriptionRUS":"",\n' +
  910. ' "longdescRUS":"",\n' +
  911. ' "descriptionFIN":"",\n' +
  912. ' "longdescFIN":"",\n' +
  913. ' "containerID":0,\n' +
  914. ' "cost":0,\n' +
  915. ' "added":1529329812,\n' +
  916. ' "addedByUsername":"karli.udso@erply",\n' +
  917. ' "lastModified":0,\n' +
  918. ' "lastModifiedByUsername":"",\n' +
  919. ' "vatrate":20,\n' +
  920. ' "priceWithVat":72,\n' +
  921. ' "unitName":"tk",\n' +
  922. ' "brandName":null,\n' +
  923. ' "seriesName":"Vaikimisi seeria",\n' +
  924. ' "groupName":"clothes",\n' +
  925. ' "supplierName":null,\n' +
  926. ' "categoryID":1,\n' +
  927. ' "categoryName":"Vaikimisi seeria",\n' +
  928. ' "status":"ACTIVE",\n' +
  929. ' "taxFree":0,\n' +
  930. ' "backbarCharges":0,\n' +
  931. ' "isRegularGiftCard":0,\n' +
  932. ' "cashierMustEnterPrice":0,\n' +
  933. ' "nonStockProduct":0,\n' +
  934. ' "rewardPointsNotAllowed":0,\n' +
  935. ' "longAttributes":[\n' +
  936. '\n' +
  937. ' ],\n' +
  938. ' "variationDescription":[\n' +
  939. ' {\n' +
  940. ' "name":"Size",\n' +
  941. ' "value":"Small",\n' +
  942. ' "dimensionID":"8",\n' +
  943. ' "variationID":15\n' +
  944. ' },\n' +
  945. ' {\n' +
  946. ' "name":"Color",\n' +
  947. ' "value":"Red",\n' +
  948. ' "dimensionID":"1",\n' +
  949. ' "variationID":2\n' +
  950. ' }\n' +
  951. ' ],\n' +
  952. ' "parentProductID":3,\n' +
  953. ' "type":"PRODUCT"\n' +
  954. ' },\n' +
  955. ' {\n' +
  956. ' "productID":11,\n' +
  957. ' "name":"t-shirt Small Green",\n' +
  958. ' "code":"3-S-green",\n' +
  959. ' "code2":null,\n' +
  960. ' "code3":null,\n' +
  961. ' "supplierCode":null,\n' +
  962. ' "groupID":2,\n' +
  963. ' "price":60,\n' +
  964. ' "active":1,\n' +
  965. ' "displayedInWebshop":1,\n' +
  966. ' "seriesID":1,\n' +
  967. ' "supplierID":0,\n' +
  968. ' "unitID":1,\n' +
  969. ' "vatrateID":1,\n' +
  970. ' "hasQuickSelectButton":0,\n' +
  971. ' "isGiftCard":0,\n' +
  972. ' "manufacturerName":"",\n' +
  973. ' "priorityGroupID":"1",\n' +
  974. ' "countryOfOriginID":"47",\n' +
  975. ' "brandID":0,\n' +
  976. ' "length":"0",\n' +
  977. ' "width":"0",\n' +
  978. ' "height":"0",\n' +
  979. ' "netWeight":"",\n' +
  980. ' "grossWeight":"0",\n' +
  981. ' "volume":"0",\n' +
  982. ' "locationInWarehouseID":"0",\n' +
  983. ' "locationInWarehouseName":"",\n' +
  984. ' "locationInWarehouseText":"",\n' +
  985. ' "description":"",\n' +
  986. ' "longdesc":"",\n' +
  987. ' "descriptionENG":"",\n' +
  988. ' "longdescENG":"",\n' +
  989. ' "descriptionRUS":"",\n' +
  990. ' "longdescRUS":"",\n' +
  991. ' "descriptionFIN":"",\n' +
  992. ' "longdescFIN":"",\n' +
  993. ' "containerID":0,\n' +
  994. ' "cost":0,\n' +
  995. ' "added":1529329812,\n' +
  996. ' "addedByUsername":"karli.udso@erply",\n' +
  997. ' "lastModified":0,\n' +
  998. ' "lastModifiedByUsername":"",\n' +
  999. ' "vatrate":20,\n' +
  1000. ' "priceWithVat":72,\n' +
  1001. ' "unitName":"tk",\n' +
  1002. ' "brandName":null,\n' +
  1003. ' "seriesName":"Vaikimisi seeria",\n' +
  1004. ' "groupName":"clothes",\n' +
  1005. ' "supplierName":null,\n' +
  1006. ' "categoryID":1,\n' +
  1007. ' "categoryName":"Vaikimisi seeria",\n' +
  1008. ' "status":"ACTIVE",\n' +
  1009. ' "taxFree":0,\n' +
  1010. ' "backbarCharges":0,\n' +
  1011. ' "isRegularGiftCard":0,\n' +
  1012. ' "cashierMustEnterPrice":0,\n' +
  1013. ' "nonStockProduct":0,\n' +
  1014. ' "rewardPointsNotAllowed":0,\n' +
  1015. ' "longAttributes":[\n' +
  1016. '\n' +
  1017. ' ],\n' +
  1018. ' "variationDescription":[\n' +
  1019. ' {\n' +
  1020. ' "name":"Size",\n' +
  1021. ' "value":"Small",\n' +
  1022. ' "dimensionID":"8",\n' +
  1023. ' "variationID":15\n' +
  1024. ' },\n' +
  1025. ' {\n' +
  1026. ' "name":"Color",\n' +
  1027. ' "value":"Green",\n' +
  1028. ' "dimensionID":"1",\n' +
  1029. ' "variationID":5\n' +
  1030. ' }\n' +
  1031. ' ],\n' +
  1032. ' "parentProductID":3,\n' +
  1033. ' "type":"PRODUCT"\n' +
  1034. ' }\n' +
  1035. ' ]\n' +
  1036. '}');
  1037.  
  1038. function findMatrixVariationRecords(response) {
  1039. // console.log(response);
  1040. let records = response.records;
  1041. console.log(records);
  1042. let matrixProducts = [];
  1043. records.forEach(item => {
  1044. let isMatrixProduct = item.type === 'MATRIX' && item.productVariations !== undefined;
  1045. if (isMatrixProduct) {
  1046. matrixProducts.push(item.productVariations);
  1047. }
  1048. });
  1049. console.log(matrixProducts);
  1050. // let variations = item.productVariations;
  1051. // console.log(records);
  1052. matrixProducts.sort((a, b) => {
  1053. console.log(a + " " + b);
  1054. // console.log(variations);
  1055. // console.log(records[a - 1].variationDescription);
  1056. let firstID = records[a - 1].variationDescription[0].variationID;
  1057. let secondID = records[b - 1].variationDescription[0].variationID;
  1058. if (firstID < secondID) {
  1059. let temp = records[a - 1];
  1060. records[a - 1] = records[b - 1];
  1061. records[b - 1] = temp;
  1062. console.log("Switching: " + (a-1) + " and " + (b - 1));
  1063. }
  1064. });
  1065. // console.log(matrixProducts);
  1066. return records;
  1067. }
  1068.  
  1069. function main() {
  1070. let result = findMatrixVariationRecords(dang);
  1071. console.log(result);
  1072. }
  1073.  
  1074. main();
Add Comment
Please, Sign In to add comment