1
0
mirror of synced 2024-11-22 13:26:10 +03:00

fix rewriting item

This commit is contained in:
Evgeniy-Goroh 2020-04-30 11:56:43 +03:00 committed by GitHub
parent 1cee1ff6af
commit 5f7f234dd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -159,6 +159,7 @@ class RetailCrmOrder
$externalId = $position . "_" . $product['PRODUCT_ID']; $externalId = $position . "_" . $product['PRODUCT_ID'];
if (isset($orderItems[$externalId])) { //update if (isset($orderItems[$externalId])) { //update
$externalIds = $orderItems[$externalId]['externalIds']; $externalIds = $orderItems[$externalId]['externalIds'];
$itemId = $orderItems[$externalId]['id'];
$key = array_search("bitrix", array_column($externalIds, 'code')); $key = array_search("bitrix", array_column($externalIds, 'code'));
if ($externalIds[$key]['code'] == "bitrix") { if ($externalIds[$key]['code'] == "bitrix") {
$externalIds[$key] = array( $externalIds[$key] = array(
@ -189,6 +190,10 @@ class RetailCrmOrder
'productName' => $product['NAME'] 'productName' => $product['NAME']
); );
if (isset($itemId)) {
$item['id'] = $itemId;
}
$pp = CCatalogProduct::GetByID($product['PRODUCT_ID']); $pp = CCatalogProduct::GetByID($product['PRODUCT_ID']);
if (is_null($pp['PURCHASING_PRICE']) == false) { if (is_null($pp['PURCHASING_PRICE']) == false) {
if ($pp['PURCHASING_CURRENCY'] && $currency != $pp['PURCHASING_CURRENCY']) { if ($pp['PURCHASING_CURRENCY'] && $currency != $pp['PURCHASING_CURRENCY']) {