Skip to content

d7 request

B0Bka edited this page Feb 17, 2020 · 3 revisions
            $iblock_id = \Bitrix\Iblock\IblockTable::getList([
                'filter' => [
                    'CODE' => 'site_reviews'
                ],
                'select' => ['ID']
            ])->fetch()['ID'];
            $property_id = \Bitrix\Iblock\PropertyTable::getList([
                'filter' => [
                    'CODE'      => 'EMAIL_FIELD',
                    'IBLOCK_ID' => $iblock_id
                ],
                'select' => ['ID']
            ])->fetch()['ID'];
        $entitySingleProperties = \Bitrix\Main\Entity\Base::compileEntity(
            sprintf('PROPS_SINGLE_%s', $iblock['ID']),
            [
                'IBLOCK_ELEMENT_ID' => ['data_type' => 'integer'],
                'PROPERTY_'.$productProps[$propCode] => ['data_type' => 'integer'],
                'VALUE' => ['data_type' => 'integer']
            ],
            [
                'table_name' => 'b_iblock_element_prop_s'.$iblock['ID'],
            ]
        );

        $q = \Bitrix\Iblock\ElementTable::query();
        $arSupplier = $q->setSelect(['CHECKED_BY_SPECIALIST' => 'CHECKED_BY_SPECIALIST_PROP.'.'PROPERTY_'.$productProps[$propCode]])
            ->setFilter(['=IBLOCK_ID' => $iblock['ID'], '=ACTIVE' => 'Y', '=XML_ID' => $xmlId])
            ->setCacheTtl(43200)
            ->cacheJoins(true)
            ->registerRuntimeField(new Reference('CHECKED_BY_SPECIALIST_PROP', $entitySingleProperties,
            Query::filter()
                ->whereColumn('ref.IBLOCK_ELEMENT_ID', 'this.ID')
            ))->exec()->fetch();

PARENT SECTIONS
        $q = \Bitrix\Iblock\SectionTable::query();
        $section = $q->setSelect(['LEFT_MARGIN', 'RIGHT_MARGIN'])
            ->setFilter(['=ID' => $sectionId, '=IBlOCK_ID' => CATALOG_IBLOCK_ID])
            ->exec()->fetch();

        $parentsQuery = \Bitrix\Iblock\SectionTable::query();
        $parents = $parentsQuery->setFilter(['<LEFT_MARGIN' => $section['LEFT_MARGIN'], '>RIGHT_MARGIN' => $section['RIGHT_MARGIN'], '=IBlOCK_ID' => CATALOG_IBLOCK_ID])
            ->setSelect(['ID', 'NAME'])
            ->setOrder(['LEFT_MARGIN' => 'ASC'])
            ->exec()->fetchAll();
Clone this wiki locally