Всем привет! Создал блок выподающих категорий:
файл categories_panels.tpl:
{if $settings.abt__device == "mobile"}
<a href="javascript:void(0);" rel="nofollow" class="ut2-btn-close" onclick="$(this).parent().prev().removeClass('open');$(this).parent().addClass('hidden');"><i class="ut2-icon-baseline-close"></i></a>
{/if}
{assign var="collapse" value=false}
{if $categories.display == "N"}
{if $smarty.cookies.$cookie_name_show_filter}
{assign var="collapse" value=false}
{else}
{assign var="collapse" value=true}
{/if}
{else}
{if $smarty.cookies.$cookie_name_show_filter}
{assign var="collapse" value=true}
{else}
{assign var="collapse" value=false}
{/if}
{/if}
{if $categories}
<ul class="ut2-subcategories clearfix">
{foreach $categories as $parent_category}
{assign var="level" value=0}
{include file="addons/модуль/blocks/components/subcategories.tpl" category=$parent_category level=$level collapse=$collapse}
{/foreach}
</ul>
{/if}
{assign var="next_level" value=$level+1}
<li class="ut2-item level-{$level}">
{if $category.subcategories}
<div>
<a id="sw_tab_cat_{$category.category_id}" class="cm-combination {if $collapse} open{/if} cm-save-state {if $categories_uchur.display == "YesNo::YES"|enum}cm-ss-reverse{/if}">
<span {live_edit name="category:category:{$category.category_id}"}>{$category.category}</span>
</a>
<i id="on_tab_cat_{$category.category_id}" class="ty-icon-down-open"></i>
<i id="off_tab_cat_{$category.category_id}" class="ty-icon-up-open hidden"></i>
</div>
<div id="tab_cat_{$category.category_id}" class="hidden">
<ul>
{foreach $category.subcategories as $subcategory}
{include file="addons/модуль/blocks/components/subcategories.tpl" category=$subcategory level=$next_level collapse=$collapse}
{/foreach}
</ul>
</div>
{/if}
</li>
файл subcategories.tpl:
{assign var="next_level" value=$level+1}
<li class="ut2-item level-{$level}">
{if $category.subcategories}
<div class="flex-subcategory">
<a id="sw_tab_cat_{$category.category_id}" class="cm-combination {if $collapse} open{/if} cm-save-state {if $categories.display == "YesNo::YES"|enum}cm-ss-reverse{/if}">
<span {live_edit name="category:category:{$category.category_id}"}>{$category.category}</span>
</a>
<i id="on_tab_cat_{$category.category_id}" class="ty-icon-down-open"></i>
<i id="off_tab_cat_{$category.category_id}" class="ty-icon-up-open hidden"></i>
</div>
<div id="tab_cat_{$category.category_id}" class="hidden">
<ul style="margin-left: 10px;">
{foreach $category.subcategories as $subcategory}
{include file="addons/модуль/blocks/components/subcategories.tpl" category=$subcategory level=$next_level collapse=$collapse}
{/foreach}
роапроа
</ul>
</div>
{else}
<a href="{"categories.view?category_id=`$category.category_id`"|fn_url}">
<span {live_edit name="category:category:{$category.category_id}"}>{$category.category}<i class="ut2-icon-right"></i></span>
</a>
{/if}
</li>
схема:
$schema['модуль_categories_panels'] = [
'templates' => 'addons/модуль/blocks/модуль_categories_panels.tpl',
'content' => [
'categories' => [
'type' => 'function',
'function' => ['fn_get_all_categories']
],
],
'settings' => [
'abt__ut2_show_parents' => [
'type' => 'checkbox',
'default_value' => YesNo::NO,
],
'abt__ut2_show_siblings' => [
'type' => 'checkbox',
'default_value' => YesNo::NO,
],
'abt__ut2_show_children' => [
'type' => 'checkbox',
'default_value' => YesNo::YES,
],
],
'wrappers' => 'blocks/wrappers',
'cache' => [
'update_handlers' => [
'categories',
'category_descriptions',
],
'request_handlers' => ['current_category_id' => '%CATEGORY_ID%'],
],
];
функция:
function fn_get_all_categories()
{
$lang_code = DESCR_SL;
$params = [
'simple' => true,
'status' => 'A',
'get_images' => true,
'max_nesting_level' => null
];
list($categories, $search_params) = fn_get_categories($params, $lang_code);
return $categories;
}
Вопрос как сделать индексацию? Например я перехажу с меню в одежду и на странице категории она должна быть открытой и там должна стоять класс active чтобы подсвечивать