Page 1 of 1
limit sub category display on menu?
Posted: Mon Apr 10, 2017 2:13 am
by chrisnasah
Hi,
For some reason i just cant find the option to limit the number of sub categories in menu. In demo i can see it says "see all components" etc. Where is this settings.
Also is it possible to display this over two columns? I have a parent with long list of sub categories.
Thanks
Re: limit sub category display on menu?
Posted: Mon Apr 10, 2017 2:38 pm
by Jsf
Hi,
the category columns you can set in admin. See attached image. MP3 Players has 4 columns.
Show all ... just template additional link. You can find it in common/header.tpl file.
Code: Select all
<ul class="nav navbar-nav">
<?php foreach ($categories as $category) { ?>
<?php if ($category['children']) { ?>
<li class="dropdown"><a href="<?php echo $category['href']; ?>" class="dropdown-toggle" data-toggle="dropdown"><?php echo $category['name']; ?></a>
<div class="dropdown-menu">
<div class="dropdown-inner">
<?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) as $children) { ?>
<ul class="list-unstyled">
<?php foreach ($children as $child) { ?>
<li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<a href="<?php echo $category['href']; ?>" class="see-all"><?php echo $text_all; ?> <?php echo $category['name']; ?></a> </div>
</li>
<?php } else { ?>
<li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
<?php } ?>
<?php } ?>
</ul>
If you want to limit sub categories, you simple can use array_slice function (
http://php.net/manual/en/function.array-slice.php ) on $category['children']