Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Tabs with three levels


sayee3k1

Recommended Posts

Dear friends

 

I am trying to figure out a way to have a three levels of categories at the top of the webpage and made use of this contribution

 

http://www.oscommerce.com/community/contributions,1023

 

 

there is no third level in this and when we click on the second level categories the third level is shown just next to the second level.

 

 

The second level link is not disabled when clicked to view the categories under it.

 

How can I proceed to achieve this. :)

 

Thanks

 

Sai

 

 

 

function show_subcategories($counter) 
{
global $fooa, $subcategories_string, $id, $HTTP_GET_VARS;
$cPath_new = 'cPath=' . $fooa[$counter]['path'];

$subcategories_string .= '<a href="';
$subcategories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new);
$subcategories_string .= '"  class="headerNavigation">';

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

$subcategories_string .= '</a> ';

if ($fooa[$counter]['next_id']) {
 $subcategories_string .= '| ';
 show_subcategories($fooa[$counter]['next_id']);
}else{
 $subcategories_string .= ' ';
}
}
?>

<!-- subcategories //-->
<table border="0" cellspacing="0" cellpadding="4" WIDTH="100%">
<tr class="headerNavigation"><td ALIGN="CENTER" class="headerNavigation">
<?php
if ($cPath) {
 $subcategories_string = '';
 $new_path = '';
 $id = split('_', $cPath);
 reset($id);
 while (list($key, $value) = each($id)) {
	 unset($prev_id);
	 unset($first_id);
	 $subcategories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . $value . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name");
	 $subcategory_check = tep_db_num_rows($subcategories_query);
	 if ($subcategory_check > 0) {
   $new_path .= $value;
   while ($row = tep_db_fetch_array($subcategories_query)) {
  	 $fooa[$row['categories_id']] = array(
     'name' => $row['categories_name'],
     'parent' => $row['parent_id'],
     'level' => $key+1,
     'path' => $new_path . '_' . $row['categories_id'],
     'next_id' => false
  	 );
  	 if (isset($prev_id)) {
     $fooa[$prev_id]['next_id'] = $row['categories_id'];
  	 }

  	 $prev_id = $row['categories_id'];
  	 
  	 if (!isset($first_id)) {
     $first_id = $row['categories_id'];
  	 }

  	 $last_id = $row['categories_id'];
   }
   $fooa[$last_id]['next_id'] = $fooa[$value]['next_id'];
   $fooa[$value]['next_id'] = $first_id;
   $new_path .= '_';
	 } else {
   break;
	 }
 }
}

if ($id[0] != ''){
 show_subcategories($id[0]); 
 echo $subcategories_string;
}else{
 echo " ";
}

?>
</td>
</tr>
</table>

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...