Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Posts
    17
    Plugin Contributions
    0

    Default Header Search Box - How to add text?

    I would like to add "Search For" before the header search box that reads "Enter search keywords here". Is that possible? How (bearing in mind that I'm a newbie)?

    Note: I have changed the text in the search box and for the search button.

  2. #2
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Header Search Box - How to add text?

    This is a bit of a hack, but it seems to work...

    See my example at http://www.buysouthafrican.co.uk/shop

    If you are using a CUSTOM template, then the files that I list in this post must be edited and saved into your custom folders.

    I have a TEST SHOP which uses the CLASSIC template, so this will be my custom template in my examples below. If you have a different template, then in the directory paths below, substitute YOUR template wherever you see \classic\.

    1. Create a folder called sideboxes, in your custom template: eg:-
    ( includes\templates\classic\sideboxes\ )

    2. Using FTP, navigate to:-
    includes\templates\template_default\tpl_search_header.php
    and ftp a copy to your hard drive.

    3. Open the hard-drive copy of tpl_search_header.php for editing.

    Original code starts as:-

    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 "";
    Edit it as follows:-

    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 $
     */
     
    ?>
     <div id="searchHeaderText"><?php echo SEARCH_HEADER_TEXT?></div>
    <?php
      $content 
    "";
    So, you are INSERTING the following above the $content line
    PHP Code:
     ?>
     <div id="searchHeaderText"><?php echo SEARCH_HEADER_TEXT?></div>
    <?php
    Save the file on your hard drive, then FTP it to:-
    includes\templates\classic\sideboxes\
    (ie: the new sideboxes folder you created in your CUSTOM template).

    ------------------------------------------------
    NEXT STEP
    ------------------------------------------------

    4. FTP a copy of your english.php file to your hard drive. (If you already have english.php in your custom template, then that is the one to edit. If not, FTP this one:-
    \includes\languages\english.php)

    5. Open it for editing and find (around line 74)the lines:-

    PHP Code:
    //text for sidebox heading links
      
    define('BOX_HEADING_LINKS''&nbsp;&nbsp;[more]');

    // categories box text in sideboxes/categories.php
      
    define('BOX_HEADING_CATEGORIES''Categories'); 
    6. Insert the following line underneath, using similar spacing:-

    PHP Code:
    //text for search header label text
      
    define('SEARCH_HEADER_TEXT''Search for:'); 
    7. Save the file.

    8. FTP it into:
    \includes\languages\classic\

    ---------------------------------------------------------------
    NEXT STEP
    ---------------------------------------------------------------

    9. Open your stylesheet.css file (again, you should edit one in your CUSTOM css folder - \includes\templates\classic\css\stylesheet.css ).

    Insert the following lines at the bottom of the stylesheet:-

    PHP Code:
    #searchHeaderText {
            
    padding-top0.5em;
            
    floatleft;

    10. Save the file, (and if you edited a copy on your hard drive, send it to your custom css folder.)

    You can adjust " padding-top: 0.5em; " to suit your needs... 0.6em, or 0.4em ...

  3. #3
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Header Search Box - How to add text?

    SORRY...

    In Number 2 above...


    2. Using FTP, navigate to:-
    includes\templates\template_default\tpl_search_header.php
    and ftp a copy to your hard drive.


    should be...

    2. Using FTP, navigate to:-
    includes\templates\template_default\sideboxes\tpl_search_header.php
    and ftp a copy to your hard drive.

  4. #4
    Join Date
    Feb 2008
    Posts
    17
    Plugin Contributions
    0

    Default Re: Header Search Box - How to add text?

    Thanks so much for the assistance, fairestcape. Just one problem: the "Search for" text is sitting above the search box, instead of next to it.

    P.S. It wasn't too much of a hack for the newbie. Also, I have to pick up my 2 year old, so I won't be able to try any new advice until bedtime. (smiley face)

  5. #5
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,267
    Plugin Contributions
    3

    Default Re: Header Search Box - How to add text?

    Quote Originally Posted by maxim View Post
    Just one problem: the "Search for" text is sitting above the search box, instead of next to it.
    This is why the addition to the stylesheet is important...

    PHP Code:
    #searchHeaderText { 
            
    padding-top0.5em
            
    floatleft

    The FLOAT: LEFT; should nudge it down to the left of the search input field.
    The PADDING-TOP will adjust it's height, relative to the input field.

    If you added this to your stylesheet, and you are STILL getting the text ABOVE the search field, then you may had added the style commands to the incorrect stylesheet.

    Put up your site URL so I can see if this is the case...
    20 years a Zencart User

  6. #6
    Join Date
    Feb 2008
    Posts
    17
    Plugin Contributions
    0

    Default Re: Header Search Box - How to add text?

    Problem solved!!! Thanks for all the help and guidance.

    I think I was encountering the formatting problem since I have Alternative Header v1.1a installed, which centers the header search box. I am still trying to figure CSS out, but I changed the following:
    Code:
    #searchHeaderText {
            padding-top: 0.5em;
            float: left;
    }
    to:

    Code:
    #searchHeaderText {    
            padding-top: 1.0em;
            display:inline;
            vertical-align:top;
    And it worked.

  7. #7
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,267
    Plugin Contributions
    3

    Default Re: Header Search Box - How to add text?

    Good stuff...

    Yes, you will often need to tweak the stylesheet according to the template you are using.

    The point is that the stylesheets now govern so much of the layout that one has to become proficient in CSS if one intends to create a specific look and feel.
    20 years a Zencart User

 

 

Similar Threads

  1. How to get text or search box above header image?
    By NOJoke in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 29 Jul 2011, 08:18 PM
  2. Text box length for search in header
    By catnaplb in forum Basic Configuration
    Replies: 0
    Last Post: 25 Sep 2009, 04:22 PM
  3. Add search box to EZpages header bar
    By sandstoner in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 18 Sep 2008, 03:02 AM
  4. Help with odd text in Header Search Box
    By mommydesigns in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 15 Jun 2007, 07:06 PM

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