<? if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();

// получение тегов
$iblockId = 33;


switch ($arResult['ID']) {
    case 72:
        $sectionId=14;
        break;
    case 73:
        $sectionId=26;
        break;
    case 74:
        $sectionId=25;
        break;
}


$arResult['SPECIALS'] = [];
$arSelect = array("ID", "IBLOCK_ID", "NAME", "PROPERTY_LINK");//IBLOCK_ID и ID обязательно должны быть
$arFilter = array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "SECTION_ID" => $sectionId);
$res = CIBlockElement::GetList(array("SORT" => "ASC"), $arFilter, false, false, $arSelect);
while ($ob = $res->GetNextElement()) {
    $arFields = $ob->GetFields();
    $arResult['SPECIALS'][] = $arFields;
}

//продукты
$iblockId = 11;
$arSelect = array(
    "ID",
    "IBLOCK_ID",
    "NAME",
    "PREVIEW_TEXT",
    "PROPERTY_ICON",
    "DETAIL_PAGE_URL",
    "PROPERTY_SP_PREVIEW_TEXT",
    "PROPERTY_MORE_LINK",
    "PROPERTY_MORE_BTN",

);

if (!empty($arResult['PROPERTIES']['PRODUCTS']['VALUE'])) {
    $arResult['PRODUCTS'] = [];
    foreach ($arResult['PROPERTIES']['PRODUCTS']['VALUE'] as $item) {
        $arFilter = array("IBLOCK_ID" => $iblockId, "ID" => $item);
        $res = CIBlockElement::GetList(array("SORT" => "ASC"), $arFilter, false, false, $arSelect);
        while ($ob = $res->GetNextElement()) {
            $arFields = $ob->GetFields();
            $arResult['PRODUCTS'][] = $arFields;
        }
    }
}


//преимущества
$iblockId = 34;
$arSelect = array(
    "ID",
    "IBLOCK_ID",
    "NAME",
    "PREVIEW_TEXT",
    "PREVIEW_PICTURE",
    "PROPERTY_IMG_768",
    "PROPERTY_IMG_767",
    "PROPERTY_IMG_1921",


);
if (!empty($arResult['PROPERTIES']['ADVANTAGES']['VALUE'])) {
    $arResult['ADVANTAGES'] = [];
    foreach ($arResult['PROPERTIES']['ADVANTAGES']['VALUE'] as $item) {
        $arFilter = array("IBLOCK_ID" => $iblockId, "ID" => $item);
        $res = CIBlockElement::GetList(array("SORT" => "ASC"), $arFilter, false, false, $arSelect);
        while ($ob = $res->GetNextElement()) {
            $arFields = $ob->GetFields();
            $arFields['PREVIEW_PICTURE'] = CFile::GetPath($arFields['PREVIEW_PICTURE']);
            $arFields['IMG_767'] = CFile::GetPath($arFields['PROPERTY_IMG_767_VALUE']);
            $arFields['IMG_768'] = CFile::GetPath($arFields['PROPERTY_IMG_768_VALUE']);
            $arFields['IMG_1921'] = CFile::GetPath($arFields['PROPERTY_IMG_1921_VALUE']);

            $arResult['ADVANTAGES'][] = $arFields;
        }
    }

}
//другие решения
$arSelect = array(
    "ID",
    "IBLOCK_ID",
    "NAME",
    "DETAIL_PAGE_URL",
    "PROPERTY_OTHER_IMG",
    "PROPERTY_OTHER_TEXT",
    "PROPERTY_SOLUTION_PAGE",
    "PROPERTY_SOLUTION_LINK",

);
$arResult['OTHERS']=[];
$arFilter = array("IBLOCK_ID" => $arParams['IBLOCK_ID'], "!ID" => $arResult['ID']);
$res = CIBlockElement::GetList(array("SORT" => "ASC"), $arFilter, false, false, $arSelect);
while ($ob = $res->GetNextElement()) {
    $arFields = $ob->GetFields();
    $arFields['OTHER_IMG'] = CFile::GetPath($arFields['PROPERTY_OTHER_IMG_VALUE']);
    $arResult['OTHERS'][] = $arFields;
}


