Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Stop the expanding Menu Sub-catagories


weird2u2

Recommended Posts

Having problems controlling the way the standard menu on left side works..

 

 

I have just One Catagorie that has sub-catergoies in it, which makes the menu look odd, when it is expanded......( See earlier post = Post subject: Code for catagorie sub levels ???)

 

Can i stop the menu from expanding it self & displaying the sub-catagories ...

 

I would still like the sub-catagories to be displayed in the product listing though... :{ ??

Link to comment
Share on other sites

open 'includes/boxes/categories.php' find the following

  //------------------------

 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;

     }

   }

 }

and comment it out (using /* before and */ after). Then no subcategories will be displayed in the categories box in the left colum (or whereever you display the categories box on your page).

 

regards

ralf

sometimes I change code before reading the comments, sometimes code doesn't even have comments, sometimes I rechange code after I read the code others wrote :-)

Link to comment
Share on other sites

Great , yes commenting out that code worked a treat...

 

now I have no sub-catagories appearing in the menu in left-colum....but still have the sub-catagorie appearing in product listing..just what I needed.

 

One more step up the PHP ladder.... ;)

 

 

Thanks

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...