Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

how to show subcategory by default


phpimran

Recommended Posts

hi, i m newbie to oscommerce, and i want on my shop to show both category and subcategory by default. At the moment subcategory is only shown when its parent category is clicked. i have searched a lot on the forum but didn't get what i wanted.

 

any help is appreciated....

thanks in advance

Link to comment
Share on other sites

hi, after lots of search i come to the following, it is showing subcategory by default but not in the order i wanted. the subcategory is showing above the category link...

this is the code :

 

//showing sub_category by default..

$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 = '" . (int)$categories['categories_id'] . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

//while ($subcategories = tep_db_fetch_array($subcategories_query)) {

$key=0;

 

while ($subcategories = tep_db_fetch_array($subcategories_query)) {

$tree[$subcategories['categories_id']] = array('name' => $subcategories['categories_name'],

'parent' => $subcategories['parent_id'],

'level' => $key+1,

'path' => $new_path . '_' . $subcategories['categories_id'],

'next_id' => false);

$tree[$parent_id]['next_id'] = $subcategories['categories_id'];

$parent_id = $subcategories['categories_id'];

$first_id = $subcategories['categories_id'];

 

}

//}

//end of sub_category by default link..

 

 

please correct me if any one can !!!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...