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" );