Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Different formating for category and subcategory links


e-milosz

Recommended Posts

As far as I see subcategory is shown using the same loop in below PHP function.

Here I am using class="cat-menu" (I got rid of not necessary HTML code and used Style with display:block attribute for <a> element)

 

If I only could apply different CSS class for subcategory <a>....

Any ideas?

 

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

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

$categories_string .= '<a class="cat-menu" 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 .= '->';
}

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 .= '</a>';



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

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

Link to comment
Share on other sites

Something like following?

 

	//$categories_string .= '<a class="cat-menu" href="';

if ($tree[$counter]['parent'] == 0) {
  $categories_string .= '<a class="cat-menu" href="';
  $cPath_new = 'cPath=' . $counter;
} else {
  $categories_string .= '<a class="subcat-menu" href="';
  $cPath_new = 'cPath=' . $tree[$counter]['path'];
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...