1
0
mirror of synced 2024-11-25 14:56:09 +03:00

передача externalIds у позиций товаров в заказе

This commit is contained in:
gorokh 2019-12-23 17:55:19 +03:00
parent d183a3350f
commit 0085f1af2c
3 changed files with 31 additions and 4 deletions

View File

@ -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']

View File

@ -1 +1 @@
- Добавлена обработка изменения номера заказа по истории
- Добавлена передача "externalIds" у позиций товаров в заказе

View File

@ -1,5 +1,5 @@
<?
$arModuleVersion = array(
"VERSION" => "5.2.4",
"VERSION_DATE" => "2019-12-10 15:03:00"
"VERSION" => "5.2.5",
"VERSION_DATE" => "2019-12-23 17:03:00"
);