Results 1 to 7 of 7
  1. #1
    Join Date
    May 2006
    Location
    Scotland
    Posts
    198
    Plugin Contributions
    0

    help question Custom search button

    I have made a new image button to replace the standard 'search' button in tpl_search_header.php but I cannot get it to align properly to the input box.
    This is a problem that I see several people have had, but none of the solutions seem to work for me - perhaps because they were for V1.3.6
    Any ideas how I do this?

  2. #2
    Join Date
    Sep 2006
    Posts
    542
    Plugin Contributions
    0

    Default Re: Custom search button

    in your template sideboxes and tpl_search_header.php Line 21

    $content .= zen_draw_input_field('keyword', '', 'size="18" maxlength="100" style="width: ' . ($column_width-30) . 'px" 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 . '\';"') . zen_image_submit(BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON,'class="input" hspace="0" vspace="0" style="margin-left:5px"');

    This will draw your search button from the
    /includes/templates/template_default/buttons/english/button_search.gif

    You also have my added styles for adjustments.

  3. #3
    Join Date
    Jun 2005
    Location
    Texas
    Posts
    59
    Plugin Contributions
    0

    Default Re: Custom search button

    Quote Originally Posted by usernamenone View Post
    in your template sideboxes and tpl_search_header.php Line 21

    $content .= zen_draw_input_field('keyword', '', 'size="18" maxlength="100" style="width: ' . ($column_width-30) . 'px" 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 . '\';"') . zen_image_submit(BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON,'class="input" hspace="0" vspace="0" style="margin-left:5px;"');
    FYI, you forgot the semi-colon at the end of the image style tag. I added it above. Thanks for the idea.

  4. #4
    Join Date
    Aug 2006
    Location
    portlandish, oregon
    Posts
    799
    Plugin Contributions
    0

    Default Re: Custom search button

    am I supposed to be adding the above code to line 21, or replacing code?

  5. #5
    Join Date
    Apr 2007
    Posts
    12
    Plugin Contributions
    0

    Default Re: Custom search button

    I also have this same question....

    -Graham

  6. #6
    Join Date
    Feb 2007
    Posts
    513
    Plugin Contributions
    2

    Default Re: Custom search button

    change
    input type = "submit"
    to
    input type= "image" src="http://www.klmoda.com.au/search_button.jpg"

    and
    value="' . HEADER_SEARCH_BUTTON . '"
    to
    value=""


    \includes\templates\template_default\sideboxes\tpl_search_header.php
    v.1.3.8 standard code
    comes out like http://www.klmoda.com.au/index.php



    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 4142 2006-08-15 04:32:54Z drbyte $
     */
      
    $content "";
      
    $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('search_in_description''1') . zen_hide_session_id();
      if (
    strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') {
        
    $content .= zen_draw_input_field('keyword''''size="6" maxlength="30" style="width: 100px" 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;' zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
      } else {
        
    $content .= zen_draw_input_field('keyword''''size="6" maxlength="30" style="width: 100px" 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;<input type="image" src="http://www.klmoda.com.au/search_button.jpg" value="" />';
      }
      
      
    $content .= "</form>";
    ?>

  7. #7
    Join Date
    Feb 2007
    Posts
    513
    Plugin Contributions
    2

    Default Re: Custom search button

    I had to put my button in a table to keep it in-line with the search box

    Edit 1

    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 4142 2006-08-15 04:32:54Z drbyte $
     */
      
    $content "";
      
    $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('search_in_description''1') . zen_hide_session_id();
      if (
    strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') {
        
    $content .= zen_draw_input_field('keyword''''size="6" maxlength="30" style="width: 100px" 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;' zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
      } else {
     
     
     
        
    $content .= 
      
    '<table border="0" cellpadding="0" cellspacing="0">
         <tr>
          '
    .'<td valign="middle">'zen_draw_input_field('keyword''''size="6" maxlength="30" style="width: 100px" 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 '\';"') .'</td>'.'<td>''&nbsp;<input type="image" src="http://www.klmoda.com.au/search_button.jpg" value="" />' .'</td>'.'</tr></table>'
      }
     
     
     
     
     
     
     
      
    $content .= "</form>";
    ?>



    edit 2 for firefox (gap at top fix)


    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 4142 2006-08-15 04:32:54Z drbyte $
     */
      
    $content "";
      
    $content .= zen_draw_hidden_field('search_in_description''1') . zen_hide_session_id();
      if (
    strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') {
        
    $content .= zen_draw_input_field('keyword''''size="6" maxlength="30" style="width: 100px" 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;' zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
      } else {
     
     
     
        
    $content .= 
      
    '<table border="0" cellpadding="0" cellspacing="0">
         <tr>
          '
    .'<td valign="middle">';
     
         
    $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_input_field('keyword''''size="6" maxlength="30" style="width: 100px" 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 '\';"') .'</td>'.'<td>''&nbsp;<input type="image" src="http://www.klmoda.com.au/search_button.jpg" value="" />' .'</td>'.'</tr></table>'
      }
     
     
      
    $content .= "</form>";
    ?>

 

 

Similar Threads

  1. v151 Custom search and custom search URL.
    By RFree190 in forum General Questions
    Replies: 1
    Last Post: 5 Feb 2013, 02:25 PM
  2. custom search button image
    By keneso in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 21 Jan 2011, 02:28 AM
  3. Custom search text and button layout.
    By Develop&Promote in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 14 Jul 2010, 09:32 AM

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