Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    403
    Plugin Contributions
    0

    help question Search in category header appears on the sidebox with repeated categories

    I installed "Search in Categories Header" into my store. I found out the same search in categories showed up in the right-hand sideboxes with repeated category lists. Can anybody tell me how to make the drop-down list into only one set?

  2. #2
    Join Date
    Jun 2006
    Posts
    403
    Plugin Contributions
    0

    Default Re: Search in category header appears on the sidebox with repeated categories

    I think something wrong with the code in the includes/templates/your_template/sideboxes, but don't know how. Can you help?

    PHP Code:
    <?php
    /**
     * Side Box Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: tpl_search_header.php 4143 2007-11-15 17:40:59Z numinix $
     */
                               
      
    $categories_array[] = array('id' => '''text' =>'All Categories'); 
                                    
    $categories_query "select c.categories_id, cd.categories_name, c.categories_status from " TABLE_CATEGORIES " c, " TABLE_CATEGORIES_DESCRIPTION " cd  where c.categories_status='1' and parent_id = '0' 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' =>$categories->fields['categories_name']); $categories->MoveNext();
                                      }
                                       
      
    $content '<div class="searchHeader back">' BOX_HEADING_SEARCH ': </div><div class="back">';
      
    $content .= zen_draw_form('quick_find_header'zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT'''NONSSL'false), 'get');
      
    $content .= zen_draw_hidden_field('main_page',FILENAME_ADVANCED_SEARCH_RESULT);
      
    $content .= zen_draw_hidden_field('inc_subcat''1''style="display: none"'); 
      
    $content .= zen_draw_hidden_field('search_in_description''1') . zen_hide_session_id();
      
    $content .= zen_draw_pull_down_menu('categories_id'$categories_array);
        
    $content .= zen_draw_input_field('keyword''''size="6" maxlength="30" style="width: 160px" value="' HEADER_SEARCH_DEFAULT_TEXT '" onfocus="if (this.value == \'' HEADER_SEARCH_DEFAULT_TEXT '\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'' HEADER_SEARCH_DEFAULT_TEXT '\';"') . '&nbsp;</div><div class="back"><input type="image" src="'DIR_WS_TEMPLATES $template_dir '/buttons/' $_SESSION['language'] . '/' BUTTON_IMAGE_SEARCH '" alt="' HEADER_SEARCH_BUTTON '" title="' HEADER_SEARCH_BUTTON '" />'
      
    $content .= '</form></div><br class="clearBoth" />';
    ?>

  3. #3
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: Search in category header appears on the sidebox with repeated categories

    Quote Originally Posted by lina0962 View Post
    I think something wrong with the code in the includes/templates/your_template/sideboxes, but don't know how. Can you help?

    PHP Code:
    <?php
    /**
     * Side Box Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: tpl_search_header.php 4143 2007-11-15 17:40:59Z numinix $
     */
                               
      
    $categories_array[] = array('id' => '''text' =>'All Categories'); 
                                    
    $categories_query "select c.categories_id, cd.categories_name, c.categories_status from " TABLE_CATEGORIES " c, " TABLE_CATEGORIES_DESCRIPTION " cd  where c.categories_status='1' and parent_id = '0' 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' =>$categories->fields['categories_name']); $categories->MoveNext();
                                      }
                                       
      
    $content '<div class="searchHeader back">' BOX_HEADING_SEARCH ': </div><div class="back">';
      
    $content .= zen_draw_form('quick_find_header'zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT'''NONSSL'false), 'get');
      
    $content .= zen_draw_hidden_field('main_page',FILENAME_ADVANCED_SEARCH_RESULT);
      
    $content .= zen_draw_hidden_field('inc_subcat''1''style="display: none"'); 
      
    $content .= zen_draw_hidden_field('search_in_description''1') . zen_hide_session_id();
      
    $content .= zen_draw_pull_down_menu('categories_id'$categories_array);
        
    $content .= zen_draw_input_field('keyword''''size="6" maxlength="30" style="width: 160px" value="' HEADER_SEARCH_DEFAULT_TEXT '" onfocus="if (this.value == \'' HEADER_SEARCH_DEFAULT_TEXT '\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'' HEADER_SEARCH_DEFAULT_TEXT '\';"') . '&nbsp;</div><div class="back"><input type="image" src="'DIR_WS_TEMPLATES $template_dir '/buttons/' $_SESSION['language'] . '/' BUTTON_IMAGE_SEARCH '" alt="' HEADER_SEARCH_BUTTON '" title="' HEADER_SEARCH_BUTTON '" />'
      
    $content .= '</form></div><br class="clearBoth" />';
    ?>
    Ideally this should be asked (after reviewing the thread) in the thread related to this plugin.

    No guarantees, but it looks like if you change this portion:
    PHP Code:
                                    $categories_query "select c.categories_id, cd.categories_name, c.categories_status from " TABLE_CATEGORIES " c, " TABLE_CATEGORIES_DESCRIPTION " cd  where c.categories_status='1' and parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' order by sort_order, cd.categories_name"
    To:
    PHP Code:
                                    $categories_query "select DISTINCT c.categories_id, cd.categories_name, c.categories_status from " TABLE_CATEGORIES " c, " TABLE_CATEGORIES_DESCRIPTION " cd  where c.categories_status='1' and parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' order by sort_order, cd.categories_name"
    By adding DISTINCT to the query.

    That the duplicates may be prevented.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v153 Repeated categories in Search in Categories Header
    By lina0962 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 27 Sep 2014, 09:50 PM
  2. How do I change the Categories sidebox header?
    By breauxlg in forum General Questions
    Replies: 2
    Last Post: 17 Oct 2011, 03:36 PM
  3. How can I move my search box from the header to a sidebox?
    By stormysar in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 27 Jul 2009, 01:53 AM
  4. categories sidebox in the header?
    By probablepossible in forum Templates, Stylesheets, Page Layout
    Replies: 13
    Last Post: 29 Jun 2008, 09:50 PM
  5. Adjusting the search sidebox header's margins?
    By kusogaki in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 8 Feb 2007, 04:42 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