Answer the question
In order to leave comments, you need to log in
Is it possible to display infoblock elements using the section name?
Beginner developer in Bitrix. Faced with a problem:
The infoblock has the following structure:
- section name 1 - char. code 1
- element 1
- element 2
- ...
- section name 2 - char. code 2
....
Initially, each section was given a character code, and I used the filter:
"SECTION_CODE" => section code. to display elements from the desired section.
Code
$arFilter = Array(
"IBLOCK_ID"=>29,
"ACTIVE"=>"Y",
"SECTION_CODE" => section code
"INCLUDE_SUBSECTIONS" => "Y",
"PROPERTY_CATEGORY_IMG",
);
$fields = Array('NAME'
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $fields);
Is it possible to display infoblock elements by filtering by section name?
Answer the question
In order to leave comments, you need to log in
The idea, of course, is so-so, but if you really need it
$iblockId = 2;
$arElements = \Bitrix\Iblock\ElementTable::getList([
'select' => ['IBLOCK_ID', 'ID', 'NAME', 'SECTION.NAME'],
'filter' => ['IBLOCK_ID' => $iblockId, 'SECTION.NAME' => 'Мягкая мебель'],
'order' => [],
'runtime' => [
'SECTION' => [
'data_type' => '\Bitrix\Iblock\Section',
'reference' => ['this.IBLOCK_SECTION_ID' => 'ref.ID'],
'join_type' => 'LEFT'
]
]
])->fetchAll();
print_r($arElements);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question