Post by Dez1234 » Thu Sep 08, 2011 9:25 pm

Does anyone know how I would add sub categories to my drop down.

I already have Category title>Sub Category

But what I want to have is Category title> Sub Category > Sub sub Category

This is what I have so far:

Code: Select all

   <ul class="categories">          

			  <?php if ($categories) { //Get Categories ?>             
                <?php foreach ($categories as $category) { ?>
                <li class="level0"><a href="<?php echo $category['href']; ?>" class="level-top"><?php echo $category['name']; ?></a>
                
                  <?php if ($category['children']) { ?>
						<?php for ($i = 0; $i < count($category['children']);) { ?>

                        
                        <ul>
                              <?php $j = $i + ceil(count($category['children']) / $category['column']);?>
                              <?php for (; $i < $j; $i++) { ?>
                              <?php if (isset($category['children'][$i])) { ?>
                              <li <?php if($i+1==$j){echo 'class="last"';} ?>><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a>
                              
                              
                          
                              
                              
                              
                              
                              
                              
                              </li>
                              <?php } ?>
                              <?php } ?>
                        </ul>
                        <?php } ?>
                  <?php } ?>
                </li>
                
             
                <?php } ?>
            <?php } //End Categories ?>
        

        
        </ul>
		

Thanks

Newbie

Posts

Joined
Wed Sep 07, 2011 7:33 pm

Post by wickedcool » Fri Sep 09, 2011 2:46 pm

You're not alone in wanting this, I'm trying to work it out too.
There's a thread with some code changes to do this on the categories menu module (on the left), but nothing for the top dropdown menu. I've looked through the code and along with a few CSS problems the main code loops through the categories very differently from the category module code.

Seems quite an important feature missing to me.

Will update you if I find a way.

Newbie

Posts

Joined
Sat Jul 30, 2011 5:43 pm

Post by uksitebuilder » Fri Sep 09, 2011 5:09 pm

It's not going to be easy to implement in the drop that is used.

You may want to look for an alternative drop down script

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by Xsecrets » Fri Sep 09, 2011 10:11 pm

yeah I've done it once for a client, and I simply scrapped the existing menu and created a new one in the header.tpl

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Dez1234 » Tue Sep 13, 2011 12:18 am

Thanks for your help, I'll find a different script

Newbie

Posts

Joined
Wed Sep 07, 2011 7:33 pm

Post by Qphoria » Tue Sep 13, 2011 12:22 am

The way the code is setup in 1.5.x for categories is for 2 levels only. If you want more levels the code would be better off swapped for a recursive function like 1.4.x had

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 8 guests