Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

creating customized category menu


theman

Recommended Posts

hi,

i want to make a customized category menu for my site..

 

i hvae sections in the following manner

 

men

->tracksuits

->bottoms

---->jeans

---->pants

->tops

---->dress shirts

---->sweaters

etc

 

 

women

->tracksuits

->bottoms

---->jeans

---->pants

->tops

---->dress shirts

---->sweaters

etc

 

now for my menu all i need is the tracksuits/bttoms->jeans->pants all the subcategories and subsub categories for men..i dont need men to show

 

i cant seem to figure out the rite sql query to run to get my desired output..ive looked at a couple contributions to no avail..any help and direction would be greatly appreciated

 

thanks

Link to comment
Share on other sites

STEP #1 - Duplicate the includes/boxes/categories.php file to two other files: mens_categories.php and womens_categories.php

 

STEP #2 - Find this code in each:

$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");

 

Change this:

where c.parent_id = '0'

to whatever category you desire. Do that for both duplicate files...

 

Bobby

Link to comment
Share on other sites

great that solves half my problem...now i jus need it so that all the sub-sub categories are expanded for the main category ..

STEP #1 - Duplicate the includes/boxes/categories.php file to two other files: mens_categories.php and womens_categories.php

 

STEP #2 - Find this code in each:

$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");

 

Change this:

where c.parent_id = '0'

to whatever category you desire.  Do that for both duplicate files...

 

Bobby

Link to comment
Share on other sites

Maybe I'll code something later this week...

 

If you want to give it a go just use tep_get_subcategories($array, $cat_id) to pull all the subs.

 

Next, loop the array and grab each path:

$c = array();
tep_get_parent_categories($c, $record['id']);
$c = array_reverse($c);
$id = (implode('_', $c) ? implode('_', $c) . '_' . $record['id'] : $record['id']);

 

You should throw in some code to grab the cat name somewhere in there and be sure to include the language ID.

 

Bobby

Link to comment
Share on other sites

thanks for the direction..im gonna try playing around with it..i dont think ill have much sucess as io am not the greatest php coder around :(...if you do get a chance latter on this week to look at it and whip somthin up it would be greatlly aprpeciated

 

thanks for your help so far Bobby

 

 

Maybe I'll code something later this week...

 

If you want to give it a go just use tep_get_subcategories($array, $cat_id) to pull all the subs.

 

Next, loop the array and grab each path:

$c = array();
tep_get_parent_categories($c, $record['id']);
$c = array_reverse($c);
$id = (implode('_', $c) ? implode('_', $c) . '_' . $record['id'] : $record['id']);

 

You should throw in some code to grab the cat name somewhere in there and be sure to include the language ID.

 

Bobby

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...