$order = \Bitrix\Sale\Order::load($arOrder['ID']);
$shipmentCollection = $order->getShipmentCollection();
$stores = \Bitrix\Sale\Delivery\ExtraServices\Manager::getExtraServicesList($arOrder['DELIVERY_ID']);
foreach ($shipmentCollection as $shipment){
$extra = $shipment->getExtraServices(); //массив значений доп.услуги, типа array([10]=>'Y')
if(!empty($extra)){
foreach($extra as $key => $value){
if($value == 'Y')
echo $stores[$key]['NAME']; // получаем наименование доп. услуги
}
}
}
if (!\Bitrix\Main\Loader::IncludeModule('iblock'))
die();
if (!\Bitrix\Main\Loader::IncludeModule('sale'))
die();
if (!\Bitrix\Main\Loader::IncludeModule('catalog'))
die();
global $APPLICATION, $USER;
//объект заказа
$order = \Bitrix\Sale\Order::load($orderID);
//скидки
$discountData = $order->getDiscount()->getApplyResult(); //скидки
$discount = $discountData['PRICES']['BASKET'];
//корзина
$basket = $order->getBasket();
$arBasket = $basket->getListOfFormatText();
foreach( $arBasket as $kBastetItem=>$vBastetItem)
{
$tmp = $discount[$kBastetItem];
if(isset($tmp['DISCOUNT']) && (int)$tmp['DISCOUNT'] > 0)
$arBasket[$kBastetItem] .= '(скидка '.SaleFormatCurrency($tmp['DISCOUNT'], "RUB") . ')';
}
//доставка
$dilevery = array('Служба доставки: ');
//отгрузки
$shipmentCollection = $order->getShipmentCollection();
foreach($shipmentCollection as $shipment) {
$shipment_id = $shipment->getId();
if ($shipment->isSystem())
continue;
$dilevery[0] .= $shipment->getField("DELIVERY_NAME");
$dileveryId = $shipment->getField("DELIVERY_ID");
$dileveryPrice = $order->getDeliveryPrice();
if((float)$dileveryPrice > 0)
$dilevery[0] .= ' ('.SaleFormatCurrency($dileveryPrice , "RUB") . ')';
$ExtraServices = \Bitrix\Sale\Delivery\ExtraServices\Manager::getExtraServicesList($dileveryId);
if(!empty($ExtraServices)){
$shipmentExtraServices = \Bitrix\Sale\Delivery\ExtraServices\Manager::getValuesForShipment($shipment_id,$dileveryId);
foreach($ExtraServices as $k => $v) {
$dilevery[1] = $v["PARAMS"]["PRICES"][$shipmentExtraServices[$k]]['TITLE'];
}
}
}
//св-ва заказа
$arProp = array();
$propertyCollection = $order->getPropertyCollection();
foreach ($propertyCollection as $k => $property)
{
$v = $property ->getValue();
if(!empty($v)){
$tmp = $property -> getProperty();
if( $tmp['CODE'] == 'KURERDOSTAVKA')
continue;
if($tmp['CODE'] == 'PUNCKTVIDACHI'){
$dilevery[1] = $tmp['NAME'].': '.$dilevery[1];
}
else
{
$arProp[$tmp['NAME']] = $v;
}
}
}
//Платежная система
$paymentCollection = $order->getPaymentCollection();
foreach ($paymentCollection as $payment) {
$psID = $payment->getPaymentSystemId(); // ID платежной системы
$psName = $payment->getPaymentSystemName();
}
//массив результатов
$arResult = array_values($arBasket);
$arResult[] = '';
$arResult = array_merge($arResult,$dilevery);
$arResult[] = 'Способ оплаты: '. ($psID == 11 ? "Оплата картой" : $psName);
$arResult[] = '';
foreach($arProp as $k=>$v)
{
$arResult[] = $k.': '.$v;
}
//комментарий к заказу
$USER_DESCRIPTION = $order->getField("USER_DESCRIPTION");
if(!empty( $USER_DESCRIPTION )){
$arResult[] = '';
$arResult[] = 'Комментарий к заказу:';
$arResult[] = $USER_DESCRIPTION;
}
//$arResult[] = '';
//$arResult[] = 'Сумма заказа: '.SaleFormatCurrency($order->getField('PRICE') , "RUB");
$arFields['ORDER_LIST'] = implode("<br>", $arResult);