J
J
juli_zzz2021-01-11 17:33:46
1C-Bitrix
juli_zzz, 2021-01-11 17:33:46

How to display a property of type "Binding to element" with a picture?

Good afternoon! There are 2 infoblocks: "Polyclinics" and "Doctors". In each, a property of type "Binding to elements" is created.
In a detailed view of the polyclinic, the doctors were brought out https://kolpino.ru/polikliniki/71/ .
How to make doctors have photos and positions?
Create in template folder result_modifier.php?
What code should I add to result_modifier.php and template file?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton, 2021-01-12
@anton99zel

Non-Multiple "Bind to Element" Property

<? if ($arResult["PROPERTIES"]["Символьныйкодсвойстватекущегоэлемента"]["VALUE"]) {?> 
  <?
  $arPROP = GetIBlockElement($arResult["PROPERTIES"]["Символьныйкодсвойстватекущегоэлемента"]["VALUE"]);
  print_r($arPROP["PROPERTIES"]["Символьныйкодсвойствапривязанногоэлемента"]);
  ?>
<?}?>

What will print_r show?

A
Alexey Emelyanov, 2021-01-14
@babarun

juli_zzz , well, look at

$arResult['DISPLAY_PROPERTIES']['VRACHI']['LINK_ELEMENT_VALUE']

Contains your doctor associated with the clinic:
[LINK_ELEMENT_VALUE] => Array
                        (
                            [160297] => Array
                                (
                                    [ID] => 160297
                                    [IBLOCK_ID] => 30
                                    [NAME] => Магомеднабиев Тагир Шарапудинович
                                    [DETAIL_PAGE_URL] => /vrachi/detail.php?ID=160297
                                    [PREVIEW_PICTURE] => 12009862
                                    [DETAIL_PICTURE] => 12009863
                                    [SORT] => 500
                                    [LANG_DIR] => /
                                    [CODE] => 
                                    [EXTERNAL_ID] => 160297
                                    [IBLOCK_SECTION_ID] => 
                                    [IBLOCK_TYPE_ID] => catalog
                                    [IBLOCK_CODE] => vrachi
                                    [IBLOCK_EXTERNAL_ID] => 
                                    [LID] => s1
                                )
                        )

- it has PREVIEW_PICTURE and DETAIL_PICTURE , they store the IDs of files with the images you need, you get the path to them using CFile::GetPath https://dev.1c-bitrix.ru/api_help/main/reference/c...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question