Answer the question
In order to leave comments, you need to log in
How to get categories with the maximum nesting level in Bitrix D7?
Good afternoon!
I get a list of categories from the infoblock with the following request
$res = \Bitrix\Iblock\SectionTable::getList([
'order' => ["LEFT_MARGIN" => "ASC"],
'select' => [
'ID', 'NAME', 'LEFT_MARGIN', 'RIGHT_MARGIN', 'CODE', 'UF_UDS_ID'],
"filter" => array(
"IBLOCK_ID" => CATALOG_IBLOCK,
"ACTIVE" => "Y",
"GLOBAL_ACTIVE" => "Y",
"UF_UDS_ID" => false
),
]);
Answer the question
In order to leave comments, you need to log in
Try like this:
$res = \Bitrix\Iblock\SectionTable::getList([
'order' => ["LEFT_MARGIN" => "ASC"],
'select' => [
'ID', 'NAME', 'LEFT_MARGIN', 'RIGHT_MARGIN', 'CODE', 'UF_UDS_ID'],
"filter" => array(
"IBLOCK_ID" => CATALOG_IBLOCK,
"ACTIVE" => "Y",
"GLOBAL_ACTIVE" => "Y",
"UF_UDS_ID" => false,
'DIFF' => 1,
),
'runtime' => [
new ExpressionField('DIFF', '(%s - %s)', ['RIGHT_MARGIN', 'LEFT_MARGIN'])
],
]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question