Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Customized Search button does not appear

Customized Search button does not appear

Locked

Views: 3,948

Results 1 to 20 of 20
This thread is locked. New replies are disabled.
21 Dec 2006, 7:04 AM
#1
refriend avatar

refriend

New Zenner

Join Date:
Aug 2005
Location:
Philadelphia, PA, USA
Posts:
28
Plugin Contributions:
0

Customized Search button does not appear

For some reason I can not get a customized search button to appear in either the 'search' or 'search_header'.

My site, BrassLinePro.com, is using Zen Cart 1.3.6 with a slightly customized version of the SimpleZen Template. The search button resides at: brasslinepro.com\includes\templates\brasslinepro\buttons\english\button_search.gif

In debugging, I've removed the entire folder brasslinepro.com\includes\templates\brasslinepro\buttons\english\ and the site's buttons all revert to the default (as to be expected). With the folder in place all other SimpleZen buttons seem to appear (minus the seach button).

I verified the 'tpl_search_header.php' code and it seems to be in order.

Any ideas?
Thanks!

24 Dec 2006, 6:23 PM
#2
usernamenone avatar

usernamenone

Totally Zenned

Join Date:
Sep 2006
Posts:
541
Plugin Contributions:
0

Re: Customized Search button does not appear

In your template/sideboxes/tpl_search.php

around line 22 put this code in starting with <input type

<input type="image" name="search" src="includes/templates/your-template/buttons/english/button_search.gif"/>

Believe me when I say it took me hours to figure this one out for myself.

26 Dec 2006, 7:45 PM
#3
refriend avatar

refriend

New Zenner

Join Date:
Aug 2005
Location:
Philadelphia, PA, USA
Posts:
28
Plugin Contributions:
0

Re: Customized Search button does not appear

Well I'm glad you identified the same section of problem code.

In v1.3.6 the default code looks like

if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') {
    $content .= zen_draw_input_field('keyword', '', 'size="6" maxlength="30" style="width: 175px" 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);
  } else {
    $content .= zen_draw_input_field('keyword', '', 'size="6" maxlength="30" style="width: 175px" 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 . '\';"') . ' <input type="submit" value="' . HEADER_SEARCH_BUTTON . '" style="width: 45px" />';
  }
