Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dropdown fpr Category Groups


czar

Recommended Posts

Posted

Hi!

 

I'm creating a shop for fashion. therefore I have two main categories: men und women.

 

now I want to create twi seperate Dropdowns with the first entry men (or women) and then alle the subcategories from men (or women). If you select an item of the dropdown the category should appear.

 

Can somebody help me?

 

I tried

<?php
  $categories_array = array(); 
  $men_cat_id = 1; 
  $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 = '" . $men_cat_id . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"); 
  while ($categories = tep_db_fetch_array($categories_query))  { 
     $key = tep_href_link(FILENAME_DEFAULT, "cPath=" . $men_id . '_' . $categories['categories_id'] ); 
     $categories_array[] = array('id' => $key, 'text' => $categories['categories_name']); 
  } 
  echo '<form action="' . tep_href_link(FILENAME_DEFAULT) . '" method="get">' . tep_hide_session_id() . tep_draw_pull_down_menu('categories', $categories_array, 'onchange="this.form.submit();"') . '</form>';
?>

and

<?php
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'left',
                              'text'  => BOX_HEADING_CATEGORIES
                             );
 new infoBoxHeading($info_box_contents, true, true);

 $info_box_contents = array();
 $info_box_contents[] = array('form' => '<form action="' . tep_href_link(FILENAME_DEFAULT) . '" method="get">' . tep_hide_session_id(),
                              'align' => 'left',
         'text'  => tep_draw_pull_down_menu('categories', $categories_array, $cPath, 'onchange="this.form.submit();"')
                             );
 new infoBox($info_box_contents);
?>

But it didn't work. The first Code was ok to create the dropdown for all men subcategories, but the page didn't redirect. And the "men" entry was missing.

 

THX

Czar

Archived

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

×
×
  • Create New...