merelendor 6b2903d1d8 ads
2023-08-31 16:53:10 +03:00

54 lines
1.2 KiB
PHP

<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
/** @var CBitrixComponent $this */
/** @var array $arParams */
/** @var array $arResult */
/** @var string $componentPath */
/** @var string $componentName */
/** @var string $componentTemplate */
/** @global CDatabase $DB */
/** @global CUser $USER */
/** @global CMain $APPLICATION */
use Bitrix\Main\Context,
Bitrix\Main\Type\DateTime,
Bitrix\Main\Loader,
Bitrix\Iblock;
if(CModule::IncludeModule('iblock'))
{
$arResult = [];
$sort = [ "NAME" => "ASC" ];
$filter = [ "IBLOCK_ID" => IBLOCK_ID_SPECIAL_OFFERS_CARS ];
$options = [];
if(isset($arParams["sort"]))
{
$sort = $arParams["sort"];
}
if(isset($arParams["options"]))
{
$options = $arParams["options"];
}
if(isset($arParams["filter"]))
{
$filter = array_merge($filter, $arParams["filter"]);
}
$res = CIBlockElement::GetList($sort, $filter, false, $options);
$arResult = [];
while ($obElement = $res->GetNextElement())
{
$ar_res = $obElement->GetFields();
$ar_res['PROPERTIES'] = $obElement->GetProperties();
$ar_res['PREVIEW_PICTURE'] = CFile::GetPath($ar_res['PREVIEW_PICTURE']);
$arResult[] = $ar_res;
}
$this->IncludeComponentTemplate();
}