$arFilter = Array(
'IBLOCK_ID' => $IBLOCK_ID,
'GLOBAL_ACTIVE' => 'Y',
);
$arSelect = Array(
'ID',
'NAME'
);
$db_list = CIBlockSection::GetList (Array(), $arFilter, false, $arSelect, false);
while ($ar_result = $db_list->GetNext ())
{
$arSections[]= array('ID'=> $ar_result['ID'], 'NAME'=> $ar_result['NAME']);
}
foreach ($arSections as $index => $arSection)
{
$arSelect = Array(
"ID",
"IBLOCK_ID",
"IBLOCK_SECTION_ID",
"PREVIEW_TEXT",
"NAME",
"DATE_ACTIVE_FROM",
"PROPERTY_*"
);
$arFilter = Array(
"IBLOCK_ID" => 38,
"ACTIVE_DATE" => "Y",
"ACTIVE" => "Y",
'IBLOCK_SECTION_ID' => $arSection['ID']
);
$res = CIBlockElement::GetList (Array(), $arFilter, false, Array(), $arSelect);
while ($ob = $res->GetNextElement ())
{
$arItem = $ob->GetFields ();
$arItem['PROPS'] = $ob->GetProperties ();
$arItems[] = $arItem;
}
$arFullSection = $arSection;
$arFullSection['ITEMS'] = $arItems;
$arFullSection[] = $arFullSection;
unset($arItem,$arItems,$arFullSection);
}
Получить поля SEO для элемента можно так:
CModule::IncludeModule("iblock");
$ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues(
$arCurElem["IBLOCK_ID"], // ID инфоблока
$arCurElem["ID"] // ID элемента
);
$arElMetaProp = $ipropValues->getValues();
echo ''; print_r ($arElMetaProp); echo '';
Поля SEO для раздела можно получить похожим способом:
CModule::IncludeModule("iblock");
$rsSection = CIBlockSection::GetList(
array(),
array(
"IBLOCK_ID"=>$arParams['IBLOCK_ID'],
"ACTIVE"=>"Y",
"=CODE"=>$arParams["SECTION_CODE"]),
false
);
if($arSection = $rsSection->GetNext()){
$ipropValues = new \Bitrix\Iblock\InheritedProperty\SectionValues(
$arSection["IBLOCK_ID"],
$arSection["ID"]
);
$arSection["IPROPERTY_VALUES"] = $ipropValues->getValues();
echo ""; print_r($arSection); echo '';
}
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
global $APPLICATION;
$aMenuLinksExt=$APPLICATION->IncludeComponent("bitrix:menu.sections", "", array(
"IS_SEF" => "Y",
"SEF_BASE_URL" => "",
"SECTION_PAGE_URL" => "#SECTION_ID#/",
"DETAIL_PAGE_URL" => "#SECTION_ID#/#ELEMENT_ID#",
"IBLOCK_TYPE" => "products",
"IBLOCK_ID" => "2",
"DEPTH_LEVEL" => "1",
"CACHE_TYPE" => "A",
"CACHE_TIME" => "36000000"
),
false
);
$aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt);
?>