Post by donnie_barascco122 » Thu Sep 17, 2015 9:23 pm

Hello,

I have a custom template and I have a catagory menu on the left of my screen with my product catagories.

There are some sub catagories in there but the standard view is collapsed and I would like it to be auto-expanded.

Thank-you for reading and I look forward to any advice anyone can give me.

The versision is 1.5.4.1.

Best regards,
Donnie
O0


Posts

Joined
Thu Sep 17, 2015 9:19 pm

Post by deepvision » Fri Sep 18, 2015 1:51 pm

Since it is a custom template no way to tell without being able to see you site.

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by donnie_barascco122 » Mon Sep 21, 2015 11:35 pm

Hi,

/catalog/view/theme104/template/module/category.tpl

I have located this category module.

Is this where I can make it auto expand?


Posts

Joined
Thu Sep 17, 2015 9:19 pm

Post by donnie_barascco122 » Mon Sep 21, 2015 11:48 pm

this is the code from the .tpl file as mentioned above

Code: Select all

<script type="text/javascript">
$(document).ready(function() {
	$('li.cat-header ul').each(function(index) {
 $(this).prev().addClass('idCatSubcat')});
 $('li.cat-header a').after('<span></span>'); 
 $('li.cat-header ul').css('display','none');
 $('li.cat-header ul.active').css('display','block');
 $('li.cat-header ul').each(function(index) {
   $(this).prev().addClass('close').click(function() {
  if (
   $(this).next().css('display') == 'none') {
   $(this).next().slideDown(400, function () {
   $(this).prev().removeClass('collapsed').addClass('expanded');
    });
  }else {
    $(this).next().slideUp(400, function () {
   $(this).prev().removeClass('expanded').addClass('collapsed');
   $(this).find('ul').each(function() {
    $(this).hide().prev().removeClass('expanded').addClass('collapsed');
   });
    });
  }
  return false;
   });
});
 });
</script>
<div class="box category">
	<!--div class="box-heading"><?php echo $heading_title; ?></div-->
  <div class="box-content">
  
    <div class="box-category">
      <ul>
        <?php foreach ($categories as $category) { ?>
        <?php if ($category['category_id'] == $category_id) { ?>
        <li class="active cat-header">
        <?php } else { ?>
        <li class="cat-header">
        <?php } ?>
          <?php if ($category['category_id'] == $category_id) { ?>
          <a href="<?php echo $category['href']; ?>" class="active"><?php echo $category['name']; ?></a>
          <?php } else { ?>
          <a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
          <?php } ?>
          <?php if ($category['children']) { ?>

            <?php for ($i = 0; $i < count($category['children']);) { ?>
            <?php if ($category['category_id'] == $category_id) { ?>
            <ul class="active">
            <?php } else { ?>
            <ul>
            <?php }?>
              <?php $j = $i + count($category['children']); ?>
              <?php for (; $i < $j; $i++) { ?>
              <?php if (isset($category['children'][$i])) { ?>
              <?php $id=$category['children'][$i]['category_id'];?>
              <?php if ( $id == $child_id) { ?>
              <li class="active">
                <?php } else { ?>
              <li>
                <?php } ?>
                <?php if ($category['children'][$i]['children3']) {?>
                <a  href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name'];?></a>
                <?php if ( $id == $child_id) { ?>
                <ul class="active">
               	<?php } else { ?>
                <ul>
                <?php }?>
                  <?php foreach ($category['children'][$i]['children3'] as $ch3) { ?>
                  <li>
                    <?php if ($ch3['category_id'] == $ch3_id) { ?>
                    <a href="<?php echo $ch3['href']; ?>" class="active"><?php echo $ch3['name']; ?></a>
                    <?php } else { ?>
                    <a href="<?php echo $ch3['href']; ?>"><?php echo $ch3['name']; ?></a>
                    <?php } ?>
                  </li>
                  <?php } ?>
                </ul>
                <?php } else {?>
                <a  href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name'];?></a>
              <?php }?>
              </li>
              <?php } ?>
              <?php } ?>
            </ul>
            <?php } ?>
      <?php } ?>
        </li>
        <?php } ?>
      </ul>
    </div>
  </div>
</div>


Posts

Joined
Thu Sep 17, 2015 9:19 pm

Post by deepvision » Tue Sep 22, 2015 2:06 pm

It would be much easier if you simply sent a link to the site to see it in action and test the code in a browser.

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am
Who is online

Users browsing this forum: No registered users and 9 guests