Как вытащить связанные элементы в Битриксе



<?$arSelect = Array("ID", "NAME", "DETAIL_PAGE_URL", "PROPERTY_OTGR1", "PROPERTY_CML2_MANUFACTURER", "DETAIL_PICTURE", "CATALOG_PRICE_1", "PROPERTY_MINIMUM_PRICE");
$arFilter = Array("IBLOCK_ID"=>40, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y", "PROPERTY_CML2_LINK" => $arResult["ID"]);
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>50), $arSelect);
$elements = [];
while($ob = $res->GetNextElement()){
$arFields = $ob->GetFields();
$elements[] = $arFields;
}
if(!empty($elements)):
?>
<h2 class="centerheader">Аналоги</h2>
<table class="tab1" id="item_list_1">
<tr><th class="header">Производитель</th><th class="naim header">Наименование</th><th class="header">Отгрузка</th><th class="header">Фото</th><th class="header headerSortDown">Цена</th><th class="header"></th></tr>
<?foreach($elements as $elem):?>

<tr <?if(strpos($APPLICATION->GetCurPageParam(),"offer=".$elem["ID"])){echo 'class=curr';}?>>
<td><?=$elem["PROPERTY_CML2_MANUFACTURER_VALUE"]?></td>
<td class="naim"><a href="<?=$elem["DETAIL_PAGE_URL"]?>"><?=$elem["NAME"]?></a></td>
<td><?=$elem["PROPERTY_OTGR1_VALUE"]?></td>
<td class="infopic"><?if($elem["DETAIL_PICTURE"]){?><a class="single_image" title="" href="<?=CFile::GetPath($elem["DETAIL_PICTURE"]); ?>"><img src="/images/photo.png" alt="" title=""></a><?}?></td>
<td>-</td>
<td class="add" id="">
<div class="busk-added" style="display:none"></div>
<!--noindex--><span class="buy"></span><!--/noindex-->
</td>
</tr>
<?endforeach;?>
</table>
<?endif;?>


Возврат к списку


-----
-----