Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include/prolog_before.php");
- if(\Bitrix\Main\Loader::includeModule('iblock'))
- {
- $allItems = \Bitrix\Iblock\ElementTable::getList([
- 'order' => [],
- 'select' => ['ID',],
- 'filter' => [
- 'IBLOCK_ID' => 17,
- ],
- 'count_total' => 1,
- ])->getCount();
- $dbItems = \Bitrix\Iblock\ElementTable::getList([
- 'order' => ['SORT' => 'ASC'],
- 'select' => ['ID', 'NAME', 'IBLOCK_ID', 'SORT',],
- 'filter' => [
- 'IBLOCK_ID' => 17,
- ],
- 'group' => [],
- 'limit' => $allItems,
- 'offset' => 0,
- 'count_total' => 1,
- 'runtime' => [],
- 'data_doubling' => false,
- 'cache' => [
- 'ttl' => 3600,
- 'cache_joins' => true
- ],
- ]);
- $arResult = [];
- foreach ($dbItems->fetchAll() as &$item)
- {
- $prices = \Bitrix\Catalog\PriceTable::getList([
- 'select' => ['*'],
- 'filter' => [
- '=PRODUCT_ID' => $item['ID'],
- ]
- ])->fetchAll();
- $prop_common = CIBlockElement::GetByID($item['ID'])->GetNextElement()->GetProperties();
- $item = [
- 'NAME' => $item['NAME'],
- 'ID' => $item['ID'],
- 'PRICE' => $prices[key($prices)]['PRICE'],
- 'MINIMUM_PRICE' => $prop_common['MINIMUM_PRICE']['VALUE'],
- 'MAXIMUM_PRICE' => $prop_common['MAXIMUM_PRICE']['VALUE'],
- ];
- if($item['PRICE'] != $item['MINIMUM_PRICE'] or $item['PRICE'] != $item['MAXIMUM_PRICE'])
- $arResult[] = $item;
- }
- echo '<pre>';
- print_r($arResult);
- echo '</pre>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement