Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Advanced Search - Deisplay only Top Category in drop down

    Searched quite a bit for this, came close, but can't resolve this simple issue.

    I'd like the category drop down in Advanced Search to only drop down the TOP categories only.

    We have a 3 mile long list right now! Minimizing to the main top 16 would be great!

    Thanks!

    PHP Code:
        <legend><?php echo ENTRY_CATEGORIES?></legend>
        <div class="floatLeft"><?php echo zen_draw_pull_down_menu('categories_id'zen_get_categories(array(array('id' => '''text' => TEXT_ALL_CATEGORIES)), '0' ,'''1'), $sData['categories_id']); ?></div>
    <?php echo zen_draw_checkbox_field('inc_subcat''1'$sData['inc_subcat'], 'id="inc-subcat"'); ?><label class="checkboxLabel" for="inc-subcat"><?php echo ENTRY_INCLUDE_SUBCATEGORIES?></label>

  2. #2
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Re: Advanced Search - Deisplay only Top Category in drop down

    The drop down menu code is calling the zen_get_categories function

    I could direct it to a new function of similar direction but need it to be limited to the top categories, no subcategories

    Here is the zen_get_categories function

    PHP Code:
     function zen_get_categories($categories_array ''$parent_id '0'$indent ''$status_setting '') {
        global 
    $db;

        if (!
    is_array($categories_array)) $categories_array = array();

        
    // show based on status
        
    if ($status_setting != '') {
          
    $zc_status " c.categories_status='" . (int)$status_setting "' and ";
        } else {
          
    $zc_status '';
        }

        
    $categories_query "select c.categories_id, cd.categories_name, c.categories_status
                             from " 
    TABLE_CATEGORIES " c, " TABLE_CATEGORIES_DESCRIPTION " cd
                             where " 
    $zc_status "
                             parent_id = '" 
    . (int)$parent_id "'
                             and c.categories_id = cd.categories_id
                             and cd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'
                             order by sort_order, cd.categories_name"
    ;

        
    $categories $db->Execute($categories_query);

        while (!
    $categories->EOF) {
          
    $categories_array[] = array('id' => $categories->fields['categories_id'],
                                      
    'text' => $indent $categories->fields['categories_name']);

          if (
    $categories->fields['categories_id'] != $parent_id) {
            
    $categories_array zen_get_categories($categories_array$categories->fields['categories_id'], $indent '&nbsp;&nbsp;''1');
          }
          
    $categories->MoveNext();
        }

        return 
    $categories_array;
      } 

  3. #3
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Re: Advanced Search - Deisplay only Top Category in drop down

    Here's the answer.

    I duplicated the function "zen_get_categories" but directed it to zen_get_searchcategories, then found and commented out the code that displays the subcategories.

    // if ($categories->fields['categories_id'] != $parent_id) {
    // $categories_array = zen_get_categories($categories_array, $categories->fields['categories_id'], $indent . '&nbsp;&nbsp;', '1');
    // }

 

 

Similar Threads

  1. Manufacturer, Sub Category Drop Down Search?
    By vacuumwarlock in forum General Questions
    Replies: 1
    Last Post: 18 Apr 2014, 05:17 PM
  2. Need an Advanced Category Drop-Down Menu
    By Hell Guapo in forum All Other Contributions/Addons
    Replies: 18
    Last Post: 8 Dec 2011, 06:20 PM
  3. Replies: 1
    Last Post: 20 Apr 2010, 04:33 AM
  4. Advanced Search On one Category Only All the time
    By scottrdj in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 24 Jun 2008, 03:36 PM
  5. Advanced Search drop-down too big
    By cfe in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 12 Jul 2006, 04:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR