Eresken

section getlist

Aug 24th, 2021 (edited)
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.80 KB | None | 0 0
  1. \Bitrix\Main\Loader::includeModule('iblock');
  2. \Bitrix\Main\Application::getConnection()->startTracker(true);
  3.  
  4. $elements = \Bitrix\Iblock\ElementTable::getList([
  5.             'filter' => [
  6.       'ROOT.ID' => 947, // Раздел, в котором ищем включая подразделы.
  7.       '==LINK.ADDITIONAL_PROPERTY_ID' => NULL, // Основная привязка элементов к группам.
  8.       'ACTIVE' => 'Y' // Активные элементы.
  9.             ],
  10.             'sel ect' => [
  11.       'ID',
  12.             ],
  13.        'group' => [
  14.       'ID'
  15.        ],
  16.             'runtime' => [
  17.                 'LINK' => [
  18.                     'data_type' => \Bitrix\Iblock\SectionElementTable::class,
  19.                     'reference' => [
  20.                         '=this.ID' => 'ref.IBLOCK_ELEMENT_ID',
  21.                     ],
  22.           'join_type' => 'inner',
  23.                 ],
  24.                 'PARENT' => [
  25.                     'data_type' => \Bitrix\Iblock\SectionTable::class,
  26.                     'reference' => [
  27.                         '=this.LINK.IBLOCK_SECTION_ID' => 'ref.ID',
  28.                     ],
  29.           'join_type' => 'inner',
  30.                 ],
  31.                 'ROOT' => [
  32.                     'data_type' => \Bitrix\Iblock\SectionTable::class,
  33.                     'reference' => [
  34.                         '=this.PARENT.IBLOCK_ID' => 'ref.IBLOCK_ID',
  35.                         '<=ref.LEFT_MARGIN' => 'this.PARENT.LEFT_MARGIN',
  36.                         '>=ref.RIGHT_MARGIN' => 'this.PARENT.RIGHT_MARGIN',
  37.                     ],
  38.                     'join_type' => 'inner',
  39.                 ],
  40.             ]
  41.         ]);
  42.  
  43. \Bitrix\Main\Application::getConnection()->stopTracker();
  44.  
  45. var_dump($elements->fetch());
  46.  
  47.  
  48. print_r(\Bitrix\Main\Application::getConnection()->getTracker());
Add Comment
Please, Sign In to add comment