Код:
<script src="design/{$settings->theme}/js/jquery.cookie.js"></script>
<link href="design/{$settings->theme|escape}/css/category_menu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function () {
$('#cssmenu li.has-sub > a').on('click', function(){
$(this).removeAttr('href');
var element = $(this).parent('li');
if (element.hasClass('open')) {
element.removeClass('open');
element.find('li').removeClass('open');
element.find('ul').slideUp();
}
else {
element.addClass('open');
element.children('ul').slideDown();
element.siblings('li').children('ul').slideUp();
element.siblings('li').removeClass('open');
element.siblings('li').find('li').removeClass('open');
element.siblings('li').find('ul').slideUp();
}
});
$('#cssmenu>ul>li.has-sub>a').append('<span class="holder"></span>');
});
</script>
<script>
$(function(){
$('.drow_menu li ul li').children('ul')
.each(function(){
$(this).css('display','block');
});
});
</script>
<div id="cssmenu">
{function name=categories_tree}
{if $categories}
<ul>
{foreach $categories as $c}
{if $c->visible}
<li class="active{if $c->subcategories} has-sub{/if}">
<a href="catalog/{$c->url}" data-category="{$c->id}">{$c->name}</a>
{if $c->subcategories}
{categories_tree categories=$c->subcategories}
{else}
{get_products var=cat_products category_id=$с->id in_stock=1}
{if $cat_products}
{foreach $cat_products as $p}
<a href="/products/{$p->url}">{$p->name}</a><br>
{/foreach}
{/if}
{/if}
</li>
{/if}
{/foreach}
</ul>
{/if}
{/function}
{categories_tree categories=$categories}
</div>