There is a button that leads to the associated catalog item . And it is necessary that led to the attached section of the directory.
result_modifier
<? if (!empty($arResult['ITEMS'])) { $relItemIDS = array(); foreach ($arResult['ITEMS'] as $arItem) if (intval($arItem['PROPERTIES']['RELATED_ITEM']['VALUE'])) $relItemIDS[] = intval($arItem['PROPERTIES']['RELATED_ITEM']['VALUE']); if (!empty($relItemIDS)) { $resItems = CIBlockElement::GetList(array(), array('ID' => array_unique($relItemIDS)), false, false, array('NAME', 'DETAIL_PAGE_URL')); while ($arItem = $resItems->GetNext()) { $arResult['RELATED_ITEMS'][$arItem['ID']] = $arItem; } } } ?> template
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die(); $this->setFrameMode(true);?> <?if (!empty($arResult['ITEMS'])):?> <div class="owl-carousel main-slider"> <?foreach ($arResult['ITEMS'] as $arItem): if (intval($arItem['PREVIEW_PICTURE'])): $pic = CFile::ResizeImageGet($arItem['PREVIEW_PICTURE'], array('width' => 1900, 'height' => 574), BX_RESIZE_IMAGE_EXACT, true); $detailUrl = $arResult['RELATED_ITEMS'][$arItem['PROPERTIES']['RELATED_ITEM']['VALUE']]['DETAIL_PAGE_URL']; $blockSelector = ($detailUrl) ? 'a' : 'div';?> <? $this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_EDIT")); $this->AddDeleteAction($arItem['ID'], $arItem['DELETE_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => GetMessage('CT_BNL_ELEMENT_DELETE_CONFIRM'))); ?> <div class="item vertical-middle" id="<?=$this->GetEditAreaId($arItem['ID']);?>"> <<?=$blockSelector?><?if ($detailUrl):?> href="<?=$detailUrl?>"<?endif;?> class="background <?=($arItem['PROPERTIES']['STYLE']['VALUE_XML_ID'] == 'white') ? 'white' : 'black'?>" style="background-image:url(<?=$pic['src']?>);"> <span class="container row"> <span class="main-slider-caption"><?=$arItem['NAME']?></span> <span class="main-slider-desc"><?=$arItem['PREVIEW_TEXT']?></span> <?if ($detailUrl):?> <span class="button hide-for-small-only"><?=GetMessage("MORE")?></span> <?endif;?> </span> </<?=$blockSelector?>> </div> <?endif; endforeach;?> </div> <?endif;?> Binding to an item with us is "RELATED_ITEM". And the section binding code is "RELATED_SECTION".
Help, how to modify these files so that when you click on the button we get into the associated section.
arItemarray thearItembinding is stored.var_dumpto help you. Well, use the appropriate API to work with sections. When you see in which parameters of the array the necessary data is stored, the problem will go away. - Nikolaj Sarry