Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

only show current category and sub categories


claireb85

Recommended Posts

Posted

Hi

 

I was wondering if it is possible that when you click on a category that you only see the category you selected and its subcategories in the infobox, you cant see any of the other categories above or below it.

 

For example:

 

This is what it is like now:

 

Category A

Category B

sub category B1

sub category B2

sub category B3

sub category B4

sub category B5

Category C

Category D

Category E

 

I wolud like it to look like this:

 

Category B

sub category B1

sub category B2

sub category B3

sub category B4

sub category B5

 

I hope this makes sense and if someone could help me that would be great.

 

Thanks

Claire

Posted

I do not see how that would be functional in any way because when they choose the subcategory, if they want to go to a different cateory, they would have to "unchoose" the category that they are currently in, and then click the next one and so on.. too many clicks for people who want to "browse"

 

What is the reasoning for this type of menu?? if is just to save space, a flyout/drop down would be a better option..

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
Thanks for your reply, I would have the main categories along the top of the page so no need to go back. Here are 2 sites that i have seen it on to give you better idea. (i am designing a beauty site)

 

Well it's not difficult to do... look in your includes/boxes/categories.php file for the following lines...

 

<!-- 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 = '';
 $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))  {

 

and try replacing them with these...

 

<!-- categories //-->
	  <tr>
		<td>
<?php
 $current_categories_id = (tep_not_null($cPath_array)) ? $cPath_array[0] : '0';
 $categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '". $current_categories_id . "' and language_id='" . (int)$languages_id ."'");
 if ($categories = tep_db_fetch_array($categories_query))  {
$categories_heading = $categories['categories_name'];
 } else {
$categories_heading = BOX_HEADING_CATEGORIES;
 }

 $info_box_contents = array();
 $info_box_contents[] = array('text' => $categories_heading);

 new infoBoxHeading($info_box_contents, true, false);

 $categories_string = '';
 $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 = '" . $current_categories_id . "' 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))  {

 

The changes alter the text used for the categories info box heading to the current top level category, then only put the subcategories in the box. If there are no subcategories, then the box will be empty of course.

 

Is that what you want to do? :)

Archived

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

×
×
  • Create New...