I
I
Ilya2020-02-13 15:16:41
1C-Bitrix
Ilya, 2020-02-13 15:16:41

How to display the xml_id of the selected property value of the list type?

Hello.
Infoblock elements are displayed on the page, each has a property of the list type and one of the values ​​is selected, how to get exactly the selected value? Found only how to get a list of all options.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2020-02-13
@Firsov36

If the version of Bitrix is ​​later than autumn 2019, then it is possible through ORM

$iblock = \Bitrix\Iblock\Iblock::wakeUp(9);
$elements = $iblock->getEntityDataClass()::getList(
    [
        'filter' => ['ID' => 28770],
        'select' => ['ID', 'C_CATALOG_LABELS']
    ]
)->fetch();
\Bitrix\Main\Diag\Debug::dump($elements);

9 - infoblock ID 28770 - infoblock element ID
C_CATALOG_LABELS - property code. well, the code can be redone for several elements or all at once, several properties. Instead of fetch(), use fetchCollection(), etc.. if you need the old methods, I can write tomorrow if they don’t answer me..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question