```I don't think this section of code was really completed. It basically says to input the graphical buttons when css buttons are enabled (via the admin panel)... but to use a standard 'submit' button when not using css.  

A bit backwards don't ya think?

When you add the graphical image into the mix...

```php
if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') {
    $content .= zen_draw_input_field('keyword', '', 'size="6" maxlength="30" style="width: 175px" 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);
  } else {
    $content .= zen_draw_input_field('keyword', '', 'size="6" maxlength="30" style="width: 175px" 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);
  }
```... the image appears (as to be expected), but its placement is a bit whacked.  I haven't figured out the right css tweaks to fix it.
27 Dec 2006, 2:26 AM
#4
usernamenone avatar

usernamenone

Totally Zenned

Join Date:
Sep 2006
Posts:
541
Plugin Contributions:
0

Re: Customized Search button does not appear

Ya, My button is centered but rides a little high. I have gone on for now and will address that later. If you come up with the solution, could you pass it along?

27 Dec 2006, 2:58 AM
#5
refriend avatar

refriend

New Zenner

Join Date:
Aug 2005
Location:
Philadelphia, PA, USA
Posts:
28
Plugin Contributions:
0

Re: Customized Search button does not appear

I've moved on for the time being as well. The issue is way too cosmetic to kill hours with for now.

I'm going to spend some time trying to merge a few posted modules: RMAs (I'll have to create this part), shipment tracking, and product management. I figure this is a bit more important and will keep me quite occupied.

I will certainly post a solution when [if] I find it.

27 Dec 2006, 3:58 AM
#6
usernamenone avatar

usernamenone

Totally Zenned

Join Date:
Sep 2006
Posts:
541
Plugin Contributions:
0

Re: Customized Search button does not appear

Thanks, I spent 4 hours getting the image button to get placed and then get the right link up and once I saw it on the page, well I moved on.............. There is always time later.

27 Dec 2006, 5:23 PM
#7
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: Customized Search button does not appear

refriend:

I've moved on for the time being as well. The issue is way too cosmetic to kill hours with for now.

I'm going to spend some time trying to merge a few posted modules: RMAs (I'll have to create this part), shipment tracking, and product management. I figure this is a bit more important and will keep me quite occupied.

I will certainly post a solution when [if] I find it.

A return authorization contribution should be available in the downloads section by the end of the week.

28 Dec 2006, 1:41 AM
#8
lextechs avatar

lextechs

Zen Follower

Join Date:
Mar 2005
Location:
Tempe, AZ
Posts:
316
Plugin Contributions:
0

Re: Customized Search button does not appear

FYi here is the correct code, In IE and firefox my button seems pretty centered... with this code.

<?php
/**
 * Side Box Template
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license [url]http://www.zen-cart.com/license/2_0.txt[/url] GNU Public License V2.0
 * @version $Id: tpl_search.php 4142 2006-08-15 04:32:54Z drbyte $
 */
  $content = "";
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
  $content .= zen_draw_form('quick_find', 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="18" maxlength="100" style="width: ' . ($column_width-30) . 'px"') . '<br />' . zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
    $content .= '<br /><a href="' . zen_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a>';
  } else {
    $content .= zen_draw_input_field('keyword', '', 'size="18" maxlength="100" style="width: ' . ($column_width-30) . 'px"') .'<br />' . zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
    $content .= '<br /><a href="' . zen_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a>';
  }

  $content .= "</form>";
  $content .= '</div>';
?>
28 Dec 2006, 3:49 AM
#9
refriend avatar

refriend

New Zenner

Join Date:
Aug 2005
Location:
Philadelphia, PA, USA
Posts:
28
Plugin Contributions:
0

Re: Customized Search button does not appear

Hey thanks for code, but no luck...

I think vBulletin added a space to your code on upload.You've got an extra space in 'FILENAME_ADVANCE D_SEARCH_RESULT' (mentioned for anyone trying this at home).

All said and done... this still doesn't align the search field with the image. The BR's just feed a line; and with them removed I'm back to my original results.

The following code seems to do the trick. (Note: This applies to v.1.3.6.) The solution lies in 'html_output.php' with the 'zen_image_submit' command.

We need to add alignment to the submit button:

  1. Add to your stylesheet.
.zen_image_submit_align{
    vertical-align:middle;
}
```2. Replace in html_output.php (we're really only adding class="zen_image_submit_align"):
```php
  function zen_image_submit($image, $alt = '', $parameters = '', $sec_class = '') {
    global $template, $current_page_base, $zco_notifier;
    if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes' && strlen($alt)<30) return zenCssButton($image, $alt, 'submit', $sec_class /*, $parameters = ''*/ );
    $zco_notifier->notify('PAGE_OUTPUT_IMAGE_SUBMIT');

    $image_submit = '<input type="image" src="' . zen_output_string($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . $image) . '" alt="' . zen_output_string($alt) . '"';

    if (zen_not_null($alt)) $image_submit .= ' title=" ' . zen_output_string($alt) . ' "';

    if (zen_not_null($parameters)) $image_submit .= ' ' . $parameters;

    $image_submit .= ' />';

    return $image_submit;
  }
```with
```php
function zen_image_submit($image, $alt = '', $parameters = '', $sec_class = '') {
    global $template, $current_page_base, $zco_notifier;
    if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes' && strlen($alt)<30) return zenCssButton($image, $alt, 'submit', $sec_class /*, $parameters = ''*/ );
    $zco_notifier->notify('PAGE_OUTPUT_IMAGE_SUBMIT');

    $image_submit = '<input type="image" src="' . zen_output_string($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . $image) . '" alt="' . zen_output_string($alt) . '"';

    if (zen_not_null($alt)) $image_submit .= ' title=" ' . zen_output_string($alt) . ' "';

    if (zen_not_null($parameters)) $image_submit .= ' ' . $parameters;

    $image_submit .= ' class="zen_image_submit_align"/>';

    return $image_submit;
  }
```It doesn't appear to have any adverse effects on other forms. Let me know what you think!
28 Dec 2006, 4:50 AM
#10
refriend avatar

refriend

New Zenner

Join Date:
Aug 2005
Location:
Philadelphia, PA, USA
Posts:
28
Plugin Contributions:
0

Re: Customized Search button does not appear

<removed by request>

28 Dec 2006, 12:56 PM
#11
refriend avatar

refriend

New Zenner

Join Date:
Aug 2005
Location:
Philadelphia, PA, USA
Posts:
28
Plugin Contributions:
0

Re: Customized Search button does not appear

<removed by request>

28 Dec 2006, 2:01 PM
#12
refriend avatar

refriend

New Zenner

Join Date:
Aug 2005
Location:
Philadelphia, PA, USA
Posts:
28
Plugin Contributions:
0

Re: Customized Search button does not appear

Last message... the last two posts were unnecessary but I can't seem to edit or remove them.

'tpl_search_header' should not be edited at all. I apologize for the confusion.

Programming with a fever can get pretty wacky:blink:.

24 Jul 2007, 10:55 PM
#13
dvasdekis avatar

dvasdekis

New Zenner

Join Date:
Nov 2006
Posts:
70
Plugin Contributions:
0

Re: Customized Search button does not appear

Sorry for dredging up a post this old, but using refriend's code at the top of this page, what should the button be called and where should it be put if it's being used as a search header button?

25 Jul 2007, 12:32 AM
#14
refriend avatar

refriend

New Zenner

Join Date:
Aug 2005
Location:
Philadelphia, PA, USA
Posts:
28
Plugin Contributions:
0

Re: Customized Search button does not appear

Hi,
The direct answer to your question is that by default the path to the image is (starting from the zen-cart root):
/includes/templates/template_default/buttons/english/button_search.gif

  • or, if you are using the carts 'over-ride system' -
    /includes/templates/YOU TEMPLATE NAME/buttons/english/button_search.gif

You may also change the name of the desired image (say if you would like to reuse another image) by changing the definition for BUTTON_IMAGE_SEARCH in:
/includes/languages/english/button_names.php

  • or, if you are using the carts template 'over-ride system' -
    /includes/languages/english/YOU TEMPLATE NAME/button_names.php

I would explain the 'override system' but it is a full length discussion covered elsewhere in this forum... but definitely worth your time to explore as it becomes VERY useful during cart upgrades!

I will add that I am not a fan of my earlier posted solution as I hacked a core function... it was just the best I could come up with.

25 Jul 2007, 1:17 AM
#15
usernamenone avatar

usernamenone

Totally Zenned

Join Date:
Sep 2006
Posts:
541
Plugin Contributions:
0

Re: Customized Search button does not appear

I don't think it is considered hacking into core function.

There is a flaw in the code. If you look up at the css buttons code you will see the code that should be for the submit image button. Just copy that part of the code down to into the last statement and the image appears.

BTW the image is in your template/buttons/english/button_search.gif just waiting for the code to be corrected.

31 Jul 2007, 6:52 AM
#16
dvasdekis avatar

dvasdekis

New Zenner

Join Date:
Nov 2006
Posts:
70
Plugin Contributions:
0

Re: Customized Search button does not appear

usernamenone:

I don't think it is considered hacking into core function.

There is a flaw in the code. If you look up at the css buttons code you will see the code that should be for the submit image button. Just copy that part of the code down to into the last statement and the image appears.

BTW the image is in your template/buttons/english/button_search.gif just waiting for the code to be corrected.
I'm sorry, but could you clarify this? Does this relate directly to me or to the code in general?

I'm just wondering, as I've stuck the button image in every possible spot on my server, and still it does not show.

Thanks again.

31 Jul 2007, 9:03 AM
#17
usernamenone avatar

usernamenone

Totally Zenned

Join Date:
Sep 2006
Posts:
541
Plugin Contributions:
0

Re: Customized Search button does not appear

Does not relate to you, It relates to the zen code. You have incorrectly coded your button location. You have
<input type="image" src="includes/templates/template_default/buttons/english/BUTTON_IMAGE_SEARCH_HEADER" alt="Search" title=" Search " />

The correct code for a search button is starting with
$content .= zen_draw_input_field

 $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 . '\';"').zen_image_submit(BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON,'class="input"   ');}
 
