Created
October 16, 2018 07:02
-
-
Save Pum-purum/3be4072b4c827398ea790c13f509853f to your computer and use it in GitHub Desktop.
Получить ID инфоблока по его коду
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
function GetIBlockIDByCode($code, $type = '') | |
{ | |
CModule::IncludeModule("iblock"); | |
$arrFilter = array( | |
'ACTIVE' => 'Y', | |
'CODE' => $code, | |
'SITE_ID' => "s1", | |
); | |
if ($type) { | |
$arrFilter['TYPE'] = $type; | |
} | |
$res = CIBlock::GetList(Array("SORT" => "ASC"), $arrFilter, false); | |
$arIBlockId = ""; | |
if ($ar_res = $res->Fetch()) { | |
$arIBlockId = $ar_res["ID"]; | |
} | |
return $arIBlockId; | |
} |
AlekseiKhilko
commented
May 19, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment