T
T
TechNOIR2018-03-15 08:41:07
1C-Bitrix
TechNOIR, 2018-03-15 08:41:07

1C-Bitrix. How to get warehouse name by warehouse ID?

Good afternoon.
Can you please tell me how to get the name of the warehouse by the ID of the warehouse?
I get the warehouse ID (storeid) for the order:

use Bitrix\Sale;
$orderId = 68;
$saleOrder = Bitrix\Sale\Order::load($orderId);
$shipmentCollection = $saleOrder->getShipmentCollection();
foreach ($shipmentCollection as $shipment)
{
if (!$shipment->isSystem())
{
$arResult['originalDeliveryId'] = $shipment->getDeliveryId();
$arResult['customPriceDelivery'] = $shipment->getField('CUSTOM_PRICE_DELIVERY');
$arResult['basePrice'] = $shipment->getField('BASE_PRICE_DELIVERY');
$arResult['store_id'] = $shipment->getStoreId();
break;
}
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Nikolaev, 2018-03-15
@TechNOIR

Probably the easiest way is to include the Catalog module and use the corresponding DataMapper:

use \Bitrix\Catalog;

$arStore = Catalog\StoreTable::getRow([
  'select' => ['TITLE'],
  'filter' => [
    'ID' => $iStoreId,
  ]
]);
if ( $arStore )
{
  // В $arStore['TITLE'] название
}
else
{
  // Склад не найден
}

A
AndrewMed, 2019-12-10
@AndrewMed

$storeId - warehouse id

Loader::includeModule('catalog');

$resStores = \CCatalogStore::GetList(
    [],
    ['ID' => $storeId],
    false,
    false,
    ['ID', 'TITLE']
);

$arResult['STORES'] = [];

while ($arStore = $resStores->Fetch()) {
    $arResult['STORES'][] = $arStore ;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question