V
V
VicTHOR2019-05-14 16:16:47
1C-Bitrix
VicTHOR, 2019-05-14 16:16:47

How to get the values ​​of a certain infoblock?

There is an infoblock, there are sections in it and each section has properties, I need to get these properties, do not display anything.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
VicTHOR, 2019-05-17
@VicTHOR

That's what I needed .. figured it out.

$arFilter = array(
    'IBLOCK_ID' => 12,
    'ACTIVE' => 'Y',
);

$res = CIBlockElement::GetList(array(), $arFilter, false, false, array());
while ($try = $res->GetNextElement())
{
    $el = $try->GetProperty("CML2_ARTICLE");
    echo '<pre>';
    print_r($el);
    echo '<hr/></pre>';
}

$arFilter - set the infoblock to display only active elements.
CIBlockElement::GetList, not CIBlockSection::GetList, because CIBlockSection only retrieves infoblock sections.
GetList() returns an object that has a GetNextElement method that iterates over each element.
Next, I get the properties of these elements $el = $try->GetProperties();
In my case, I used GetProperty with a specific property, otherwise there are too many elements and a memory error.

A
Anton, 2019-05-14
@anton99zel

CIBlockSection::GetList

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question