передача externalIds у позиций товаров в заказе
This commit is contained in:
parent
d183a3350f
commit
0085f1af2c
@ -139,10 +139,37 @@ class RetailCrmOrder
|
|||||||
$height = 0;
|
$height = 0;
|
||||||
$length = 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
|
//basket
|
||||||
foreach ($arFields['BASKET'] as $product) {
|
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(
|
$item = array(
|
||||||
'externalId' => $product['PRODUCT_ID'],
|
'externalIds' => $externalIds,
|
||||||
'quantity' => $product['QUANTITY'],
|
'quantity' => $product['QUANTITY'],
|
||||||
'offer' => array('externalId' => $product['PRODUCT_ID'],
|
'offer' => array('externalId' => $product['PRODUCT_ID'],
|
||||||
'xmlId' => $product['PRODUCT_XML_ID']
|
'xmlId' => $product['PRODUCT_XML_ID']
|
||||||
|
@ -1 +1 @@
|
|||||||
- Добавлена обработка изменения номера заказа по истории
|
- Добавлена передача "externalIds" у позиций товаров в заказе
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?
|
<?
|
||||||
$arModuleVersion = array(
|
$arModuleVersion = array(
|
||||||
"VERSION" => "5.2.4",
|
"VERSION" => "5.2.5",
|
||||||
"VERSION_DATE" => "2019-12-10 15:03:00"
|
"VERSION_DATE" => "2019-12-23 17:03:00"
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user