Answer the question
In order to leave comments, you need to log in
How to make a filter only at the last level of the product catalog in 1s Bitrix?
Help, please, to solve the problem. It is necessary that in the product catalog the filter is shown only at the last level. The level of nesting in the catalog is different in different subgroups. Here is the part of the section.php file that is responsible for the output of the filter (in my opinion).
// set offer type & smartfilter view
$typeTmpSKU = $viewTmpFilter = 0;
if($section['UF_OFFERS_TYPE']){
$typeTmpSKU = $section['UF_OFFERS_TYPE'];
}
if($section['UF_FILTER_VIEW']){
$viewTmpFilter = $section['UF_FILTER_VIEW'];
}
if(!$typeTmpSKU || !$viewTmpFilter){
if($section['DEPTH_LEVEL'] > 1){
$sectionParent = CNextCache::CIBlockSection_GetList(array('CACHE' => array("MULTI" =>"N", "TAG" => CNextCache::GetIBlockCacheTag($arParams["IBLOCK_ID"]))), array('GLOBAL_ACTIVE' => 'Y', "ID" => $section["IBLOCK_SECTION_ID"], "IBLOCK_ID" => $arParams["IBLOCK_ID"]), false, array("ID", "IBLOCK_ID", "NAME", "UF_OFFERS_TYPE", 'UF_FILTER_VIEW'));
if($sectionParent['UF_OFFERS_TYPE'] && !$typeTmpSKU){
$typeTmpSKU = $sectionParent['UF_OFFERS_TYPE'];
}
if($sectionParent['UF_FILTER_VIEW'] && !$viewTmpFilter){
$viewTmpFilter = $sectionParent['UF_FILTER_VIEW'];
}
if($section['DEPTH_LEVEL'] > 2){
if(!$typeTmpSKU || !$viewTmpFilter){
$sectionRoot = CNextCache::CIBlockSection_GetList(array('CACHE' => array("MULTI" =>"N", "TAG" => CNextCache::GetIBlockCacheTag($arParams["IBLOCK_ID"]))), array('GLOBAL_ACTIVE' => 'Y', "<=LEFT_BORDER" => $section["LEFT_MARGIN"], ">=RIGHT_BORDER" => $section["RIGHT_MARGIN"], "DEPTH_LEVEL" => 1, "IBLOCK_ID" => $arParams["IBLOCK_ID"]), false, array("ID", "IBLOCK_ID", "NAME", "UF_OFFERS_TYPE", 'UF_FILTER_VIEW'));
if($sectionRoot['UF_OFFERS_TYPE'] && !$typeTmpSKU){
$typeTmpSKU = $sectionRoot['UF_OFFERS_TYPE'];
}
if($sectionRoot['UF_FILTER_VIEW'] && !$viewTmpFilter){
$viewTmpFilter = $sectionRoot['UF_FILTER_VIEW'];
}
}
}
}
}
Answer the question
In order to leave comments, you need to log in
It is necessary to wrap the call of the filter component in a condition.
if($section['RIGHT_MARGIN'] - $section['LEFT_MARGIN'] == 1) {
// компонент фильтра
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question