Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_show_category($counter)


banGbro

Recommended Posts

Should I posted in the wrong section, appologies, and please provide where moved location if this to be moved.

 

 

I want my categories box to look like so:

 

<ul class="sidemenu">
 <li id="current"><a href="">Category 1</a></li>
 <ul class="sidemenu">
<li><a href="">Sub Category</a></li>
etc....
 </ul>
 <li><a href="">Category 2</a></li>
 <li><a href="">Category 3</a></li>
</ul>

 

 

Ive achieved adding <li> tags before and after <a> tags, but more coding is needed if I want it to also include <ul> tags for subcategories. I program in C++, and Im very new to php, so I need some help, please.

 

Here is the code I have thus far for tep_show_category function:

 

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

for ($i=0; $i<$tree[$counter]['level']; $i++) {
  $categories_string .= '  ';
}
//<li id="current"><a href="default.html">Home</a></li>
$categories_string .= '<li><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) . '"></li>';

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>';

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

 

 

Please help.

Link to comment
Share on other sites

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...