Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Sub-Categories active/current link

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 06-16-2010, 12:28 AM
 
inteliboy1 inteliboy1 is offline
 

Member
  
Join Date: Jun 2010
Posts: 27
 

Default Sub-Categories active/current link

I have a UL accordion menu, with nested UL subcategories - something like this:

Code:
<ul> <li><a href="#">Category</a></li> <li><a href="#" class="current">Category</a> <ul> <li><a href="#">Sub-Category</a></li> <li><a href="#" class="currentsub">Sub-Category</a></li> <li><a href="#">Sub-Category</a></li> </ul> </li> <li><a href="#">Category</a></li> <li><a href="#">Category</a></li> </ul>

It works pretty well, when on a Category page the 'current' class is applied to highlight what category the user is on. Basic stuff.

Though I can't figure out for the life of me how to do the same for subcategories... ie. have a sub-category and it's parent-category applied with a 'current' class.

I've searched the forums though can't seem to find out how. Any help or pointers would be hugely appreciated, still getting my head around x-cart.
__________________
X-Cart Pro
4.4
Reply With Quote
  #2  
Old 06-21-2010, 06:04 AM
 
inteliboy1 inteliboy1 is offline
 

Member
  
Join Date: Jun 2010
Posts: 27
 

Default Re: Sub-Categories active/current link

I figured this out - for future reference if any newbies need help like I did:

Just be clever with some if/else statements ie:

Apply class to current category <a>
{if $current_category.categoryid eq $c.categoryid} class="expand"{/if}

Apply class to current category parent <a>
{if $current_category.parentid eq $c.categoryid} class="expand" {/if}

Sub Category menu items are different --
{if $current_category.categoryid eq $cat.categoryid} class="subactive"{/if}
__________________
X-Cart Pro
4.4
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:46 PM.

   

 
X-Cart forums © 2001-2020