コード例 #1
0
ファイル: component.php プロジェクト: Satariall/izurit
         }
     }
 }
 $bFirst = True;
 $bFound = false;
 $bSelected = false;
 $shipment = CSaleDelivery::convertOrderOldToNew(array("SITE_ID" => SITE_ID, "WEIGHT" => $arResult["ORDER_WEIGHT"], "PRICE" => $arResult["ORDER_PRICE"], "LOCATION_TO" => isset($arUserResult["DELIVERY_LOCATION_BCODE"]) ? $arUserResult["DELIVERY_LOCATION_BCODE"] : $arUserResult["DELIVERY_LOCATION"], "LOCATION_ZIP" => $arUserResult["DELIVERY_LOCATION_ZIP"], "ITEMS" => $arResult["BASKET_ITEMS"], "CURRENCY" => $arResult["BASE_LANG_CURRENCY"]));
 if (!empty($arUserResult["PAY_SYSTEM_ID"]) && $arParams["DELIVERY_TO_PAYSYSTEM"] == "p2d") {
     /** @var \Bitrix\Sale\Order $order */
     $order = $shipment->getCollection()->getOrder();
     /** @var \Bitrix\Sale\Payment $payment */
     $payment = $order->getPaymentCollection()->createItem();
     $payment->setField("PAY_SYSTEM_ID", $arUserResult["PAY_SYSTEM_ID"]);
 }
 /** @var \Bitrix\Sale\Delivery\Services\Base[]  $arDeliveryServiceAll */
 $arDeliveryServiceAll = \Bitrix\Sale\Delivery\Services\Manager::getServicesForShipment($shipment);
 if (intval($arUserResult["DELIVERY_ID"]) > 0) {
     $bFound = array_key_exists($arUserResult["DELIVERY_ID"], $arDeliveryServiceAll);
 }
 if (!$bFound && !empty($arUserResult["DELIVERY_ID"])) {
     $arUserResult["DELIVERY_ID"] = "";
     $arResult["DELIVERY_PRICE"] = 0;
     $arResult["DELIVERY_PRICE_FORMATED"] = "";
 }
 foreach ($arDeliveryServiceAll as $deliveryObj) {
     if (count($arP2D[$arUserResult["PAY_SYSTEM_ID"]]) <= 0 || in_array($deliveryObj->getCode(), $arP2D[$arUserResult["PAY_SYSTEM_ID"]])) {
         if ($deliveryObj->isProfile()) {
             $name = $deliveryObj->getNameWithParent();
         } else {
             $name = $deliveryObj->getName();
         }