diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php index 7badf05c..d356aaf5 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php @@ -654,11 +654,11 @@ class RetailCrmHistory $orderTemp = $response['order']; $ditems = []; foreach ($orderTemp['items'] as $item) { - $ditems[$item['offer']['xmlId']]['quantity'] += $item['quantity']; - $ditems[$item['offer']['xmlId']]['discountTotal'] += $item['quantity'] * $item['discountTotal']; - $ditems[$item['offer']['xmlId']]['initialPrice'] = (float)$item['initialPrice']; - $ditems[$item['offer']['xmlId']]['price_sum'] = $ditems[$item['offer']['xmlId']]['initialPrice'] * $ditems[$item['offer']['xmlId']]['quantity'] - $ditems[$item['offer']['xmlId']]['discountTotal']; - $ditems[$item['offer']['xmlId']]['price_item'] = $ditems[$item['offer']['xmlId']]['price_sum'] / $ditems[$item['offer']['xmlId']]['quantity']; + $ditems[$item['offer']['externalId']]['quantity'] += $item['quantity']; + $ditems[$item['offer']['externalId']]['discountTotal'] += $item['quantity'] * $item['discountTotal']; + $ditems[$item['offer']['externalId']]['initialPrice'] = (float)$item['initialPrice']; + $ditems[$item['offer']['externalId']]['price_sum'] = $ditems[$item['offer']['externalId']]['initialPrice'] * $ditems[$item['offer']['externalId']]['quantity'] - $ditems[$item['offer']['externalId']]['discountTotal']; + $ditems[$item['offer']['externalId']]['price_item'] = $ditems[$item['offer']['externalId']]['price_sum'] / $ditems[$item['offer']['externalId']]['quantity']; } unset($orderTemp); } @@ -666,8 +666,8 @@ class RetailCrmHistory $log->write($ditems, 'duplicateItemsOrderHistory'); foreach ($order['items'] as $product) { - if($ditems[$product['offer']['xmlId']]['quantity']){ - $product['quantity'] = $ditems[$product['offer']['xmlId']]['quantity']; + if($ditems[$product['offer']['externalId']]['quantity']){ + $product['quantity'] = $ditems[$product['offer']['externalId']]['quantity']; } $item = self::getExistsItem($basket, 'catalog', $product['offer']['externalId']); @@ -703,7 +703,7 @@ class RetailCrmHistory } if ($product['delete']) { - if ($ditems[$product['offer']['xmlId']]['quantity'] <= 0) { + if ($ditems[$product['offer']['externalId']]['quantity'] <= 0) { $item->delete(); continue; @@ -737,8 +737,8 @@ class RetailCrmHistory $item->setField('PRICE', $itemCost - $resultDiscount); //set price dublicate item - if ($ditems[$product['offer']['xmlId']]['price_item']) { - $item->setField('PRICE', $ditems[$product['offer']['xmlId']]['price_item']); + if ($ditems[$product['offer']['externalId']]['price_item']) { + $item->setField('PRICE', $ditems[$product['offer']['externalId']]['price_item']); $item->setField('DISCOUNT_PRICE', ''); } } diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index a2a82e24..5f3b05c4 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1,3 +1 @@ -- Исправление при обработке полученных изменений о контрагенте -- При обработки истории по клиентам добавлены кастомные поля -- Исправлены мелкие ошибки и недочеты +- При обработке истории сбор по дублирующим товарам заменен на "externalId"