Answer the question
In order to leave comments, you need to log in
Why do CIBlockSection::getList() and CIBlockElement::getList() return different number of elements?
Has anyone encountered the fact that CIBlockSection::getList and CIBlockElement::getList output a different number of elements?
CIBlockSection::getList(
['LEFT_MARGIN' => 'ASC'],
[
'IBLOCK_ID' => $iblock,
'GLOBAL_ACTIVE' => 'Y',
'CNT_ACTIVE' => true,
'ELEMENT_SUBSECTIONS' => 'Y',
'PROPERTY' => [
'MYPROP' => 42//Свойство "Привязка к элементам"
]
]
);
CIBlockElement::getList(
[],
[
'IBLOCK_ID' => $iblock,
'SECTION_ID' => 191,
'ACTIVE' => 'Y',
'INCLUDE_SUBSECTIONS' => 'Y',
'PROPERTY_MYPROP.ID' => 42//Свойство "Привязка к элементам"
],
false, false,
['ID', 'IBLOCK_ID', 'NAME']
)->selectedRowsCount();
Answer the question
In order to leave comments, you need to log in
Because in the first case you are counting all products in the section, and in the second case only those with PROPERTY_MYPROP.ID == 42
What makes you think that
'PROPERTY' => [
'MYPROP' => 42//Свойство "Привязка к элементам"
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question