Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Category Tabs with Subs v2.0: subcat highlighting


grayson

Recommended Posts

First: Many thanks for a very nice contribution.

 

This post contains a simple modification to the categories_subtab.php file in this contribution, to highlight the subcategory currently being viewed.

 

Background: Since I removed the categories box and the breadcrumb trail after adding this tabs contribution, I also wanted to have the current subcategory highlighted, so the visitor can still easily see where he/she is in the site. I searched to see if someone had already come up with a solution, but didn't find anything. Turns out it's a much simpler fix than I had envisioned -- in fact, it's the same trick that highlights the current subcategory in the original categories box in categories.php.

 

To add highlighting in the subcategory bar, in the file [store path]/includes/categories_subtab.php, replace (around line 27):

 

 

	// display category name
$subcategories_string .= $fooa[$counter]['name'];

with

if ( ($id) && (in_array($counter, $id)) ) {
$subcategories_string .= "<b>";    }

// display category name
$subcategories_string .= $fooa[$counter]['name'];

if ( ($id) && (in_array($counter, $id)) ) {
$subcategories_string .= "</b>";    }

That's all there is to it!

 

Regards,

 

--Grayson

Grayson Morris

Link to comment
Share on other sites

  • 2 years later...

Just took this a step further so you can use the css styles on it

 

What i did was to change the

 

$subcategories_string .= '" class="subNavigation">';

 

to

 

if ( ($id) && (in_array($counter, $id)) ) {

$subcategories_string .= '" class="subNavigation2">';

}else{

$subcategories_string .= '" class="subNavigation">';

}

 

 

And then of course make the nesasary css class in the stylesheet:

 

A.subNavigation2 {

color: #FF0000;

}

 

A.subNavigation2:hover {

color: #DD0000;

text-decoration:none;

 

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...