本文整理匯總了PHP中Bitrix\Sale\Order::getDiscount方法的典型用法代碼示例。如果您正苦於以下問題:PHP Order::getDiscount方法的具體用法?PHP Order::getDiscount怎麽用?PHP Order::getDiscount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bitrix\Sale\Order
的用法示例。
在下文中一共展示了Order::getDiscount方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getTotalPrices
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;
}