Skip to content

Instantly share code, notes, and snippets.

@neoromantic
Created November 5, 2022 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neoromantic/e92ad036a80655498ea3b390dba2ab55 to your computer and use it in GitHub Desktop.
Save neoromantic/e92ad036a80655498ea3b390dba2ab55 to your computer and use it in GitHub Desktop.
Complicated n8n scenario
{
"meta": {
"instanceId": "09bb93b9311465fc30856fc815d1db514ea3023b64a7c59489f7d87f8a41d339"
},
"nodes": [
{
"parameters": {},
"id": "7561c3c9-92a7-4458-8a58-c3f26c077169",
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
-7880,
1540
]
},
{
"parameters": {
"sinceUpdatedAt": "={{$json[\"since\"]}}"
},
"id": "2f5a7bd6-66e4-4d90-b2e0-44ab0c575ac3",
"name": "Товары из RCRM",
"type": "CUSTOM.retailCrm",
"typeVersion": 1,
"position": [
-5700,
1300
],
"notesInFlow": true,
"credentials": {
"retailCrmApi": {
"id": "2",
"name": "RetailCrm account"
}
},
"notes": "Получаем все товары из RC"
},
{
"parameters": {
"stores": "={{[$json[\"storeName\"]]}}",
"operation": "updateProductPrice",
"productId": "={{ $json[\"id\"] }}",
"productPrice": "={{ $json[\"rcPrice\"] }}"
},
"id": "588db17f-f0cb-477a-a99d-4aa2d5d36de4",
"name": "Меняем цену",
"type": "CUSTOM.ecwid",
"typeVersion": 1,
"position": [
-3240,
580
],
"notesInFlow": true,
"alwaysOutputData": true,
"credentials": {
"ecwidApi": {
"id": "4",
"name": "Ecwid account"
}
},
"notes": "Меняем цену существующего товара"
},
{
"parameters": {
"functionCode": "const stores = [\"msk\", \"spb\", \"am\"]\n\nreturn [{json: {stores}}]"
},
"id": "adaa19a5-9cab-49c6-aa97-a0cbb118ed09",
"name": "Магазины EC",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
-7660,
1420
],
"notesInFlow": true,
"notes": "Список магазинов EC для синхронизации"
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json[\"id\"]}}",
"operation": "isNotEmpty"
}
]
}
},
"id": "3b73fd29-8fe9-4577-8b35-e3ab909bd224",
"name": "Товар есть в EC?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-3840,
1160
]
},
{
"parameters": {
"unit": "minutes"
},
"id": "af731138-ed88-46de-a09c-b165bc6da1ba",
"name": "Interval",
"type": "n8n-nodes-base.interval",
"typeVersion": 1,
"position": [
-7880,
1260
]
},
{
"parameters": {},
"id": "daf1f43c-d159-4799-80ed-2d79da4d1efd",
"name": "NoOp",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
180,
1880
]
},
{
"parameters": {
"functionCode": "const stores = $node[\"Магазины EC\"].json.stores\n\nreturn stores.map(store => ({json: {storeName: store}}))"
},
"id": "a0753790-d482-46f2-a2c8-b0b2e0a819f1",
"name": "Список магазинов",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
-4780,
880
]
},
{
"parameters": {
"mode": "mergeByKey",
"propertyName1": "storeName",
"propertyName2": "storeName"
},
"id": "4310db13-3ad3-41cb-8a54-9ed9aa457103",
"name": "Совмещаем список магазинов",
"type": "n8n-nodes-base.merge",
"typeVersion": 1,
"position": [
-4540,
900
]
},
{
"parameters": {
"mode": "multiplex"
},
"id": "a1e5c194-9814-4139-bd6a-addfc82735fe",
"name": "Совмещаем данные RC/EC",
"type": "n8n-nodes-base.merge",
"typeVersion": 1,
"position": [
-4320,
1160
],
"notesInFlow": false
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json[\"enabled\"] }}",
"operation": "notEqual",
"value2": "={{ $json[\"rcActive\"] }}"
}
]
}
},
"id": "086b9dab-47ec-42d8-bf16-37bb27758783",
"name": "Опубликованность изменилась?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-3220,
940
]
},
{
"parameters": {
"stores": "={{[ $json[\"storeName\"] ]}}",
"operation": "updateProductEnabled",
"productId": "={{ $json[\"id\"] }}",
"productEnabled": "={{ $json[\"rcActive\"] }}"
},
"id": "85a1a546-0816-4574-a234-c58c87dd2ec4",
"name": "Меняем опубликованность",
"type": "CUSTOM.ecwid",
"typeVersion": 1,
"position": [
-2740,
720
],
"notesInFlow": true,
"credentials": {
"ecwidApi": {
"id": "4",
"name": "Ecwid account"
}
},
"notes": "Публикуем/распубликуем существующий товар"
},
{
"parameters": {
"errorMessage": "={{ $json[\"message\"] }}"
},
"id": "0548d3b0-fbde-4357-8507-01aad1b045ed",
"name": "Ошибка изменения цены",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
-3000,
480
]
},
{
"parameters": {
"errorMessage": "={{ $json[\"message\"] }}"
},
"id": "b3439761-76cd-4d29-aec7-5d1cd0c6553c",
"name": "Ошибка изменения опубликованности",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
-2440,
680
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"article\"] }}",
"operation": "isNotEmpty"
}
]
}
},
"id": "d631ad8a-ae11-4465-8707-cd23a2754f58",
"name": "article есть?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-5500,
1300
],
"notesInFlow": true,
"notes": "Фильтруем товары без article"
},
{
"parameters": {
"functionCode": "const result = []\nconst allProperties = $node[\"Объединяем результат\"].json.data\n\nfor (item of items) {\n const itemData = item.json\n // const properties = allProperties.filter(prop => {\n // return itemData.offers.indexOf(offer => !!offer.properties[prop.code])\n // }).map(prop => prop.name)\n\n const properties = allProperties.map(prop => {\n const values = itemData.offers.map(offer => {\n const properties = offer.properties || {}\n return properties[prop.code] || null\n }).filter(val => !!val)\n return values.length === 0 ? null : {\n name: prop.name,\n values\n }\n }).filter(prop => !!prop)\n\n const mappedOffers = itemData.offers.map(offer => {\n return {\n ...offer,\n properties: Object.keys(offer.properties || {}).map(propKey => {\n const prop = allProperties.find(property => property.code === propKey)\n if (!prop) return null\n return {\n code: propKey,\n name: prop.name,\n value: offer.properties[propKey]\n }\n }).filter(el => !!el)\n }\n })\n \n result.push({\n rcId: itemData.id,\n rcOffers: mappedOffers,\n rcPrice: itemData.price,\n rcQuantity: itemData.quantity,\n rcActive: itemData.active,\n rcSku: itemData.article,\n rcProperties: properties,\n rcPrice: itemData.price || itemData.minPrice,\n rcName: itemData.name\n })\n}\n\nreturn result;"
},
"id": "1b448010-59c2-4970-8b01-55fe98100f57",
"name": "Выделяем нужные поля",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
-4660,
1360
],
"notesInFlow": true,
"notes": "Выделяем нужные поля о товаре из RCRM"
},
{
"parameters": {
"operation": "getProductOptions"
},
"id": "0a12da09-8aa0-4444-80eb-1d69b7459883",
"name": "Список опций товаров из RCRM",
"type": "CUSTOM.retailCrm",
"typeVersion": 1,
"position": [
-6120,
1300
],
"credentials": {
"retailCrmApi": {
"id": "2",
"name": "RetailCrm account"
}
}
},
{
"parameters": {
"operation": "aggregateItems",
"aggregate": "aggregateAllItemData"
},
"id": "b57f845b-b27c-4af3-874c-929ad7f2d300",
"name": "Объединяем результат",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
-5900,
1300
]
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"id": "855004e3-eb2a-4a9f-b1be-0f7fe9ad9393",
"name": "Цикл по товарам",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
-5220,
1140
]
},
{
"parameters": {
"fieldToSplitOut": "rcOffers",
"options": {}
},
"id": "99c21aba-276f-4e0d-9c06-7fd731fdf791",
"name": "Получаем торговые предложения",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
-3240,
1280
]
},
{
"parameters": {
"stores": "={{[ $json[\"storeName\"] ]}}",
"operation": "createVariation",
"productId": "={{ $json[\"id\"] }}",
"variationOptions": "={{ $json[\"properties\"] }}",
"variationSku": "={{ $json[\"article\"] }}",
"variationPrice": "={{ $json[\"price\"] }}",
"variationName": "={{ $json[\"name\"] }}",
"variationEnabled": "={{ $json[\"active\"] && $json[\"storeName\"] !== \"am\" }}"
},
"id": "4a84ad90-4c70-473b-a320-400f428fec77",
"name": "Создаём вариации",
"type": "CUSTOM.ecwid",
"typeVersion": 1,
"position": [
-1740,
1560
],
"alwaysOutputData": true,
"credentials": {
"ecwidApi": {
"id": "4",
"name": "Ecwid account"
}
}
},
{
"parameters": {
"conditions": {
"number": [
{
"value1": "={{ $json[\"rcPrice\"] }}",
"operation": "notEqual",
"value2": "={{ $json[\"price\"] }}"
}
]
}
},
"id": "37953d0c-9bc7-4269-b214-d6a13eeba755",
"name": "Цена изменилась?1",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-3440,
820
],
"alwaysOutputData": false
},
{
"parameters": {
"functionCode": "const result = []\n\nfor (item of items) {\n const data = {...item.json}\n\n delete data.storeId\n delete data.storeName\n\n\n result.push({\n storeId: item.json.storeId,\n storeName: item.json.storeName,\n variations: Object.values(data)\n })\n}\n\nreturn result;"
},
"id": "c8a731d0-1785-4cf4-9148-1ac52ede66d7",
"name": "Преобразуем вариации",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
-1860,
1120
]
},
{
"parameters": {
"functionCode": "const result = []\n\nfor (item of items) {\n const data = item.json\n const rcProductSku = data.rcSku\n\n const { combinations: variations } = data\n \n let countDuplicateSku = variations.filter(variation => rcProductSku === (variation.sku)).length\n\n const existedVariations = variations.map(variation => {\n\n const offer = data.rcOffers.find(offer => offer.externalId === (variation.sku || data.sku))\n // if (!offer) return null\n return {\n ...variation,\n rcSku: offer?.externalId,\n rcId: data.rcId,\n rcName: offer?.name,\n rcPrice: offer?.price,\n rcQuantity: offer?.quantity,\n rcActive: offer?.active || false,\n rcProperties: offer?.properties,\n ecStoreName: data.storeName,\n ecProductId: data.id\n }\n }).filter(variation => !!variation)\n\n const newVariations = data.rcOffers.map(offer => {\n const variation = variations.find(variation => offer.externalId === (variation.sku || data.sku))\n if (!!variation) return null\n\n if (offer.externalId === rcProductSku || !offer.externalId) {\n countDuplicateSku += 1\n }\n \n return {\n rcId: data.rcId,\n rcSku: offer.externalId,\n rcProductSku,\n rcName: offer.name,\n rcPrice: offer.price,\n rcQuantity: offer.quantity,\n rcActive: offer.active,\n rcProperties: offer.properties,\n ecStoreName: data.storeName,\n ecProductId: data.id\n }\n }).filter(variation => !!variation)\n \n result.push({\n ...data,\n countDuplicateSku,\n mergedVariations: [...existedVariations, ...newVariations]\n })\n}\n\nreturn result;"
},
"id": "05e77282-2d78-4056-9beb-6219494593c8",
"name": "Объединяем вариации и офферы",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
-1040,
1220
]
},
{
"parameters": {
"fieldToSplitOut": "mergedVariations",
"options": {}
},
"id": "79d0df77-089d-4e76-a9e8-c2469323ce48",
"name": "Список вариаций",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
-700,
1220
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"sku\"] }}",
"operation": "isNotEmpty"
}
],
"number": [
{
"value1": "={{ $json[\"combinationNumber\"] }}",
"operation": "isNotEmpty"
}
]
},
"combineOperation": "any"
},
"id": "397850c1-c3a6-4946-b9ff-54ae27879cd0",
"name": "Вариация существует?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
180,
740
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"ecStoreName\"] }}",
"value2": "am"
}
]
}
},
"id": "338dadcd-7460-4801-95a0-60cf4579e955",
"name": "Авторские медиа?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1100,
1140
]
},
{
"parameters": {
"stores": "={{[ $json[\"ecStoreName\"] ]}}",
"operation": "createVariation",
"productId": "={{ $json[\"ecProductId\"] }}",
"variationOptions": "={{ $json[\"rcProperties\"] }}",
"variationSku": "={{ $json[\"rcSku\"] }}",
"variationPrice": "={{ $json[\"rcPrice\"] }}",
"variationName": "={{ $json[\"rcName\"] }}",
"variationEnabled": false
},
"id": "0d1ebb57-3bb9-4171-afc1-bdb3ea3a177a",
"name": "Создание вариации в АМ",
"type": "CUSTOM.ecwid",
"typeVersion": 1,
"position": [
1480,
1000
],
"credentials": {
"ecwidApi": {
"id": "4",
"name": "Ecwid account"
}
}
},
{
"parameters": {
"stores": "={{[ $json[\"ecStoreName\"] ]}}",
"operation": "createVariation",
"productId": "={{ $json[\"ecProductId\"] }}",
"variationOptions": "={{ $json[\"rcProperties\"] }}",
"variationSku": "={{ $json[\"rcSku\"] }}",
"variationPrice": "={{ $json[\"rcPrice\"] }}",
"variationName": "={{ $json[\"rcName\"] }}",
"variationEnabled": "={{ $json[\"rcActive\"] }}"
},
"id": "b921a558-ca73-43a2-899b-5aa6eea9b845",
"name": "Создание вариации",
"type": "CUSTOM.ecwid",
"typeVersion": 1,
"position": [
1480,
1300
],
"credentials": {
"ecwidApi": {
"id": "4",
"name": "Ecwid account"
}
}
},
{
"parameters": {
"errorMessage": "={{ $json[\"message\"] }}"
},
"id": "d905031e-a2a4-4de5-ab6f-17738353b69e",
"name": "Ошибка создания вариации",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
1840,
1460
]
},
{
"parameters": {
"errorMessage": "={{ $json[\"message\"] }}"
},
"id": "494a97a8-d645-47a1-a5b8-c4573cd3d8fb",
"name": "Ошибка создания вариации АМ",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
1800,
880
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$json[\"properties\"].length > 0 }}",
"value2": true
}
]
}
},
"id": "6874bdb9-4af5-4441-95b7-c31290e3677a",
"name": "Опции существуют?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-2260,
1460
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json[\"rcProperties\"].length > 0 }}",
"value2": true
}
]
}
},
"id": "7696cf1a-ddf1-47fe-a468-ae2b42b47e1b",
"name": "Свойства существуют?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-220,
1220
]
},
{
"parameters": {
"errorMessage": "={{ $json[\"message] }}"
},
"id": "295e9576-e4e2-4813-95ed-54dfb4a982ff",
"name": "Ошибка снятия с публикации",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
2160,
-60
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"rcSku\"] }}",
"operation": "isNotEmpty"
}
]
}
},
"id": "768116c1-70af-4280-95e4-25ba50a41af7",
"name": "Предложение существует?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
620,
340
]
},
{
"parameters": {
"stores": "={{ [$json[\"ecStoreName\"]] }}",
"operation": "updateVariationStock",
"productId": "={{ $json[\"ecProductId\"] }}",
"variationId": "={{ $json[\"id\"] }}"
},
"id": "fdbb5db7-afd2-4c9d-9f73-e53d9fa2d941",
"name": "Проставить сток 0",
"type": "CUSTOM.ecwid",
"typeVersion": 1,
"position": [
1800,
-160
],
"credentials": {
"ecwidApi": {
"id": "4",
"name": "Ecwid account"
}
}
},
{
"parameters": {
"stores": "={{ [$json[\"ecStoreName\"]] }}",
"operation": "updateVariationPrice",
"productId": "={{ $json[\"ecProductId\"] }}",
"variationId": "={{ $json[\"id\"] }}",
"variationPrice": "={{ $json[\"rcPrice\"] }}"
},
"id": "c2fef8ae-3d80-462b-a023-43908c2fa52d",
"name": "Меняем цену вариации",
"type": "CUSTOM.ecwid",
"typeVersion": 1,
"position": [
1480,
100
],
"credentials": {
"ecwidApi": {
"id": "4",
"name": "Ecwid account"
}
}
},
{
"parameters": {
"errorMessage": "={{ $json[\"message\"] }}"
},
"id": "d0d900bc-a509-40ec-bfd1-4dc69a177f89",
"name": "Ошибка изменения цены вариации",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
1800,
280
]
},
{
"parameters": {
"conditions": {
"number": [
{
"value1": "={{ $json[\"price\"] }}",
"operation": "notEqual",
"value2": "={{ $json[\"rcPrice\"] }}"
}
]
}
},
"id": "77fe6d74-e561-45d6-bbe6-9971229b2f0f",
"name": "Цена вариации изменилась?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1120,
160
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json[\"rcActive\"] }}",
"value2": true
}
],
"string": [
{
"value1": "={{ $json[\"storeName\"] }}",
"value2": "am"
}
]
}
},
"id": "fad145c9-c12c-4ae7-aec2-dfc48b495f59",
"name": "Публикация в АМ?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-3000,
800
],
"notes": "Товары в \"Авториские Медиа\" автоматически не публикуются"
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json[\"isOptionsChanged\"] }}",
"value2": true
}
]
},
"combineOperation": "any"
},
"id": "29a38da3-e44e-4dfd-8486-4c070c4c3045",
"name": "Опции изменились?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1480,
440
]
},
{
"parameters": {
"stores": "={{ [$json[\"ecStoreName\"]] }}",
"operation": "updateVariationOptions",
"productId": "={{ $json[\"ecProductId\"] }}",
"variationOptions": "={{ $json[\"rcProperties\"] }}",
"variationId": "={{ $json[\"id\"] }}"
},
"id": "cb0f22e3-65c7-4d03-9c8e-a880f8b6c010",
"name": "Обновление опций вариации",
"type": "CUSTOM.ecwid",
"typeVersion": 1,
"position": [
1800,
660
],
"credentials": {
"ecwidApi": {
"id": "4",
"name": "Ecwid account"
}
}
},
{
"parameters": {
"errorMessage": "={{ $json[\"message\"] }}"
},
"id": "1c5af1c7-141e-4010-932e-dcf36a1d297f",
"name": "Ошибка обновления опций вариации",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
2140,
860
]
},
{
"parameters": {
"functionCode": "for (item of items) {\n item.json.isOptionsChanged = false;\n \n const data = item.json\n const {options, rcProperties} = data\n\n if (options?.length !== rcProperties?.length) {\n item.json.isOptionsChanged = true;\n continue\n }\n\n rcProperties?.forEach(prop => {\n const option = options?.find(o => o?.name === prop?.name && o?.value === prop?.value)\n if (!option) {\n item.json.isOptionsChanged = true;\n }\n })\n}\n\nreturn items;"
},
"id": "7f69950b-42b7-4b20-9349-9d2b885bb450",
"name": "Проверяем изменения опций",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1120,
440
]
},
{
"parameters": {
"mode": "mergeByIndex",
"join": "inner"
},
"id": "c9b4ab1a-0c94-41e1-998e-50f98a74587d",
"name": "Объединяем вариации с товаром",
"type": "n8n-nodes-base.merge",
"typeVersion": 1,
"position": [
-1500,
1380
]
},
{
"parameters": {
"mode": "multiplex"
},
"id": "c043f968-546b-4980-978d-33b0f4e5a3cc",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"typeVersion": 1,
"position": [
-2960,
1460
]
},
{
"parameters": {
"stores": "={{[ $json[\"storeName\"] ]}}",
"operation": "createProduct",
"productName": "={{ $json[\"rcName\"] }}",
"productPrice": "={{ $json[\"rcPrice\"] }}",
"productOptions": "={{ $json[\"rcProperties\"] }}",
"productSku": "={{ $json[\"rcSku\"] }}",
"productEnabled": "={{ $json[\"rcActive\"] && $json[\"storeName\"] !== \"am\" }}"
},
"id": "b88e8a3f-8ab4-4ed5-9e5e-785bed62249e",
"name": "Создаём товар",
"type": "CUSTOM.ecwid",
"typeVersion": 1,
"position": [
-3460,
1480
],
"notesInFlow": true,
"credentials": {
"ecwidApi": {
"id": "4",
"name": "Ecwid account"
}
},
"notes": "Если товар в АМ, он будет неопубликован"
},
{
"parameters": {
"operation": "removeDuplicates",
"compare": "selectedFields",
"fieldsToCompare": {
"fields": [
{
"fieldName": "article"
},
{
"fieldName": "externalId"
},
{
"fieldName": "storeId"
}
]
},
"options": {}
},
"id": "4cbbc5ab-511d-429e-ab5e-f7fcd0339f78",
"name": "Удаляем дубликаты",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
-2520,
1380
]
},
{
"parameters": {
"workflowId": "18"
},
"id": "41355d62-a578-41d5-adef-5542cbf098dd",
"name": "Синхронизируем остатки товара",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
-2280,
1820
],
"alwaysOutputData": true
},
{
"parameters": {
"errorMessage": "={{$json[\"message\"]}}"
},
"id": "7a6fd144-a44e-4c4a-aa69-56996cb0a786",
"name": "Ошибка создания вариации товара",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
-1440,
1820
]
},
{
"parameters": {
"errorMessage": "={{ $json[\"message\"] }}"
},
"id": "2c2a6d0d-fdf0-4898-9fd1-1b773f2bd1d4",
"name": "Ошибка создания товара",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
-3460,
1840
]
},
{
"parameters": {
"workflowId": "18"
},
"id": "4b57f4c4-e0a6-488a-b8a0-f0428d1c9d11",
"name": "Синхронизируем остатки вариации",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
-260,
1840
],
"alwaysOutputData": true
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "storeName",
"value": "={{ $json[\"storeName\"] }}"
},
{
"name": "sku",
"value": "={{ $node[\"Опции существуют?\"].json[\"externalId\"] }}"
}
],
"boolean": [
{
"name": "active",
"value": true
}
]
},
"options": {}
},
"id": "16ac47c5-3d52-491c-aa8b-5bf523ec5ad3",
"name": "Синхронизация стоков вариации",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
-1060,
1840
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "storeName",
"value": "={{ $json[\"storeName\"] }}"
},
{
"name": "sku",
"value": "={{ $node[\"Сохраняем поля sku и storeName\"].json[\"rcSku\"] }}"
}
],
"boolean": [
{
"name": "active",
"value": true
}
]
},
"options": {}
},
"id": "1f74a150-d9b4-4884-ba1f-e3ab99f78758",
"name": "Синхронизация стоков товара",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
-2960,
1820
]
},
{
"parameters": {
"unit": "seconds"
},
"id": "6ef52f7a-a8bc-40ed-85af-87afd3bc51be",
"name": "Таймаут перед изменением вариации",
"type": "n8n-nodes-base.wait",
"typeVersion": 1,
"position": [
-480,
1840
],
"webhookId": "6c23fef5-592b-4a89-86d7-2b614628ae2c"
},
{
"parameters": {
"unit": "seconds"
},
"id": "5b5cf627-9e5e-4a03-a179-d29e7c98a856",
"name": "Таймаут перед изменением товара",
"type": "n8n-nodes-base.wait",
"typeVersion": 1,
"position": [
-2520,
1820
],
"webhookId": "9528f17b-8668-4a9d-a109-c9b2e2105b39"
},
{
"parameters": {
"values": {
"string": [
{
"name": "newSku",
"value": "={{ $json[\"rcSku\"] }}"
},
{
"name": "newStoreName",
"value": "={{ $json[\"storeName\"] }}"
}
],
"boolean": [
{
"name": "newActive",
"value": "={{ $json[\"rcActive\"] }}"
}
]
},
"options": {}
},
"id": "e98be43f-7798-42e3-9466-a35271e7b3b7",
"name": "Сохраняем поля sku и storeName",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
-3660,
1480
]
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"id": "ba18aa38-2ac9-4d2c-be57-d33fe84e810f",
"name": "Цикл по стокам вариаций",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
-700,
1840
]
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"id": "347be661-233a-48dd-a350-e785a1ccfa0b",
"name": "Цикл по стокам товаров",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
-2720,
1820
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $node[\"Сохраняем поля sku и storeName\"].json[\"newActive\"] }}",
"value2": true
}
]
}
},
"id": "cb684568-3894-493e-83fc-74a43f0c1e8d",
"name": "Товар активен?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-3220,
1820
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $node[\"Опции существуют?\"].json[\"active\"] }}",
"value2": true
}
]
}
},
"id": "b3015df8-d140-45f2-beb7-d7ac062b35dc",
"name": "Вариация активна?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-1440,
1580
]
},
{
"parameters": {
"workflowId": "18"
},
"id": "476a7a2c-fcdd-4eca-99e8-6de714ecfda9",
"name": "Синхронизируем остатки вариации1",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
2920,
1080
],
"alwaysOutputData": true
},
{
"parameters": {
"unit": "seconds"
},
"id": "2a732697-4e20-4f60-b4f0-fcf839c70065",
"name": "Таймаут перед изменением вариации1",
"type": "n8n-nodes-base.wait",
"typeVersion": 1,
"position": [
2720,
1080
],
"webhookId": "25de84c2-9a23-4e55-97fa-ef871cd6a436"
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"id": "a4403695-0f64-4eb4-8461-00089f77b012",
"name": "Цикл по стокам вариаций1",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
2500,
1080
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "newSku",
"value": "={{ $json[\"rcSku\"] }}"
},
{
"name": "newStoreName",
"value": "={{ $json[\"rcName\"] }}"
}
],
"boolean": [
{
"name": "newActive",
"value": "={{ $json[\"rcActive\"] }}"
}
]
},
"options": {}
},
"id": "fabc9713-8c24-4772-95a4-f437797f8fb3",
"name": "Set",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1320,
1300
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "storeName",
"value": "={{ $json[\"storeName\"] }}"
},
{
"name": "sku",
"value": "={{ $node[\"Set1\"].json[\"rcSku\"] }}"
}
],
"boolean": [
{
"name": "active",
"value": "={{ $node[\"Set1\"].json[\"rcActive\"] }}"
}
]
},
"options": {}
},
"id": "057471c7-546c-4120-b555-5df23ee5cd96",
"name": "Параметры синхронизации стоков",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1900,
1080
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json[\"rcActive\"] }}",
"operation": "notEqual",
"value2": "={{ $json[\"quantity\"] > 0 }}"
}
]
}
},
"id": "74f21dfc-ebe5-4db4-a975-085ae31b9491",
"name": "Опубликованность изменилась?1",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1120,
-180
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json[\"rcActive\"] }}",
"value2": true
}
],
"number": [
{
"value1": "={{ $json[\"rcQuantity\"] }}",
"operation": "larger"
}
]
}
},
"id": "ac5aea29-874c-43ef-88bb-153eadb78c21",
"name": "Публикация вариации?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1300,
-420
]
},
{
"parameters": {
"workflowId": "18"
},
"id": "ca7b33a1-50cf-4375-8f0c-435377201a63",
"name": "Синхронизируем остатки вариации2",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
2220,
-560
],
"alwaysOutputData": true
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "storeName",
"value": "={{ $json[\"ecStoreName\"] }}"
},
{
"name": "sku",
"value": "={{ $json[\"rcSku\"] }}"
}
],
"boolean": [
{
"name": "active",
"value": true
}
]
},
"options": {}
},
"id": "77776675-26f2-456b-bf32-406fa9123386",
"name": "Параметры синхронизации стоков1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1480,
-560
]
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"id": "41202175-3ccf-4d2f-9f21-bda45bf8351b",
"name": "Цикл по стокам вариаций2",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
1800,
-560
]
},
{
"parameters": {
"unit": "seconds"
},
"id": "1d02b36a-6966-4154-94f4-0ac6d7351b15",
"name": "Таймаут перед изменением вариации2",
"type": "n8n-nodes-base.wait",
"typeVersion": 1,
"position": [
2020,
-560
],
"webhookId": "4a05b309-5a33-41ec-acd4-9348483c00ea"
},
{
"parameters": {
"stores": "={{ [$node[\"Вариация существует?\"].json[\"ecStoreName\"]] }}",
"operation": "updateVariationStock",
"productId": "={{ $node[\"Вариация существует?\"].json[\"ecProductId\"] }}",
"variationId": "={{ $node[\"Вариация существует?\"].json[\"id\"] }}"
},
"id": "dda64a4f-e563-496e-9bf0-3c741b54ad78",
"name": "Проставить сток ",
"type": "CUSTOM.ecwid",
"typeVersion": 1,
"position": [
1120,
760
],
"credentials": {
"ecwidApi": {
"id": "4",
"name": "Ecwid account"
}
}
},
{
"parameters": {
"errorMessage": "={{ $json[\"message\"] }}"
},
"id": "c748376a-ec9b-416d-a97e-fb9797f80b0d",
"name": "Ошибка снятия с публикации1",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
1480,
700
]
},
{
"parameters": {
"conditions": {
"number": [
{
"value1": "={{ $json[\"countDuplicateSku\"] }}",
"operation": "larger",
"value2": 1
}
]
}
},
"id": "1cce693d-0f2d-4d65-8e56-c3751c7737f8",
"name": "Дублирующие sku?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-1460,
920
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"rcSku\"] }}",
"operation": "isNotEmpty"
}
]
}
},
"id": "4f6425e4-a20a-42a4-93e8-a45f07f6462b",
"name": "Sku вариации существует?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
600,
1400
]
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"id": "0e8014ab-e106-4f3f-9f83-c26a94991f71",
"name": "Цикл по стокам вариаций3",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
2500,
1280
]
},
{
"parameters": {
"unit": "seconds"
},
"id": "51b6a0af-f73e-4862-916e-0bea61f366dc",
"name": "Таймаут перед изменением вариации3",
"type": "n8n-nodes-base.wait",
"typeVersion": 1,
"position": [
2720,
1280
],
"webhookId": "76cc4ea2-b841-41b0-86ef-43a76eca49d3"
},
{
"parameters": {
"workflowId": "18"
},
"id": "2e16dcb8-6a8f-4c50-9f5a-d820f468a639",
"name": "Синхронизируем остатки вариации3",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
2920,
1280
],
"alwaysOutputData": true
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "storeName",
"value": "={{ $json[\"storeName\"] }}"
},
{
"name": "sku",
"value": "={{ $node[\"Set\"].json[\"rcSku\"] }}"
}
],
"boolean": [
{
"name": "active",
"value": "={{ $node[\"Set\"].json[\"rcActive\"] }}"
}
]
},
"options": {}
},
"id": "fa8fd95b-d248-4d83-a6ca-ccc01610a6a7",
"name": "Параметры синхронизации стоков2",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1900,
1280
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "newSku",
"value": "={{ $json[\"rcSku\"] }}"
},
{
"name": "newStoreName",
"value": "={{ $json[\"rcName\"] }}"
}
],
"boolean": [
{
"name": "newActive"
}
]
},
"options": {}
},
"id": "c918fcce-ea8e-4e88-b0c2-8099de1a442e",
"name": "Set1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1320,
1000
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"externalId\"] }}",
"operation": "isNotEmpty"
},
{
"value1": "={{ $json[\"article\"] }}",
"operation": "isNotEmpty"
},
{
"value1": "={{ $json[\"externalId\"] }}",
"value2": "={{ $json[\"article\"] }}"
}
]
}
},
"id": "5acf4b0f-d38f-47cb-93da-e4382542c19d",
"name": "Артикл и внешний id корректны?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-2720,
1460
]
},
{
"parameters": {
"operation": "removeDuplicates",
"compare": "selectedFields",
"fieldsToCompare": {
"fields": [
{
"fieldName": "rcId"
}
]
},
"options": {}
},
"id": "1e9a3468-0446-4a45-828c-636ffcce3d83",
"name": "Удаляем дубликаты товаров",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
1080,
1680
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "message",
"value": "=Отсутствует externalId в торговых предложениях <https://yolka-varlamov.retailcrm.ru/products/{{$json[\"rcId\"]}}/edit#offers|товара>"
},
{
"name": "severity",
"value": "warn"
},
{
"name": "executionId",
"value": "={{$executionId}}"
}
]
},
"options": {}
},
"id": "f19727fe-ee54-48d3-a116-dd484d9e617f",
"name": "Формируем сообщение",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1320,
1680
]
},
{
"parameters": {
"workflowId": "20"
},
"id": "bf0d9ef8-5946-4665-8315-0dbb7c386b8d",
"name": "Отправляем уведомление",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
1480,
1680
]
},
{
"parameters": {
"operation": "removeDuplicates",
"compare": "selectedFields",
"fieldsToCompare": {
"fields": [
{
"fieldName": "article"
}
]
},
"options": {}
},
"id": "0d26ea72-dc17-4574-bd94-c25bef502789",
"name": "Item Lists",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
-2520,
1560
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "message",
"value": "=\nНекорректно проставлены/отсутствуют поля *article* | *externalId* в торговых предложениях <https://yolka-varlamov.retailcrm.ru/products/{{$node[\"Получаем торговые предложения\"].json[\"id\"]}}/edit#offers|товара>"
},
{
"name": "executionId",
"value": "={{$executionId}}"
},
{
"name": "severity",
"value": "warn"
}
]
},
"options": {}
},
"id": "eeb436b1-6871-4f27-8feb-c33c12f6440c",
"name": "Формируем сообщение1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
-1940,
1820
]
},
{
"parameters": {
"workflowId": "20"
},
"id": "d1692c5a-f6e3-4647-a0c6-a989e1538702",
"name": "Отправляем уведомление1",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
-1740,
1820
]
},
{
"parameters": {
"stores": "={{ $json[\"stores\"] }}",
"operation": "getProducts"
},
"id": "3b1cc0f5-3a35-4f76-a505-889125a4f834",
"name": "Ecwid",
"type": "CUSTOM.ecwid",
"typeVersion": 1,
"position": [
-7000,
1480
],
"credentials": {
"ecwidApi": {
"id": "4",
"name": "Ecwid account"
}
}
},
{
"parameters": {
"errorMessage": "={{ $json[\"message\"] }}"
},
"id": "765933fc-cc46-45ab-bdea-b57617e4644f",
"name": "Stop And Error",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
-6800,
1640
]
},
{
"parameters": {
"operation": "aggregateItems",
"aggregate": "aggregateAllItemData",
"destinationFieldName": "ecwidProducts"
},
"id": "242f2271-93c0-4a5a-a9dc-3c440e021dd0",
"name": "Товары ECWID",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
-6780,
1300
]
},
{
"parameters": {
"functionCode": "const {ecwidProducts} = $node[\"Товары ECWID\"].json\n\nconst rcrmProduct = items[0].json\n\nconst products = ecwidProducts.filter(product => product.sku === rcrmProduct.article)\n\nreturn products.map(p => {\n return {json: p}\n});"
},
"id": "7045a23a-0c32-485b-b733-b997fa37d1a3",
"name": "Ищем товары ECWID",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
-4780,
1140
]
},
{
"parameters": {
"fieldToSplitOut": "combinations",
"options": {}
},
"id": "02c51b80-c448-42b4-a178-c068d1601e48",
"name": "Вариации товара",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
-2520,
1120
],
"alwaysOutputData": true
},
{
"parameters": {
"operation": "getStock"
},
"id": "2c52df68-4cbb-4bdd-877b-c692fe31199b",
"name": "Складские остатки",
"type": "CUSTOM.retailCrm",
"typeVersion": 1,
"position": [
-6560,
1300
],
"credentials": {
"retailCrmApi": {
"id": "2",
"name": "RetailCrm account"
}
}
},
{
"parameters": {
"operation": "aggregateItems",
"aggregate": "aggregateAllItemData",
"destinationFieldName": "stocks"
},
"id": "2516966b-d370-45e2-9c4f-28b85994d534",
"name": "Объединяем в одно поле",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
-6340,
1300
]
},
{
"parameters": {
"functionCode": "const {stocks} = $node[\"Объединяем в одно поле\"].json\n\nreturn items.map(({json}) => {\n let rcQuantity = 0\n const stock = stocks.find(stock => stock.externalId === json.rcSku)?.stores\n if (stock) {\n rcQuantity = stock.find(s => s.store.toLocaleLowerCase() === json.storeName)?.quantity || 0\n }\n\n return {\n json: {\n ...json,\n rcQuantity\n }\n }\n});"
},
"id": "9d95ef57-5776-4730-991e-4152761370a0",
"name": "Указываем корректные остатки",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
-4100,
1160
]
},
{
"parameters": {
"functionCode": "const {stocks} = $node[\"Объединяем в одно поле\"].json\n\nreturn items.map(({json}) => {\n let rcQuantity = 0\n const stock = stocks.find(stock => stock.externalId === json.rcSku)?.stores\n if (stock) {\n rcQuantity = stock.find(s => s.store.toLocaleLowerCase() === json.storeName)?.quantity || 0\n }\n\n return {\n json: {\n ...json,\n rcQuantity\n }\n }\n});"
},
"id": "baf6fe13-cb25-4899-b08b-a79d55166002",
"name": "Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
-460,
1220
]
},
{
"parameters": {
"content": "## Небольшой чейнжлог v4 -> v5\n### 25c -> 5c\n- Добавлено получение всех товаров из ECWID сразу\n- Теперь вариации ECWID берутся из полученных ранее товаров, а не отдельно из API\n- Получаются все стоки и корректно мапятся с товарами и вариациями ECWID, для корректных проверок на изменения\n - В стандартных данных из RCRM, у каждого товара указывается текущее доступное кол–во для всех складов в сумме",
"height": 285.77028449920454,
"width": 439.9872048571513
},
"id": "d777095c-1305-48b8-8d92-452159d8ad51",
"name": "Note",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-7440,
899.003799726739
]
},
{
"parameters": {
"conditions": {
"number": [
{
"value1": "={{ $json[\"quantity\"] }}",
"operation": "larger"
}
]
}
},
"id": "99992d3c-1eb3-4050-9854-9cf79996e24c",
"name": "Количество > 0?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1480,
-280
]
},
{
"parameters": {
"errorMessage": "={{ $json[\"message\"] }}"
},
"id": "a0c6e12f-56e3-4122-b8f2-2bf1ba627051",
"name": "Stop And Error1",
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
-5500,
1480
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "healthCheckId",
"value": "RcfxYge1cYJ5eZm1HbYXsnum"
}
]
},
"options": {}
},
"id": "70841c0d-f63c-4fb6-8997-8fb47b2c08b2",
"name": "HealthCheckId",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
-7440,
1680
]
},
{
"parameters": {
"workflowId": "49"
},
"id": "a6d0b3b0-2bfc-4db2-8f91-774575e87140",
"name": "HealthCheck",
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1,
"position": [
-7280,
1680
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Магазины EC",
"type": "main",
"index": 0
}
]
]
},
"Товары из RCRM": {
"main": [
[
{
"node": "article есть?",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop And Error1",
"type": "main",
"index": 0
}
]
]
},
"Меняем цену": {
"main": [
null,
[
{
"node": "Ошибка изменения цены",
"type": "main",
"index": 0
}
]
]
},
"Магазины EC": {
"main": [
[
{
"node": "HealthCheckId",
"type": "main",
"index": 0
},
{
"node": "Ecwid",
"type": "main",
"index": 0
}
]
]
},
"Товар есть в EC?": {
"main": [
[
{
"node": "Цена изменилась?1",
"type": "main",
"index": 0
},
{
"node": "Опубликованность изменилась?",
"type": "main",
"index": 0
},
{
"node": "Объединяем вариации с товаром",
"type": "main",
"index": 1
},
{
"node": "Вариации товара",
"type": "main",
"index": 0
}
],
[
{
"node": "Получаем торговые предложения",
"type": "main",
"index": 0
},
{
"node": "Сохраняем поля sku и storeName",
"type": "main",
"index": 0
}
]
]
},
"Interval": {
"main": [
[
{
"node": "Магазины EC",
"type": "main",
"index": 0
}
]
]
},
"NoOp": {
"main": [
[
{
"node": "Цикл по товарам",
"type": "main",
"index": 0
}
]
]
},
"Список магазинов": {
"main": [
[
{
"node": "Совмещаем список магазинов",
"type": "main",
"index": 0
}
]
]
},
"Совмещаем список магазинов": {
"main": [
[
{
"node": "Совмещаем данные RC/EC",
"type": "main",
"index": 0
}
]
]
},
"Совмещаем данные RC/EC": {
"main": [
[
{
"node": "Указываем корректные остатки",
"type": "main",
"index": 0
}
]
]
},
"Опубликованность изменилась?": {
"main": [
[
{
"node": "Публикация в АМ?",
"type": "main",
"index": 0
}
]
]
},
"Меняем опубликованность": {
"main": [
null,
[
{
"node": "Ошибка изменения опубликованности",
"type": "main",
"index": 0
}
]
]
},
"article есть?": {
"main": [
[
{
"node": "Цикл по товарам",
"type": "main",
"index": 0
}
]
]
},
"Выделяем нужные поля": {
"main": [
[
{
"node": "Совмещаем данные RC/EC",
"type": "main",
"index": 1
}
]
]
},
"Список опций товаров из RCRM": {
"main": [
[
{
"node": "Объединяем результат",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop And Error1",
"type": "main",
"index": 0
}
]
]
},
"Объединяем результат": {
"main": [
[
{
"node": "Товары из RCRM",
"type": "main",
"index": 0
}
]
]
},
"Цикл по товарам": {
"main": [
[
{
"node": "Список магазинов",
"type": "main",
"index": 0
},
{
"node": "Выделяем нужные поля",
"type": "main",
"index": 0
},
{
"node": "Ищем товары ECWID",
"type": "main",
"index": 0
}
]
]
},
"Получаем торговые предложения": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Создаём вариации": {
"main": [
[
{
"node": "Вариация активна?",
"type": "main",
"index": 0
}
],
[
{
"node": "Ошибка создания вариации товара",
"type": "main",
"index": 0
}
]
]
},
"Цена изменилась?1": {
"main": [
[
{
"node": "Меняем цену",
"type": "main",
"index": 0
}
]
]
},
"Преобразуем вариации": {
"main": [
[
{
"node": "Объединяем вариации с товаром",
"type": "main",
"index": 0
}
]
]
},
"Объединяем вариации и офферы": {
"main": [
[
{
"node": "Список вариаций",
"type": "main",
"index": 0
}
]
]
},
"Список вариаций": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
},
"Вариация существует?": {
"main": [
[
{
"node": "Предложение существует?",
"type": "main",
"index": 0
}
],
[
{
"node": "Sku вариации существует?",
"type": "main",
"index": 0
}
]
]
},
"Авторские медиа?": {
"main": [
[
{
"node": "Set1",
"type": "main",
"index": 0
}
],
[
{
"node": "Set",
"type": "main",
"index": 0
}
]
]
},
"Создание вариации в АМ": {
"main": [
[
{
"node": "Параметры синхронизации стоков",
"type": "main",
"index": 0
}
],
[
{
"node": "Ошибка создания вариации АМ",
"type": "main",
"index": 0
}
]
]
},
"Создание вариации": {
"main": [
[
{
"node": "Параметры синхронизации стоков2",
"type": "main",
"index": 0
}
],
[
{
"node": "Ошибка создания вариации",
"type": "main",
"index": 0
}
]
]
},
"Опции существуют?": {
"main": [
[
{
"node": "Создаём вариации",
"type": "main",
"index": 0
}
]
]
},
"Свойства существуют?": {
"main": [
[
{
"node": "Вариация существует?",
"type": "main",
"index": 0
}
],
[
{
"node": "NoOp",
"type": "main",
"index": 0
}
]
]
},
"Предложение существует?": {
"main": [
[
{
"node": "Цена вариации изменилась?",
"type": "main",
"index": 0
},
{
"node": "Проверяем изменения опций",
"type": "main",
"index": 0
},
{
"node": "Опубликованность изменилась?1",
"type": "main",
"index": 0
}
],
[
{
"node": "Проставить сток ",
"type": "main",
"index": 0
}
]
]
},
"Проставить сток 0": {
"main": [
null,
[
{
"node": "Ошибка снятия с публикации",
"type": "main",
"index": 0
}
]
]
},
"Меняем цену вариации": {
"main": [
null,
[
{
"node": "Ошибка изменения цены вариации",
"type": "main",
"index": 0
}
]
]
},
"Цена вариации изменилась?": {
"main": [
[
{
"node": "Меняем цену вариации",
"type": "main",
"index": 0
}
]
]
},
"Публикация в АМ?": {
"main": [
null,
[
{
"node": "Меняем опубликованность",
"type": "main",
"index": 0
}
]
]
},
"Опции изменились?": {
"main": [
[
{
"node": "Обновление опций вариации",
"type": "main",
"index": 0
}
]
]
},
"Обновление опций вариации": {
"main": [
null,
[
{
"node": "Ошибка обновления опций вариации",
"type": "main",
"index": 0
}
]
]
},
"Проверяем изменения опций": {
"main": [
[
{
"node": "Опции изменились?",
"type": "main",
"index": 0
}
]
]
},
"Объединяем вариации с товаром": {
"main": [
[
{
"node": "Объединяем вариации и офферы",
"type": "main",
"index": 0
},
{
"node": "NoOp",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Артикл и внешний id корректны?",
"type": "main",
"index": 0
}
]
]
},
"Создаём товар": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
},
{
"node": "Товар активен?",
"type": "main",
"index": 0
}
],
[
{
"node": "Ошибка создания товара",
"type": "main",
"index": 0
}
]
]
},
"Удаляем дубликаты": {
"main": [
[
{
"node": "Опции существуют?",
"type": "main",
"index": 0
}
]
]
},
"Синхронизируем остатки товара": {
"main": [
[
{
"node": "Цикл по стокам товаров",
"type": "main",
"index": 0
}
]
]
},
"Синхронизируем остатки вариации": {
"main": [
[
{
"node": "Цикл по стокам вариаций",
"type": "main",
"index": 0
}
]
]
},
"Синхронизация стоков вариации": {
"main": [
[
{
"node": "Цикл по стокам вариаций",
"type": "main",
"index": 0
}
]
]
},
"Синхронизация стоков товара": {
"main": [
[
{
"node": "Цикл по стокам товаров",
"type": "main",
"index": 0
}
]
]
},
"Таймаут перед изменением вариации": {
"main": [
[
{
"node": "Синхронизируем остатки вариации",
"type": "main",
"index": 0
}
]
]
},
"Таймаут перед изменением товара": {
"main": [
[
{
"node": "Синхронизируем остатки товара",
"type": "main",
"index": 0
}
]
]
},
"Сохраняем поля sku и storeName": {
"main": [
[
{
"node": "Создаём товар",
"type": "main",
"index": 0
}
]
]
},
"Цикл по стокам вариаций": {
"main": [
[
{
"node": "Таймаут перед изменением вариации",
"type": "main",
"index": 0
}
]
]
},
"Цикл по стокам товаров": {
"main": [
[
{
"node": "Таймаут перед изменением товара",
"type": "main",
"index": 0
}
]
]
},
"Товар активен?": {
"main": [
[
{
"node": "Синхронизация стоков товара",
"type": "main",
"index": 0
}
]
]
},
"Вариация активна?": {
"main": [
[
{
"node": "Синхронизация стоков вариации",
"type": "main",
"index": 0
}
]
]
},
"Синхронизируем остатки вариации1": {
"main": [
[
{
"node": "Цикл по стокам вариаций1",
"type": "main",
"index": 0
}
]
]
},
"Таймаут перед изменением вариации1": {
"main": [
[
{
"node": "Синхронизируем остатки вариации1",
"type": "main",
"index": 0
}
]
]
},
"Цикл по стокам вариаций1": {
"main": [
[
{
"node": "Таймаут перед изменением вариации1",
"type": "main",
"index": 0
}
]
]
},
"Set": {
"main": [
[
{
"node": "Создание вариации",
"type": "main",
"index": 0
}
]
]
},
"Параметры синхронизации стоков": {
"main": [
[
{
"node": "Цикл по стокам вариаций1",
"type": "main",
"index": 0
}
]
]
},
"Опубликованность изменилась?1": {
"main": [
[
{
"node": "Публикация вариации?",
"type": "main",
"index": 0
}
]
]
},
"Публикация вариации?": {
"main": [
[
{
"node": "Параметры синхронизации стоков1",
"type": "main",
"index": 0
}
],
[
{
"node": "Количество > 0?",
"type": "main",
"index": 0
}
]
]
},
"Синхронизируем остатки вариации2": {
"main": [
[
{
"node": "Цикл по стокам вариаций2",
"type": "main",
"index": 0
}
]
]
},
"Параметры синхронизации стоков1": {
"main": [
[
{
"node": "Цикл по стокам вариаций2",
"type": "main",
"index": 0
}
]
]
},
"Цикл по стокам вариаций2": {
"main": [
[
{
"node": "Таймаут перед изменением вариации2",
"type": "main",
"index": 0
}
]
]
},
"Таймаут перед изменением вариации2": {
"main": [
[
{
"node": "Синхронизируем остатки вариации2",
"type": "main",
"index": 0
}
]
]
},
"Проставить сток ": {
"main": [
null,
[
{
"node": "Ошибка снятия с публикации1",
"type": "main",
"index": 0
}
]
]
},
"Sku вариации существует?": {
"main": [
[
{
"node": "Авторские медиа?",
"type": "main",
"index": 0
}
],
[
{
"node": "Удаляем дубликаты товаров",
"type": "main",
"index": 0
}
]
]
},
"Цикл по стокам вариаций3": {
"main": [
[
{
"node": "Таймаут перед изменением вариации3",
"type": "main",
"index": 0
}
]
]
},
"Таймаут перед изменением вариации3": {
"main": [
[
{
"node": "Синхронизируем остатки вариации3",
"type": "main",
"index": 0
}
]
]
},
"Синхронизируем остатки вариации3": {
"main": [
[
{
"node": "Цикл по стокам вариаций3",
"type": "main",
"index": 0
}
]
]
},
"Параметры синхронизации стоков2": {
"main": [
[
{
"node": "Цикл по стокам вариаций3",
"type": "main",
"index": 0
}
]
]
},
"Set1": {
"main": [
[
{
"node": "Создание вариации в АМ",
"type": "main",
"index": 0
}
]
]
},
"Артикл и внешний id корректны?": {
"main": [
[
{
"node": "Удаляем дубликаты",
"type": "main",
"index": 0
}
],
[
{
"node": "Item Lists",
"type": "main",
"index": 0
}
]
]
},
"Удаляем дубликаты товаров": {
"main": [
[
{
"node": "Формируем сообщение",
"type": "main",
"index": 0
}
]
]
},
"Формируем сообщение": {
"main": [
[
{
"node": "Отправляем уведомление",
"type": "main",
"index": 0
}
]
]
},
"Item Lists": {
"main": [
[
{
"node": "Формируем сообщение1",
"type": "main",
"index": 0
}
]
]
},
"Формируем сообщение1": {
"main": [
[
{
"node": "Отправляем уведомление1",
"type": "main",
"index": 0
}
]
]
},
"Ecwid": {
"main": [
[
{
"node": "Товары ECWID",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop And Error",
"type": "main",
"index": 0
}
]
]
},
"Товары ECWID": {
"main": [
[
{
"node": "Складские остатки",
"type": "main",
"index": 0
}
]
]
},
"Ищем товары ECWID": {
"main": [
[
{
"node": "Совмещаем список магазинов",
"type": "main",
"index": 1
}
]
]
},
"Вариации товара": {
"main": [
[
{
"node": "Преобразуем вариации",
"type": "main",
"index": 0
}
]
]
},
"Складские остатки": {
"main": [
[
{
"node": "Объединяем в одно поле",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop And Error1",
"type": "main",
"index": 0
}
]
]
},
"Объединяем в одно поле": {
"main": [
[
{
"node": "Список опций товаров из RCRM",
"type": "main",
"index": 0
}
]
]
},
"Указываем корректные остатки": {
"main": [
[
{
"node": "Товар есть в EC?",
"type": "main",
"index": 0
}
]
]
},
"Function": {
"main": [
[
{
"node": "Свойства существуют?",
"type": "main",
"index": 0
}
]
]
},
"Количество > 0?": {
"main": [
[
{
"node": "Проставить сток 0",
"type": "main",
"index": 0
}
]
]
},
"HealthCheckId": {
"main": [
[
{
"node": "HealthCheck",
"type": "main",
"index": 0
}
]
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment