X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   IF then question about root level categories (https://forum.x-cart.com/showthread.php?t=46628)

inkcarts 03-30-2009 07:06 AM

IF then question about root level categories
 
Is there a way to determine what Root Level category that a sub category is under.

What i'm trying to do is a tabbed navigation. If the category page you are is under a certain root category, then highlight a certain tab.

is there such a thing as

If
category = x
then
style="current"

Thanks in advance for your help.
Lyn

Will Hayes 03-30-2009 11:45 AM

Re: IF then question about root level categories
 
You could try

{$cat}

This variable contains the parent category id of the current category or product page you might be viewing.

For example, you could loop through your standard category array
$categories

and perform a check for a match like this:

Code:

{foreach from=$categories item=c}
<li class="color-{$c.order_by}"><a {if $cat == $c.categoryid}class="active"{/if} href="home.php?cat={$c.categoryid}">{$c.category}</a></li>
{/foreach}


Notice the if statement within the a tag.

Hope that helps you somewhat.

regards
W.


All times are GMT -8. The time now is 02:12 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.