Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Categories Quick Menu


0911server

Recommended Posts

Hi there,

 

I want to include a "Quick Jump Menu" on my Site with the function "tep_get_category_tree".

 

The link you can see ist is: www.von0auf100.com

 

The Problem is that the script writes not the full cpath in the option value...

 

Here is the code I use:

 

<?php
function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) {
   global $languages_id;

   if (!is_array($category_tree_array)) $category_tree_array = array();
   if ( (sizeof($category_tree_array) < 1) && ($exclude != '0') ) $category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP);

   if ($include_itself) {
     $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int)$languages_id . "' and cd.categories_id = '" . (int)$parent_id . "'");
     $category = tep_db_fetch_array($category_query);
     $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']);
   }

   $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.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and c.parent_id = '" . (int)$parent_id . "' order by c.sort_order, cd.categories_name");
   while ($categories = tep_db_fetch_array($categories_query)) {
     if ($exclude != $categories['categories_id']) $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']);
     $category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . '   ', $exclude, $category_tree_array);
   }

   return $category_tree_array;
 }
 
 
?> 

<tr>
               <td>
<?php


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

 new infoBoxHeading($info_box_contents, false, false);
 $info_box_contents = array();
 $info_box_contents[] = array('form' => tep_draw_form('goto', FILENAME_DEFAULT, '', 'get'),
            'text' => tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'));
  

new infoBox($info_box_contents);
?>
               </td>
             </tr>

 

I think, it would be a nice feature for this site but I'm not a "pro coder".

 

Can someone help me?

 

Michael

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...