M
M
Maxim Morozov2021-04-08 13:13:42
1C-Bitrix
Maxim Morozov, 2021-04-08 13:13:42

How to get the 1s Bitrix location ID knowing its character code?

The character code is taken from the multiregionality module and passed to the filter, but in the end I get an empty result...

if (Bitrix\Main\Loader::includeModule('twofingers.location'))
$location = \TwoFingers\Location\Entity\Location::buildCurrent();
$smp = $location->getPrimary();

$arElm = CSaleLocation::GetList(array(), array('CODE' => $smp), false, false, array('ID'))->Fetch();

if ($arElm)

    $resultmp = (int) $arElm['ID'];

echo $resultmp;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
ExtraD, 2021-04-09
@ExtraD

function getLocationByCode(string $locationCode){
  return \CSaleLocation::getLocationIDbyCODE($locationCode);
}

https://bxapi.ru/src/?module_id=sale&name=CSaleLoc...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question