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

price history fix

This commit is contained in:
Grisha Pomadchin 2013-11-06 15:24:22 +04:00
parent 2f83fed243
commit 3d2ac096d2

View File

@ -551,13 +551,13 @@ class ICrmOrderActions
$arProduct['PRICE'] = (double) $item['initialPrice']; $arProduct['PRICE'] = (double) $item['initialPrice'];
if (isset($item['discount']) && $item['discount']) { if (isset($item['discount']) && $item['discount']) {
$arProduct['PRICE'] = $arProduct['PRICE'] - (double) $item['disount'];
$arProduct['DISCOUNT_PRICE'] = $item['discount']; $arProduct['DISCOUNT_PRICE'] = $item['discount'];
$arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE'];
} }
if (isset($item['discountPercent']) && $item['discountPercent']) { if (isset($item['discountPercent']) && $item['discountPercent']) {
//$arProducts['PRICE'] -- how ?
$arProduct['DISCOUNT_VALUE'] = $item['discountPercent']; $arProduct['DISCOUNT_VALUE'] = $item['discountPercent'];
$arProduct['PRICE'] = floor ($arProduct['PRICE'] / 100 * (100 - $arProduct['DISCOUNT_VALUE']));
} }
if (isset($item['offer']['name']) && $item['offer']['name']) if (isset($item['offer']['name']) && $item['offer']['name'])
@ -565,21 +565,20 @@ class ICrmOrderActions
CSaleBasket::Add($arProduct); CSaleBasket::Add($arProduct);
continue; continue;
} }
// update old // update old
if (isset($item['initialPrice']) && $item['initialPrice']) if (isset($item['initialPrice']) && $item['initialPrice'])
$arProduct['PRICE'] = (double) $item['initialPrice']; $arProduct['PRICE'] = (double) $item['initialPrice'];
if (isset($item['dicount']) && $item['discount']) { if (isset($item['discount']) && $item['discount']) {
$arProduct['PRICE'] = $arProduct['PRICE'] - (double) $item['disount'];
$arProduct['DISCOUNT_PRICE'] = $item['discount']; $arProduct['DISCOUNT_PRICE'] = $item['discount'];
$arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE'];
} }
if (isset($item['discountPercent']) && $item['discountPercent']) { if (isset($item['discountPercent']) && $item['discountPercent']) {
//$arProducts['PRICE'] -- how ?
$arProduct['DISCOUNT_VALUE'] = $item['discountPercent']; $arProduct['DISCOUNT_VALUE'] = $item['discountPercent'];
$arProduct['PRICE'] = floor ($arProduct['PRICE'] / 100 * (100 - $arProduct['DISCOUNT_VALUE']));
} }
if (isset($item['quantity']) && $item['quantity']) if (isset($item['quantity']) && $item['quantity'])
@ -595,7 +594,7 @@ class ICrmOrderActions
// orderUpdate // orderUpdate
$arFields = self::clearArr(array( $arFields = self::clearArr(array(
'PRICE_DELIVERY' => $order['deliveryCost'], 'PRICE_DELIVERY' => $order['deliveryCost'],
'PRICE' => $order['summ'], 'PRICE' => $order['summ'] + (double) $order['deliveryCost'],
'DATE_MARKED' => $order['markDatetime'], 'DATE_MARKED' => $order['markDatetime'],
'USER_ID' => $userId, //$order['customer'] 'USER_ID' => $userId, //$order['customer']
'PAY_SYSTEM_ID' => $optionsPayTypes[$order['paymentType']], 'PAY_SYSTEM_ID' => $optionsPayTypes[$order['paymentType']],