Example #1
0
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<?
	// Получаем все родительские разделы текущего раздела
	$SecParants1 = GetAllParantsSection($arResult['ID']); 

	$APRT_DATA = "";
	if( count($SecParants1) > 1)
	{
		$APRT_DATA = "parentCategories: [";
		foreach($SecParants1 as $k => $SecPar)
			if($k != 0)	$APRT_DATA .= "{id: " . $SecPar["ID"] . ", name: '" . $SecPar["NAME"] . "'},";
		
		$APRT_DATA .= "]";
	}
?>
<script type="text/javascript">
	// Интеграция с retailrocket.ru
    rrApiOnReady.push(function() {
		try { rrApi.categoryView(<?= $arResult['ID']?>); } catch(e) {}
	})

	window.ad_category = "<?= $arResult['ID']?>";

	window.APRT_DATA = {
		pageType: 3,
		currentCategory: {
			id: <?= $arResult['ID']?>,
			name: "<?=$arResult["NAME"]?>"
		},
		<?=$APRT_DATA ?>
	}
Example #2
0
function GetAllParantsSection($idsec = 0){
	
	if(!isset($returnParantsSection)) global $returnParantsSection;
	
	$arFilter = Array('IBLOCK_ID'=> 2, 'GLOBAL_ACTIVE'=>'Y', "ID" => $idsec);
	$db_list = CIBlockSection::GetList(Array(), $arFilter, true, array("ID", "NAME", "IBLOCK_SECTION_ID", "CODE", "SECTION_PAGE_URL"));
	if($ar_result = $db_list->GetNext())
	{
		if(!empty($ar_result["IBLOCK_SECTION_ID"]))
		{	
			$returnParantsSection[] = $ar_result;
			GetAllParantsSection($ar_result["IBLOCK_SECTION_ID"]);
		}else{
			$returnParantsSection[] = $ar_result;	
		}
	}
	
	return $returnParantsSection;
}