S
S
s1llver2017-06-10 21:37:04
CMS
s1llver, 2017-06-10 21:37:04

Bitrix display property bound to element?

c0fc5290a93345ef8bc1cd5445afa5f8.pngHi Everyone, you need to display the property attached to the element, in my case, the id to which the element is attached is displayed. The question is how to display the values ​​of the property itself and not the value of the element to which it is attached?
here is the code

if ($arFields['IBLOCK_ID'] == 9) {  
            $ID = $arFields['ID'];
            $arSelect = Array("PROPERTY_DATETIME", "PROPERTY_USER", "PROPERTY_CLINIC", "PROPERTY_DOCTORS");
            $arFilter = Array("IBLOCK_ID"=>9, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y", "ID" => $ID);
            $res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
            if ($res->SelectedRowsCount() == 1) {
                if ($GLOBALS['compare']["ID"] == $ID) {
                    while($ob = $res->Fetch()){
                        // Получаем новую дату
                        $date_time = $ob['PROPERTY_DATETIME_VALUE'];
                        $clinic = $ob['PROPERTY_CLINIC_VALUE'];
            //вот тут выводится не само свойствао а id привязанного
                        $doctors = $ob['PROPERTY_DOCTORS_VALUE'];

                        $user = getUserLoginById($ob['PROPERTY_USER_VALUE']);
                        $user_lang = getUserLangById($ob['PROPERTY_USER_VALUE']);
                        $user_id =  $ob['PROPERTY_USER_VALUE'];


                    }
    }
    }
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Georgy Bondarenko, 2017-06-13
@Koen777

Instead of Fetch in line
Use GetNextElement
To get the fields do this
To get the properties do this
This is inside the while loop.
You can read more here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question