示例#1
0
 public static function getDiscountsApplyResult(\Bitrix\Sale\Order $order, $needRecalculate = false)
 {
     static $calcResults = null;
     if ($calcResults === null || $needRecalculate) {
         /** @var \Bitrix\Sale\Result $r */
         $r = $order->getDiscount()->calculate();
         if ($r->isSuccess()) {
             $discountData = $r->getData();
             $order->applyDiscount($discountData);
             $calcResults = $order->getDiscount()->getApplyResult(true);
         }
     }
     return $calcResults === null ? array() : $calcResults;
 }