Answer the question
In order to leave comments, you need to log in
How to display multiple properties of the "binding to element" type in Bitrix?
Hello dear programmers. Please tell me what is wrong. I am attaching a code snippet that outputs a multiple property of the "binding to element" type. The elements themselves seem to be displayed (I attached three elements, three elements and it came out), but they are displayed empty, the name and picture are not displayed, an error occurs - prntscr.com/pgkuya
<?foreach($arItem["PROPERTIES"]["DOCTOR"]["VALUE"] as $analog):?>
<?$res = CIBlockElement::GetByID($analog);?>
<?if($ar_res = $res->GetNext())?>
<h2><?=$arItem["DOCTOR"]["NAME"]?></h2>
<img alt="<?=$arItem["DOCTOR"]["NAME"]?>" src="<?=CFile::GetPath($arItem["DOCTOR"]["PREVIEW_PICTURE"])?>">
<?endforeach;?>
Answer the question
In order to leave comments, you need to log in
You have the query result in the $ar_res array, and the call to $arItem
is correct
<?foreach($arItem["PROPERTIES"]["DOCTOR"]["VALUE"] as $analog):?>
<?$res = CIBlockElement::GetByID($analog);?>
<?if($ar_res = $res->GetNext()):?>
<h2><?=$ar_res["NAME"]?></h2>
<img alt="<?=$ar_res["NAME"]?>" src="<?=CFile::GetPath($ar_res["PREVIEW_PICTURE"])?>">
<?endif?>
<?endforeach;?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question