Last active
July 31, 2018 09:28
-
-
Save VSeryoga/29a837778bdb95f02271269be3636cce to your computer and use it in GitHub Desktop.
Местоположения Битрикс
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$res = \Bitrix\Sale\Location\LocationTable::getList(array( | |
'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID, 'TYPE_CODE' => array("VILLAGE", "CITY"), 'NAME_RU' => $_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
Посмотри, здесь могут быть проблемы: $_POST["city"]."%". К Примеру ?city="Ува" помимо "Ува посёлок" найдет еще и: "Уварово".