Добрый день! Нужно сделать выборку элементов, компонент написан на D7. Как можно прописать в setFilter? искала, но не найду пока никак((
Код |
---|
private function getElements(){ $this->initPagination(); if($currentSections = $this->findSections()){ $this->setFilter(array_merge($this->filter, ['@IBLOCK_SECTION_ID' => $currentSections])); } $queryElements = $this->queryCatalog(); $count = $queryElements->getCount(); $this->pageNavigation->setRecordCount($count); [$prevLink, $nextLink] = $this->prepareLinkPagination( $this->pageNavigation->getCurrentPage(), $this->pageNavigation->getPageCount() ); $pg = [ 'page_current' => $this->pageNavigation->getCurrentPage(), 'page_size' => $this->pageNavigation->getPageSize(), 'pages' => $this->pageNavigation->getPageCount(), 'prev_link' => $prevLink, 'next_link' => $nextLink, ]; $items = $queryElements->fetchAll(); $itemsId = array_map(fn($item) => $item['ID'], $items); $this->prices = $itemsId ? ProductPrice::getProductPrices($itemsId) : []; foreach ($items as &$item){ $item = $this->prepareItem($item); } return [ 'items' => $items, 'count' => $count, 'pagination' => $pg ]; } |
Изменено: Михаил Базаров - 13.09.2023 11:46:16