B
B
bitrix0ID2019-08-07 12:48:09
1C-Bitrix
bitrix0ID, 2019-08-07 12:48:09

Why doesn't the "PROPERTY_*" filter work?

Why might "PROPERTY_*" in the filter for CIBlockElement::getList not work? I do it like this:

CIBlockElement::getList(
    ['SORT' => 'ASC'],
    [
        'IBLOCK_ID' => 48,
        {другое условие}
    ],
    false, false,
    ['ID', 'IBLOCK_ID', 'PROPERTY_*']
)->getNext();

None of the properties are loading...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ivashjke, 2019-08-07
@bitrix0ID

you have PROPERTY_* not in the filter, but in the
SORT => ASC select, it makes no sense to insert it into the filter at all, because this is sorting
and if you want to get all the properties in this way and if you use GetNext()
then the properties can be obtained only through ->GetProperties( ); (and fields through GetFields())
because on the output of GetNext() or GetNextElement() - the object
can be written like this
$dbData = CIBlockElement::getList(
['SORT' => 'ASC'],
[
'IBLOCK_ID' => 48,
{other condition}
],
false, false ,
['ID', 'IBLOCK_ID', 'PROPERTY_*']
);
while ($res = $dbData->Fetch()) {
var_dump($res) - all available properties and fields of the element will be here
}
if via GetNext
while ($res = $dbData->GetNext()) {
$props = $res->GetProperties() - all available properties of
$fields will be here = $res->GetFields() - fields here
only if you don't need any XML_ID then Fetch() will work faster
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question