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

discount fix

This commit is contained in:
Grisha Pomadchin 2013-11-15 17:26:51 +04:00
parent 344a952f99
commit fae73904d2

View File

@ -561,16 +561,17 @@ class ICrmOrderActions
if (isset($item['discount'])) { if (isset($item['discount'])) {
$arProduct['DISCOUNT_PRICE'] = $item['discount']; $arProduct['DISCOUNT_PRICE'] = $item['discount'];
$arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE'];
} }
if (isset($item['discountPercent'])) { if (isset($item['discountPercent'])) {
$arProduct['DISCOUNT_VALUE'] = $item['discountPercent']; $arProduct['DISCOUNT_VALUE'] = $item['discountPercent'];
$newPrice = floor ($arProduct['PRICE'] / 100 * (100 - $arProduct['DISCOUNT_VALUE'])); $newPrice = floor ($arProduct['PRICE'] / 100 * (100 - $arProduct['DISCOUNT_VALUE']));
$arProduct['DISCOUNT_PRICE'] = $arProduct['PRICE'] - $newPrice; $arProduct['DISCOUNT_PRICE'] = $arProduct['DISCOUNT_PRICE'] + $arProduct['PRICE'] - $newPrice;
$arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE'];
} }
if(isset($item['discount']) || isset($item['discountPercent']))
$arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE'];
if (isset($item['offer']['name']) && $item['offer']['name']) if (isset($item['offer']['name']) && $item['offer']['name'])
$arProduct['NAME'] = $item['offer']['name']; $arProduct['NAME'] = $item['offer']['name'];
@ -584,16 +585,17 @@ class ICrmOrderActions
if (isset($item['discount'])) { if (isset($item['discount'])) {
$arProduct['DISCOUNT_PRICE'] = $item['discount']; $arProduct['DISCOUNT_PRICE'] = $item['discount'];
$arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE'];
} }
if (isset($item['discountPercent'])) { if (isset($item['discountPercent'])) {
$arProduct['DISCOUNT_VALUE'] = $item['discountPercent']; $arProduct['DISCOUNT_VALUE'] = $item['discountPercent'];
$newPrice = floor ($arProduct['PRICE'] / 100 * (100 - $arProduct['DISCOUNT_VALUE'])); $newPrice = floor ($arProduct['PRICE'] / 100 * (100 - $arProduct['DISCOUNT_VALUE']));
$arProduct['DISCOUNT_PRICE'] = $arProduct['PRICE'] - $newPrice; $arProduct['DISCOUNT_PRICE'] = $arProduct['DISCOUNT_PRICE'] + $arProduct['PRICE'] - $newPrice;
$arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE'];
} }
if(isset($item['discount']) || isset($item['discountPercent']))
$arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE'];
if (isset($item['quantity']) && $item['quantity']) if (isset($item['quantity']) && $item['quantity'])
$arProduct['QUANTITY'] = $item['quantity']; $arProduct['QUANTITY'] = $item['quantity'];
@ -852,7 +854,7 @@ class ICrmOrderActions
'initialPrice' => (double) $p['PRICE'] + (double) $p['DISCOUNT_PRICE'], 'initialPrice' => (double) $p['PRICE'] + (double) $p['DISCOUNT_PRICE'],
//'purchasePrice' => $pr, //'purchasePrice' => $pr,
'discount' => $p['DISCOUNT_PRICE'], 'discount' => $p['DISCOUNT_PRICE'],
'discountPercent' => $p['DISCOUNT_VALUE'], //'discountPercent' => $p['DISCOUNT_VALUE'],
'quantity' => $p['QUANTITY'], 'quantity' => $p['QUANTITY'],
'productId' => $p['PRODUCT_ID'], 'productId' => $p['PRODUCT_ID'],
'productName' => self::toJSON($p['NAME']) 'productName' => self::toJSON($p['NAME'])