```Then you may have to tweek the possition.

The button name is button_search.gif, the button is already in your button folder. I have custom buttons in my template folder. If your buttons are in your template folder that is the first place zen cart looks and if it can not be found there it will look in the template_default buttons english folder



> **dvasdekis:**
>
> I'm sorry, but could you clarify this? Does this relate directly to me or to the code in general?
> 
> I'm just wondering, as I've stuck the button image in every possible spot on my server, and still it does not show.
> 
> Thanks again.
7 Aug 2007, 4:18 AM
#18
refriend avatar

refriend

New Zenner

Join Date:
Aug 2005
Location:
Philadelphia, PA, USA
Posts:
28
Plugin Contributions:
0

Re: Customized Search button does not appear

For what it is worth. I think I found the true culprit. I submitted my finding and suggested correction to http://www.zen-cart.com/forum/showthread.php?p=414755

Hopefully this will address you issues. From what I can see this fix alone has completely solved the problem for me (so I believe you can disregard my earlier suggested fix).

... and please don't flog me if I am beating a dead horse.. :bangin:

Good luck!

7 Aug 2007, 7:24 AM
#19
usernamenone avatar

usernamenone

Totally Zenned

Join Date:
Sep 2006
Posts:
541
Plugin Contributions:
0

Re: Customized Search button does not appear

That is correct, Please don't forget to change the code in both side box tpl_search.php and tpl_search_header.php as they have both been coded incorrectly in both files.

:blink:

refriend:

For what it is worth. I think I found the true culprit. I submitted my finding and suggested correction to http://www.zen-cart.com/forum/showthread.php?p=414755

Hopefully this will address you issues. From what I can see this fix alone has completely solved the problem for me (so I believe you can disregard my earlier suggested fix).

... and please don't flog me if I am beating a dead horse.. :bangin:

Good luck!

5 Aug 2008, 5:46 PM
#20
aaronl avatar

aaronl

New Zenner

Join Date:
Aug 2008
Posts:
7
Plugin Contributions:
0

Re: Customized Search button does not appear

usernamenone:

In your template/sideboxes/tpl_search.php

around line 22 put this code in starting with <input type

<input type="image" name="search" src="includes/templates/your-template/buttons/english/button_search.gif"/>

Believe me when I say it took me hours to figure this one out for myself.

Just bumping this thread as I am all kinds of confused.

The above method seems the easiest but it also seems that there are many other solutions mentioned in this thread. I'm 100% confused on how to simply add a different search button.

This shouldn't be so hard, should it? If anyone could possible sum-up what actually works I'd be much obliged. I've already spent way too much time trying to make this work. Thanks, all!