Skip to content

Instantly share code, notes, and snippets.

@sukhikh18
Forked from VSeryoga/location_bitrix.php
Last active July 31, 2018 09:25
Show Gist options
  • Save sukhikh18/339a204ab121dfdf270bf740bc2c9081 to your computer and use it in GitHub Desktop.
Save sukhikh18/339a204ab121dfdf270bf740bc2c9081 to your computer and use it in GitHub Desktop.
Местоположения Битрикс
<?
$res = \Bitrix\Sale\Location\LocationTable::getList(array(
'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID, 'TYPE_CODE' => array("VILLAGE", "CITY"), 'NAME_RU' => array($_POST["city"], $_POST["city"]." %")),
'select' => array('*', 'NAME_RU' => 'NAME.NAME', 'TYPE_CODE' => 'TYPE.CODE'),
'limit' => 10
));
while($item = $res->fetch())
{
$loc[$item["ID"]] = $item;
$ids[] = $item["PARENT_ID"];
echo Bitrix\Sale\Location\Admin\LocationHelper::getLocationPathDisplay($item["CODE"])."<br>";
}
//"VILLAGE", "CITY" -поселок или город
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment