From 0085f1af2cba970bd709827eec5ad04b723e4114 Mon Sep 17 00:00:00 2001 From: gorokh Date: Mon, 23 Dec 2019 17:55:19 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=87?= =?UTF-8?q?=D0=B0=20externalIds=20=D1=83=20=D0=BF=D0=BE=D0=B7=D0=B8=D1=86?= =?UTF-8?q?=D0=B8=D0=B9=20=D1=82=D0=BE=D0=B2=D0=B0=D1=80=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B2=20=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../general/order/RetailCrmOrder_v5.php | 29 ++++++++++++++++++- intaro.retailcrm/description.ru | 2 +- intaro.retailcrm/install/version.php | 4 +-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php index 6a09b5d5..0544982e 100644 --- a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php +++ b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php @@ -139,10 +139,37 @@ class RetailCrmOrder $height = 0; $length = 0; + if ('ordersEdit' == $methodApi) { + $response = RCrmActions::apiMethod($api, 'ordersGet', __METHOD__, $order['externalId']); + if (isset($response['order'])) { + foreach ($response['order']['items'] as $item) { + $orderItems[$item['offer']['externalId']] = $item; + } + } + } + //basket foreach ($arFields['BASKET'] as $product) { + if (isset($orderItems[$product['PRODUCT_ID']])) { //update + $externalIds = $orderItems[$product['PRODUCT_ID']]['externalIds']; + $key = array_search("bitrix", array_column($externalIds, 'code')); + if (!$key) { + $externalIds[] = array( + 'code' =>'bitrix', + 'value' => $product['PRODUCT_ID'], + ); + } + } else { //create + $externalIds = array( + array( + 'code' =>'bitrix', + 'value' => $product['PRODUCT_ID'], + ) + ); + } + $item = array( - 'externalId' => $product['PRODUCT_ID'], + 'externalIds' => $externalIds, 'quantity' => $product['QUANTITY'], 'offer' => array('externalId' => $product['PRODUCT_ID'], 'xmlId' => $product['PRODUCT_XML_ID'] diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index 0f4f17aa..9db04cdc 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1 +1 @@ -- Добавлена обработка изменения номера заказа по истории +- Добавлена передача "externalIds" у позиций товаров в заказе diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index 0ad6624e..6adbc24a 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,5 +1,5 @@ "5.2.4", - "VERSION_DATE" => "2019-12-10 15:03:00" + "VERSION" => "5.2.5", + "VERSION_DATE" => "2019-12-23 17:03:00" );