2021-12-03 08:40:16 +03:00

36 lines
858 B
PHP

<?
function get_related($iblock_id, $id)
{
$res = CIBlockElement::GetList(Array("NAME" => "ASC"), Array("IBLOCK_ID" => $iblock_id, "ID" => $id, "ACTIVE" => "Y"), false, Array("nPageSize" => 1000));
$ar_res = Array();
while ($obElement = $res->GetNextElement())
{
$ar_res = $obElement->GetFields();
$ar_res['PROPERTIES'] = $obElement->GetProperties();
}
return $ar_res;
}
function get_related_array($iblock_id, $ids)
{
$ar_res = Array();
foreach($ids AS $id)
{
$res = CIBlockElement::GetList(Array("NAME" => "ASC"), Array("IBLOCK_ID" => $iblock_id, "ID" => $id, "ACTIVE" => "Y"), false, Array("nPageSize" => 1000));
while ($obElement = $res->GetNextElement())
{
$ar_res_element = $obElement->GetFields();
$ar_res_element['PROPERTIES'] = $obElement->GetProperties();
$ar_res[] = $ar_res_element;
}
}
return $ar_res;
}
?>