Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Removing child categories from main navigation?


EyeDentify

Recommended Posts

Posted

Here is a link to a osCommerce store I am working on. http://www.nextlevelracing.net

 

How do I remove the child categories from my main navigation on the left? I hate how it drops down and want to disable that. When you click on the main category I want the child categories to display on the right like it does, but I do not want it to drop down in the left column like it does.

Posted

Seems that you have a glitch in your template first off.. ALL of your categories are opening when you click on just one..

 

Secondly see here

Remove subcategories from category box

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Posted
Seems that you have a glitch in your template first off.. ALL of your categories are opening when you click on just one..

 

Secondly see here

Remove subcategories from category box

 

No, if you click on the Air/Fuel category, then it opens the subcategories. I tested this in Firefox and IE. Could you please provide me a screen shot and let me know what browser this is happening in? Thank you for the link.

Posted

Here is the code I am using for my categories.php file.

 

<?php
/*
 $Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

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

if ($count == 0 ) $kk=' class="bg_list"'; else $kk=' class="bg_list"'; 

$count++;

if(!$tree[$counter]['level']){ 
$categories_string .= $categories_string ? '' : ''; 
$categories_string .= '<li'.$kk.'><a href=';

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

  }
}

if ($tree[$counter]['parent'] == 0) {
$cPath_new = 'cPath=' . $counter;
} else {
$cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link('index.php', $cPath_new) . '>';

// display categry name
$categories_string .= $tree[$counter]['name'];
$categories_string .= $num_prod.'</a></li>';

  }else{

 // SUBCATEGORY
if (SHOW_COUNTS == 'true') {
  $products_in_category = tep_count_products_in_category($counter);
  if ($products_in_category > 0) {
	$num_prod =  ' ('.$products_in_category.')';
  }
}	 
$count = 2;
$categories_string .= '';

for($i=0;$i<$tree[$counter]['le vel'];$i++)
 $categories_string .= '';

$categories_string .= '<li class="bg_list_sub"><a href=';   
if ($tree[$counter]['parent'] == 0) {
  $cPath_new = 'cPath=' . $counter;
} else {
  $cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link('index.php', $cPath_new) . '>';
// display category name
$categories_string .= $tree[$counter]['name'];
$categories_string .= $num_prod.'</a></li>';
 }



if ($tree[$counter]['next_id'] != false && $ii < 30) {
  tep_show_category($tree[$counter]['next_id'], $count);
}  
 }
?>
<!-- categories //-->
	  <tr>
		<td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);

 new infoBoxHeading($info_box_contents, true, false);

 $categories_string = '<ul>';
 $tree = array();

 $categories_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 = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
 while ($categories = tep_db_fetch_array($categories_query))  {
$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
											'parent' => $categories['parent_id'],
											'level' => 0,
											'path' => $categories['categories_id'],
											'next_id' => false);

if (isset($parent_id)) {
  $tree[$parent_id]['next_id'] = $categories['categories_id'];
}

$parent_id = $categories['categories_id'];

if (!isset($first_element)) {
  $first_element = $categories['categories_id'];
}
 }

 //------------------------
 if (tep_not_null($cPath)) {
$new_path = '';
reset($cPath_array);
while (list($key, $value) = each($cPath_array)) {
  unset($parent_id);
  unset($first_id);
  $categories_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 = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
  if (tep_db_num_rows($categories_query)) {
	$new_path .= $value;
	while ($row = tep_db_fetch_array($categories_query)) {
	  $tree[$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($parent_id)) {
		$tree[$parent_id]['next_id'] = $row['categories_id'];
	  }

	  $parent_id = $row['categories_id'];

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

	  $last_id = $row['categories_id'];
	}
	$tree[$last_id]['next_id'] = $tree[$value]['next_id'];
	$tree[$value]['next_id'] = $first_id;
	$new_path .= '_';
  } else {
	break;
  }
}
 }
 $count = 0;
 tep_show_category($first_element, $count); 
 $categories_string .='</ul>';
 $info_box_contents = array();
 $info_box_contents[] = array('text' => $categories_string);

 new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- categories_eof //-->

Posted

ohh isee.. you have an interesting category layout.. Have you considered having multiple BOXES instead?? it makes things look a lot more oganized with fewer clicks to get to the product

 

theres an error on this site, btuy ou can see what i'm talking about here

more category boxes

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

  • 3 weeks later...
Posted

Sorry for the delay in response. I have worked like 60+ hours this week at my day job alone. Not counting the hours in other projects I have done at home.

 

Anyways, I do see what you mean about the navigation, but that would make a long side navigation for this site. Esentially I just want to have the first categories link. Then the sub categories appear on the right in the main content area. It's an easy navigation and it's what a majority of people purchasing these types of products are use too since their are pretty in depth catagories in the automotive field. Thanks in advance to anyone that can help me on this.

Archived

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

×
×
  • Create New...