Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Applying styles to sub-categories


suzithepid

Recommended Posts

Posted

I have use css to alter the style of categories. I have also an indented style for sub-categories but cannot figure out where to put the div tag to apply the css. Anyone have any suggestions?

Posted

You want to modify $categories_string in catalog/includes/boxes/categories.php then add level1,level2,etc in your css.

 

 

 function tep_show_category($counter) {
global $tree, $categories_string, $cPath_array;


//div mod
$categories_string .= '<div class="level' . $counter . '">';


for ($i=0; $i<$tree[$counter]['level']; $i++) {
  $categories_string .= "  ";
}

$categories_string .= '<a href="';

if ($tree[$counter]['parent'] == 0) {
  $cPath_new = 'cPath=' . $counter;
} else {
  $cPath_new = 'cPath=' . $tree[$counter]['path'];
}

$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

if (isset($cPath_array) && in_array($counter, $cPath_array)) {
  $categories_string .= '<b>';
}

// display category name
$categories_string .= $tree[$counter]['name'];

if (isset($cPath_array) && in_array($counter, $cPath_array)) {
  $categories_string .= '</b>';
}

if (tep_has_category_subcategories($counter)) {
  $categories_string .= '->';
}

$categories_string .= '</a>';

if (SHOW_COUNTS == 'true') {
  $products_in_category = tep_count_products_in_category($counter);
  if ($products_in_category > 0) {
	$categories_string .= ' (' . $products_in_category . ')';
  }
}

$categories_string .= '<br>';


//div mod
$categories_string .= '</div>'; 


if ($tree[$counter]['next_id'] != false) {
  tep_show_category($tree[$counter]['next_id']);
}
 }
?>

 

 

Then if your using css you dont need some html in there like

 

   
//for ($i=0; $i<$tree[$counter]['level']; $i++) {
//  $categories_string .= "  ";
//}

 

  //$categories_string .= '<br>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...