Renderlife
9/18/2018 - 10:42 AM

Получение данных из инфоблока по ids

public function getTerms($ids = [])
{
    $id = LS_TERM_IBLOCK_ID;
    $arItems = [];
    $arSelect = ["ID", 'NAME', 'DETAIL_TEXT'];
    $arFilter = ["IBLOCK_ID" => IntVal($id), "ID" => $ids, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y"];
    $res = \CIBlockElement::GetList([], $arFilter, false, false, $arSelect);
    while ($ob = $res->GetNextElement()) {
        $arFields = $ob->GetFields();
        $arItems[] = [
            'ID' => $arFields['ID'],
            'NAME' => $arFields['NAME'],
            'DESC' => $arFields['DETAIL_TEXT'],
        ];
    }
    return $arItems;
}