StartResultCache(60*60*24, md5(var_export($_POST, true)))) //{ if(CModule::IncludeModule('iblock')) { $arResult = [ 'BRANDS' => [] ]; $brands_res = CIBlockElement::GetList([ "NAME" => "ASC" ], [ "ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_BRANDS ], false, []); while ($brands_ob_element = $brands_res->GetNextElement()) { $brands_ar_res = $brands_ob_element->GetFields(); $brands_ar_res['PROPERTIES'] = $brands_ob_element->GetProperties(); if(isset($brands_ar_res['PREVIEW_PICTURE'])) { $brands_ar_res['PREVIEW_PICTURE'] = CFile::GetPath($brands_ar_res['PREVIEW_PICTURE']); } else { $cars_res = CIBlockElement::GetList([ "PROPERTY_PRICE" => "DESC" ], [ "ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_CATALOG_CARS_NEW, "PROPERTY_BRAND" => $brands_ar_res['ID'] ], false, [ "nPageSize" => 1 ]); while ($cars_ob_element = $cars_res->GetNextElement()) { $cars_ar_res = $cars_ob_element->GetFields(); $cars_ar_res['PROPERTIES'] = $cars_ob_element->GetProperties(); $brands_ar_res['PREVIEW_PICTURE'] = $cars_ar_res['PROPERTIES']['IMAGE_URL']['VALUE']; } } $arResult['BRANDS'][] = $brands_ar_res; } $this->IncludeComponentTemplate(); } //}