Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Stop side menu from expanding?


katie81

Recommended Posts

Posted

I want the side menu, categories.php to only show the top level categories and not to expand when clicked.

 

I have been playing with categories.php but I am soo soo lost, could someone please show me the way?

 

thanks,

katie

Posted

well I did it, if anyone wants to know how.. I commented out this section of code from categories.php:

 

  //------------------------
 /*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;
     }
   }
 }*/

 

 

Katie

Posted

anyone know how I can edit that code I commented out to add it to index.php to display the subcategories for each sub category?

 

Im guesing not.

 

Katie

Posted

Hi Katie,

 

Stopping code, like you have done, by commenting it out is fine to suit the purpose you needed, but I _think_ it will be another matter to simply use that code (say as an include or require) in index.php, or any other files.

 

If you can get the code to work in isolation first, that will be a big step. I do not think the code will work on it's own though, for example, $cPath_array is used, in a number of places in /catalog/includes/application_top.php , and in fact evaluated:

 

$cPath_array = tep_parse_category_path($cPath);

 

There may have been dependant code , in categeries.php, just before the code you commented out. All things being equal, if you look at the sequence of the 'includes/requires' in index.php, then you may be "lucky" to include the commented out code, if it was after where the categories box usually is.

 

Hope that makes sense. :D

 

What I mean is , around line 53 of index.php is

 

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

 

which has the code for the categories box:

 

  if ((USE_CACHE == 'true') && empty($SID)) {
   echo tep_cache_categories_box();
 } else {
   include(DIR_WS_BOXES . 'categories.php');
 }

 

so, back to the 'all things being equal, (backup your files first), add the 'commented out code', after line 53 of index.php, or wherever _that_ line is.

 

Peter

Posted

thanks peter! im going to pick at my head for a day and then ill post back if i need more help

 

thanks batteryrat the pic is me!

 

katie

Posted

Hi,

 

How to do the same with DHTML menu enabled?

 

What Katie did was modify server side scripting (PHP), and what you are mentioning is all client side - DHTML. So in one sense, the 2 methods are worlds apart, but if you can explain more of what you are using now, what you want to achieve (end results), and _how_ you want the end results to be achieved (that is, when they click a link on the menu, etc,etc), possibly we can help you. :D

 

Peter

Posted

Katie,

 

YOU ROCK!

 

:D

 

My customer had asked me to prevent the menu from expanding and I couldn't seem to find the code. IT WORKED PERFECTLY!!

 

 

Thanks!

 

Rob

Posted

glad it helped :) I think that if we all posted the complete solution to a problem we have once we have figured it out it would help all of us on here alot!

 

Peterr has been very helpful with alot of my problems.

 

Katie

Archived

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

×
×
  • Create New...