Answer the question
In order to leave comments, you need to log in
How to display the delivery status as part of an order in 1s Bitrix?
Good afternoon!
I need to display the shipment status of an order. I tried to do it with
<?= htmlspecialcharsbx($shipment['STATUS_NAME'])?>but I get the last value of the array. As I understand it, you need to rewrite the Basket or Shipment class. Tell me in which direction to move?
Answer the question
In order to leave comments, you need to log in
Are you changing some component or writing your own? At least give the code or the name of the component that you edit from the standard ones, it's not clear. It is somehow not right to start from the "familiar" $shipment, you need to understand what is in this variable.
As I understand it, you need to rewrite the Basket or Shipment class
$orderId = 57024;
\Bitrix\Main\Loader::includeModule('sale');
$order = \Bitrix\Sale\Order::load($orderId);
$shipmentCollection = $order->getShipmentCollection();
/** @var \Bitrix\Sale\Shipment $shipment */
foreach ($shipmentCollection as $shipment) {
if($shipment->isSystem()) {
continue;
}
$statusCode = $shipment->getField('STATUS_ID');
$statusLang = \Bitrix\Sale\StatusLangTable::getList(
[
'filter' => [
'ID' => $statusCode,
'LID' => LANGUAGE_ID
]
]
)->fetchAll();
var_dump($statusLang);
}
array (size=1)
0 =>
array (size=4)
'STATUS_ID' => string 'DN' (length=2)
'LID' => string 'ru' (length=2)
'NAME' => string 'Ожидает обработки' (length=33)
'DESCRIPTION' => string 'Ожидает обработки' (length=33)
As I understand it, you need to rewrite the Basket or Shipment class. Tell me in which direction to move?
but I get the last value of the array.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question