Есть два компонента, которые выводят разделы и их элементы.
Нужно сделать, чтобы элемент выводил свойство FILE из админки, как это сделать?
Компоненты:
<?php
//разделы
$resSect = CIBlockSection::GetList(
[],
[
'IBLOCK_ID' => 37,
'CODE' => $arSectCodes
],
false,
[
'ID',
'NAME',
'CODE',
'UF_ICON',
]
);
while($ob = $resSect->GetNextElement())
{
$arSection = $ob -> GetFields();
}
//элементы
$arSelect = Array("ID", "NAME", "CODE", "DATE_ACTIVE_FROM", "PROPERTY_*");
$arFilter = Array("IBLOCK_ID"=>37, "ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement())
{
$arElements[] = $ob->GetFields();
}
foreach ($arElements as $key => $arItem) {
$rsSections = CIBlockElement::GetElementGroups($arItem['ID']);
while ($arSection = $rsSections->Fetch())
{
$arSectionList= array(
'ID' => $arSection['ID'],
'NAME' => $arSection['NAME'],
'CODE' => $arSection['CODE'],
);
$arItem= array(
'ID' => $arItem['ID'],
'NAME' => $arItem['NAME'],
'CODE' => $arItem['CODE'],
'DATE_ACTIVE_FROM' => $arItem['DATE_ACTIVE_FROM'],
'FILE' => $arItem['FILE']['VALUE'],
);
$arResult['ITEMS_BY_GROUP'][$arSectionList["ID"]][] = $arItem;
}
}
?>
Сам вывод:
<? foreach ($arResult['SECTIONS'] as $key => $sect) { ?>
<div class="doc">
<div class="wrapper-title__docs">
<div class="title__docs">
<?=$sect["NAME"]?>
</div>
<button class="wp__category--btn"><span></span><span></span></button>
</div>
<?if($arResult['ITEMS_BY_GROUP'][$sect["ID"]]){?>
<div class="document-wrapper__inner">
<? foreach ($arResult['ITEMS_BY_GROUP'][$sect["ID"]] as $item) { ?>
<div class="document__item">
<span class="document__date">
<a href="<?=$item["FILE"]["VALUE"]?>" target="_blank">
<?=$item['DATE_ACTIVE_FROM']?>
</a>
</span>
<span class="document__name">
<a href="<?=$item["FILE"]["VALUE"]?>" target="_blank"><?=$item["NAME"]?></a>
</span>
<div class="document__file">
<a href="<?=$item["FILE"]["VALUE"]?>" style="display: flex;" target="_blank">
<span class="document__file-type">PDF</span>
<span class="document__file-icon">
<svg width="26" height="29" viewBox="0 0 26 29" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.9824 22.4628L21.878 9.46256L23.5 10.1672L16.0692 23.9997L10.0482 23.9997L2.49997 10.1672L4.08598 9.46256L11.1937 22.4628L14.9824 22.4628Z" fill="#002F6C"></path>
<path d="M13.9624 20.8391L12.0549 20.8391L12.0549 -0.000292513L13.9624 -0.000292679L13.9624 20.8391Z" fill="#002F6C"></path>
<path d="M26.0001 29L0.00012207 29L-1.54337e-05 26.9998L26 26.9998L26.0001 29Z" fill="#002F6C"></path>
</svg>
</span>
</a>
</div>
</div>
<? } ?>
</div>
<?}?>
</div>
<? } ?>