Июнь 2, 2018
Работа с отгрузками заказа средствами классов "\Bitrix\Sale\Internals\ShipmentTable", "\Bitrix\Sale\Internals\ShipmentExtraServiceTable" и др.
Получение всех отгрузок заказа с идентификатором из переменной $orderId:
Получение склада самовывоза для заказа с идентификатором в переменной $orderId и запись информации о складе в переменную $arStore:
\Bitrix\Main\Loader::IncludeModule("catalog");
$rsShipment = \Bitrix\Sale\Internals\ShipmentTable::getList(array(
'filter'=>array('ORDER_ID' => $orderId),
));
while($arShipment=$rsShipment->fetch())
{
$rsExtraService = \Bitrix\Sale\Internals\ShipmentExtraServiceTable::getList(array('filter'=> array(
'SHIPMENT_ID' => $arShipment['ID'],
'EXTRA_SERVICE_ID' => '3', // ID дополнительного сервиса, можно посмотреть в таблице b_sale_order_delivery_es
)));
while($arExtraService = $rsExtraService->fetch())
{
if(!!$arExtraService['VALUE'])
{
$arStore = \Bitrix\Catalog\StoreTable::getById($arExtraService['VALUE'])->fetch();
break 2;
}
}
}
Получение коллекции отгрузок из объекта заказа в переменной $order:
Пример данных отгрузки:
Array
(
[ID] => 781
[ORDER_ID] => 391
[ACCOUNT_NUMBER] => 391/1
[DATE_INSERT] => Bitrix\Main\Type\DateTime Object
(
[value:protected] => DateTime Object
(
[date] => 2018-06-01 00:44:59.000000
[timezone_type] => 3
[timezone] => Europe/Moscow
)
)
[STATUS_ID] => DN
[DELIVERY_LOCATION] =>
[BASE_PRICE_DELIVERY] =>
[PRICE_DELIVERY] =>
[CUSTOM_PRICE_DELIVERY] => N
[CURRENCY] =>
[DISCOUNT_PRICE] =>
[ALLOW_DELIVERY] => N
[DATE_ALLOW_DELIVERY] =>
[EMP_ALLOW_DELIVERY_ID] =>
[DEDUCTED] => N
[DATE_DEDUCTED] =>
[EMP_DEDUCTED_ID] =>
[REASON_UNDO_DEDUCTED] =>
[RESERVED] => N
[DELIVERY_ID] => 4
[DELIVERY_DOC_NUM] =>
[DELIVERY_DOC_DATE] =>
[TRACKING_NUMBER] =>
[TRACKING_STATUS] =>
[TRACKING_DESCRIPTION] =>
[TRACKING_LAST_CHECK] =>
[TRACKING_LAST_CHANGE] =>
[XML_ID] =>
[PARAMS] =>
[DELIVERY_NAME] => Самовывоз из бесплатного пункта выдачи
[CANCELED] => N
[DATE_CANCELED] =>
[EMP_CANCELED_ID] =>
[REASON_CANCELED] =>
[MARKED] => N
[DATE_MARKED] =>
[EMP_MARKED_ID] =>
[REASON_MARKED] =>
[SYSTEM] => Y
[RESPONSIBLE_ID] =>
[EMP_RESPONSIBLE_ID] =>
[DATE_RESPONSIBLE_ID] =>
[COMMENTS] =>
[COMPANY_ID] =>
[UPDATED_1C] => N
[ID_1C] =>
[VERSION_1C] =>
[EXTERNAL_DELIVERY] => N
)