public static function getTotalPrices(Order $order, OrderBasket $orderBasket, $needRecalculate = true) { $result = array('PRICE_TOTAL' => $order->getPrice(), 'TAX_VALUE' => $order->getTaxValue(), 'PRICE_DELIVERY_DISCOUNTED' => $order->getDeliveryPrice(), 'SUM_PAID' => $order->getSumPaid()); $result["SUM_UNPAID"] = $result["PRICE_TOTAL"] - $result["SUM_PAID"]; if (!$result["PRICE_DELIVERY_DISCOUNTED"]) { $result["PRICE_DELIVERY_DISCOUNTED"] = 0; } if (!$result["TAX_VALUE"]) { $result["TAX_VALUE"] = 0; } $orderDiscount = $order->getDiscount(); if ($orderDiscount) { $discountsList = self::getDiscountsApplyResult($order, $needRecalculate); } else { $discountsList = array(); } if (isset($discountsList["PRICES"]["DELIVERY"]["DISCOUNT"])) { $result['DELIVERY_DISCOUNT'] = $discountsList["PRICES"]["DELIVERY"]["DISCOUNT"]; } else { $result['DELIVERY_DISCOUNT'] = 0; } $result['PRICE_DELIVERY'] = $result['PRICE_DELIVERY_DISCOUNTED'] + $result['DELIVERY_DISCOUNT']; $basketData = $orderBasket->prepareData(array("DISCOUNTS" => $discountsList)); $result["PRICE_BASKET_DISCOUNTED"] = $basketData["BASKET_PRICE"]; $result["PRICE_BASKET"] = $basketData["BASKET_PRICE_BASE"]; return $result; }