обработка дублирующих товаров по externalId
This commit is contained in:
parent
0ca164a825
commit
c4109cf1c6
@ -654,11 +654,11 @@ class RetailCrmHistory
|
|||||||
$orderTemp = $response['order'];
|
$orderTemp = $response['order'];
|
||||||
$ditems = [];
|
$ditems = [];
|
||||||
foreach ($orderTemp['items'] as $item) {
|
foreach ($orderTemp['items'] as $item) {
|
||||||
$ditems[$item['offer']['xmlId']]['quantity'] += $item['quantity'];
|
$ditems[$item['offer']['externalId']]['quantity'] += $item['quantity'];
|
||||||
$ditems[$item['offer']['xmlId']]['discountTotal'] += $item['quantity'] * $item['discountTotal'];
|
$ditems[$item['offer']['externalId']]['discountTotal'] += $item['quantity'] * $item['discountTotal'];
|
||||||
$ditems[$item['offer']['xmlId']]['initialPrice'] = (float)$item['initialPrice'];
|
$ditems[$item['offer']['externalId']]['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']['externalId']]['price_sum'] = $ditems[$item['offer']['externalId']]['initialPrice'] * $ditems[$item['offer']['externalId']]['quantity'] - $ditems[$item['offer']['externalId']]['discountTotal'];
|
||||||
$ditems[$item['offer']['xmlId']]['price_item'] = $ditems[$item['offer']['xmlId']]['price_sum'] / $ditems[$item['offer']['xmlId']]['quantity'];
|
$ditems[$item['offer']['externalId']]['price_item'] = $ditems[$item['offer']['externalId']]['price_sum'] / $ditems[$item['offer']['externalId']]['quantity'];
|
||||||
}
|
}
|
||||||
unset($orderTemp);
|
unset($orderTemp);
|
||||||
}
|
}
|
||||||
@ -666,8 +666,8 @@ class RetailCrmHistory
|
|||||||
$log->write($ditems, 'duplicateItemsOrderHistory');
|
$log->write($ditems, 'duplicateItemsOrderHistory');
|
||||||
|
|
||||||
foreach ($order['items'] as $product) {
|
foreach ($order['items'] as $product) {
|
||||||
if($ditems[$product['offer']['xmlId']]['quantity']){
|
if($ditems[$product['offer']['externalId']]['quantity']){
|
||||||
$product['quantity'] = $ditems[$product['offer']['xmlId']]['quantity'];
|
$product['quantity'] = $ditems[$product['offer']['externalId']]['quantity'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = self::getExistsItem($basket, 'catalog', $product['offer']['externalId']);
|
$item = self::getExistsItem($basket, 'catalog', $product['offer']['externalId']);
|
||||||
@ -703,7 +703,7 @@ class RetailCrmHistory
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($product['delete']) {
|
if ($product['delete']) {
|
||||||
if ($ditems[$product['offer']['xmlId']]['quantity'] <= 0) {
|
if ($ditems[$product['offer']['externalId']]['quantity'] <= 0) {
|
||||||
$item->delete();
|
$item->delete();
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@ -737,8 +737,8 @@ class RetailCrmHistory
|
|||||||
$item->setField('PRICE', $itemCost - $resultDiscount);
|
$item->setField('PRICE', $itemCost - $resultDiscount);
|
||||||
|
|
||||||
//set price dublicate item
|
//set price dublicate item
|
||||||
if ($ditems[$product['offer']['xmlId']]['price_item']) {
|
if ($ditems[$product['offer']['externalId']]['price_item']) {
|
||||||
$item->setField('PRICE', $ditems[$product['offer']['xmlId']]['price_item']);
|
$item->setField('PRICE', $ditems[$product['offer']['externalId']]['price_item']);
|
||||||
$item->setField('DISCOUNT_PRICE', '');
|
$item->setField('DISCOUNT_PRICE', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1 @@
|
|||||||
- Исправление при обработке полученных изменений о контрагенте
|
- При обработке истории сбор по дублирующим товарам заменен на "externalId"
|
||||||
- При обработки истории по клиентам добавлены кастомные поля
|
|
||||||
- Исправлены мелкие ошибки и недочеты
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?
|
<?
|
||||||
$arModuleVersion = array(
|
$arModuleVersion = array(
|
||||||
"VERSION" => "2.5.3",
|
"VERSION" => "5.2.4",
|
||||||
"VERSION_DATE" => "2019-11-1 15:10:00"
|
"VERSION_DATE" => "2019-12-9 10:45:00"
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user