Post by megahuman » Mon Sep 03, 2012 2:56 pm

Hey guys,

I'm using 1.5.4 and looking to display only my subcategories and not allow the parent categories to be seen.

Is this possible? Hope you can help, cheers!

Web Design and Development at 7 Design


Active Member

Posts

Joined
Tue Dec 14, 2010 4:57 pm

Post by anung » Mon Sep 03, 2012 5:11 pm

open category.tpl in
catalog-->view-->theme-->yourtheme-->template-->module

change this code

Code: Select all

<div class="box">
  <div class="box-heading"><?php echo $heading_title; ?></div>
  <div class="box-content">
    <div class="box-category">
      <ul>
        <?php foreach ($categories as $category) { ?>
        <li>
          <?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']) { ?>
          <ul>
            <?php foreach ($category['children'] as $child) { ?>
            <li>
              <?php if ($child['category_id'] == $child_id) { ?>
              <a href="<?php echo $child['href']; ?>" class="active"> - <?php echo $child['name']; ?></a>
              <?php } else { ?>
              <a href="<?php echo $child['href']; ?>"> - <?php echo $child['name']; ?></a>
              <?php } ?>
            </li>
            <?php } ?>
          </ul>
          <?php } ?>
        </li>
        <?php } ?>
      </ul>
    </div>
  </div>
</div>
with

Code: Select all

<div class="box">
  <div class="box-heading"><?php echo $heading_title; ?></div>
  <div class="box-content">
    <div class="box-category">
      <ul>
        <?php foreach ($categories as $category) { ?>        
            <?php foreach ($category['children'] as $child) { ?>
            <li>
              <?php if ($child['category_id'] == $child_id) { ?>
              <a href="<?php echo $child['href']; ?>" class="active"> - <?php echo $child['name']; ?></a>
              <?php } else { ?>
              <a href="<?php echo $child['href']; ?>"> - <?php echo $child['name']; ?></a>
              <?php } ?>
            </li>
            <?php } ?>          
          <?php } ?>       
      </ul>
    </div>
  </div>
</div>

User avatar
Active Member

Posts

Joined
Fri Mar 30, 2012 10:32 am
Location - Indonesia

Post by megahuman » Wed Sep 05, 2012 9:31 am

Sorry what I was meant to say was only show the subcategories in the category bar on the side?

http://party.7design.com.au/index.php?r ... ry&path=61

See on the left sidebar

Hire Products
Weddings
Corporate Functions
Price List
Parent

Well removing all those, and only showing

- test 1
- test 2

Web Design and Development at 7 Design


Active Member

Posts

Joined
Tue Dec 14, 2010 4:57 pm

Post by romickla » Tue Nov 13, 2012 5:56 am

Is there a solution for this? I want to do the same thing

Newbie

Posts

Joined
Fri Sep 14, 2012 12:04 am

Post by megahuman » Tue Nov 13, 2012 6:02 am

Unfortunately I couldn't find a solution. Instead I just made them all just normal categories.

What is the reason for your needs to do this as there may be another solution...

Web Design and Development at 7 Design


Active Member

Posts

Joined
Tue Dec 14, 2010 4:57 pm

Post by anung » Tue Nov 13, 2012 1:54 pm

megahuman wrote:Sorry what I was meant to say was only show the subcategories in the category bar on the side?

http://party.7design.com.au/index.php?r ... ry&path=61

See on the left sidebar

Hire Products
Weddings
Corporate Functions
Price List
Parent

Well removing all those, and only showing

- test 1
- test 2
This is not category

Hire Products
Weddings
Corporate Functions
Price List



The left side bar is showing all parent category. Try click the cooking Equipment. you can see what I mean.

User avatar
Active Member

Posts

Joined
Fri Mar 30, 2012 10:32 am
Location - Indonesia

Post by craft37 » Thu Feb 14, 2013 10:13 am

anung wrote:open category.tpl in
catalog-->view-->theme-->yourtheme-->template-->module

change this code

Code: Select all

<div class="box">
  <div class="box-heading"><?php echo $heading_title; ?></div>
  <div class="box-content">
    <div class="box-category">
      <ul>
        <?php foreach ($categories as $category) { ?>
        <li>
          <?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']) { ?>
          <ul>
            <?php foreach ($category['children'] as $child) { ?>
            <li>
              <?php if ($child['category_id'] == $child_id) { ?>
              <a href="<?php echo $child['href']; ?>" class="active"> - <?php echo $child['name']; ?></a>
              <?php } else { ?>
              <a href="<?php echo $child['href']; ?>"> - <?php echo $child['name']; ?></a>
              <?php } ?>
            </li>
            <?php } ?>
          </ul>
          <?php } ?>
        </li>
        <?php } ?>
      </ul>
    </div>
  </div>
</div>
with

Code: Select all

<div class="box">
  <div class="box-heading"><?php echo $heading_title; ?></div>
  <div class="box-content">
    <div class="box-category">
      <ul>
        <?php foreach ($categories as $category) { ?>        
            <?php foreach ($category['children'] as $child) { ?>
            <li>
              <?php if ($child['category_id'] == $child_id) { ?>
              <a href="<?php echo $child['href']; ?>" class="active"> - <?php echo $child['name']; ?></a>
              <?php } else { ?>
              <a href="<?php echo $child['href']; ?>"> - <?php echo $child['name']; ?></a>
              <?php } ?>
            </li>
            <?php } ?>          
          <?php } ?>       
      </ul>
    </div>
  </div>
</div>
Dear Anung,
Can you tell me, how to make categories name as box-heading for subcategories?
It's needed to divide subcategories for various blocks
Screen-shot: Image

New member

Posts

Joined
Sun Dec 09, 2012 12:30 pm
Who is online

Users browsing this forum: No registered users and 1 guest