61 lines
1.9 KiB
PHP
61 lines
1.9 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($this->StartResultCache(60*60*24, md5(var_export($_POST, true))))
|
|
{
|
|
if(CModule::IncludeModule('iblock'))
|
|
{
|
|
$arResult = [];
|
|
$sort = Array("SORT" => "ASC", "NAME" => "ASC");
|
|
$filter = Array("ACTIVE" => "Y", "IBLOCK_ID" => 7, "ID" => $arParams['ID']);
|
|
$options = Array();
|
|
|
|
$res = CIBlockElement::GetList($sort, $filter, false, $options);
|
|
$arResult = ['ITEMS' => []];
|
|
|
|
while ($obElement = $res->GetNextElement())
|
|
{
|
|
$ar_res = $obElement->GetFields();
|
|
$ar_res['PROPERTIES'] = $obElement->GetProperties();
|
|
$ar_res['PROPERTIES']['REGION']['RELATED'] = get_related_array(15, $ar_res['PROPERTIES']['REGION']['VALUE']);
|
|
|
|
$regions = [];
|
|
foreach($ar_res['PROPERTIES']['REGION']['RELATED'] AS $r)
|
|
{
|
|
array_push($regions, $r['NAME']);
|
|
}
|
|
$ar_res['REGIONS'] = $regions;
|
|
|
|
$arResult = $ar_res;
|
|
}
|
|
|
|
if(empty($arResult['NAME'])) { define('ERROR_404', 'Y'); }
|
|
else
|
|
{
|
|
$APPLICATION->AddChainItem($arResult["NAME"]);
|
|
$ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($arResult['IBLOCK_ID'], $arResult["ID"]);
|
|
$meta = $ipropValues->getValues();
|
|
$APPLICATION->SetPageProperty("title", $meta['ELEMENT_META_TITLE']);
|
|
$APPLICATION->SetPageProperty("keywords", $meta['ELEMENT_META_KEYWORDS']);
|
|
$APPLICATION->SetPageProperty("description", $meta['ELEMENT_META_DESCRIPTION']);
|
|
|
|
$APPLICATION->AddHeadString('<link rel="canonical" href="'.$ar_res['CANONICAL_PAGE_URL'].'"/>');
|
|
}
|
|
|
|
$this->IncludeComponentTemplate();
|
|
}
|
|
} |