Post by playin6ft5vb » Sat May 12, 2012 6:27 am

Hey, so I tried searching for the answer, but could not find anything. It could be that I have over modified something and missed a step somewhere.

Basically what I am trying to do is get my subcategories to show on the subcategories page. I would also like them on the product page too. Right now they are only showing when you click on one of the main categories. So pretty much I want to subcategories to display when: 1) you click on a main category. 2) you click on a subcategory. 3) when you are viewing a product.

The site is milafargo.com/shop if you need to see what I am talking about.

Any help would be awesome. Thank you in advance.
Last edited by playin6ft5vb on Wed May 16, 2012 3:30 am, edited 1 time in total.

Newbie

Posts

Joined
Sat May 12, 2012 6:21 am

Post by Avvici » Sat May 12, 2012 11:56 am

Without using the category module somewhere on your page no, that's not possible with default. For example if you go here: http://www.milafargo.com/shop/index.php ... ry&path=59 you see the Main parent category Menswear and it's children categories. Once you click on a child category you won't see the other children again :) However, the category module always shows all of the children in the family. Either install that...or edit the code in category.tpl to always show children. A good example of all children being show on the LEFT column with category module
http://demo.opencart.com/index.php?rout ... path=25_28

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by playin6ft5vb » Sun May 13, 2012 1:31 am

Thanks for the response.

I don't want to install a category module if at all possible. How could I change the category.tpl to always show children?

I am still not sure what I am doing wrong. Here is the section that is controlling my sub-cats. Though I have tried changing it, still haven't gotten the results I was expecting. While, I admit I am not the greatest at PHP, I can normally figure it out, but this one is stumping me.

category.tpl:

Code: Select all

 <?php if ($categories) { ?>
  
  <div class="category-list">
  <!--<h2><?php echo $text_refine; ?></h2> -->
    <?php if (count($categories) <= 5) { ?>
    <li>
      <?php foreach ($categories as $category) { ?>
      <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
      <?php } ?>
    </li>
    <?php } else { ?>
    <?php for ($i = 0; $i < count($categories);) { ?>
    <li>
      <?php $j = $i + ceil(count($categories) / 4); ?>
      <?php for (; $i < $j; $i++) { ?>
      <?php if (isset($categories[$i])) { ?>
      <li><a href="<?php echo $categories[$i]['href']; ?>"><?php echo $categories[$i]['name']; ?></a></li>
      <?php } ?>
      <?php } ?>
    </li>
    <?php } ?>
    <?php } ?>
  </div>
  <?php } ?>

Newbie

Posts

Joined
Sat May 12, 2012 6:21 am

Post by playin6ft5vb » Mon May 14, 2012 12:48 am

Anyone?

Newbie

Posts

Joined
Sat May 12, 2012 6:21 am

Post by playin6ft5vb » Wed May 16, 2012 3:31 am

So ended up adding the module. Thanks for the help a vvici. I realized now why it wasn't as on easy fix as I thought it would be.

Newbie

Posts

Joined
Sat May 12, 2012 6:21 am

Post by rolloutking » Fri May 18, 2012 6:38 am

What module did you install. I have the same problem

Newbie

Posts

Joined
Fri May 18, 2012 3:57 am
Who is online

Users browsing this forum: No registered users and 19 guests