Post by chrisnasah » Mon Apr 10, 2017 2:13 am

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

Newbie

Posts

Joined
Sat Feb 11, 2017 11:32 pm

Post by Jsf » Mon Apr 10, 2017 2:38 pm

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']

Attachments

columns.jpg

columns.jpg (39.2 KiB) Viewed 477 times


User avatar
Jsf
New member

Posts

Joined
Sun Jan 26, 2014 4:08 am
Who is online

Users browsing this forum: No registered users and 38 guests