Hi gang,
This file is modified from:
includes/templates/custom/sideboxes.tpl_search.php
I'm trying to avoid the customer from double clicking on the sidebox search button and having mysql get clogged with additional searching. (this has been an ongoing issue and driving me crazy)
I tried to modify the one that occurs on checkout confirmation, but I'm unable to get it to function here. Can anyone find any errors in this code. In the checkout confirmation code, the script language is located in a separate file. I added it to the top of this file instead.
Any help would be great.
thanks,
Jeff Michaels
PHP Code:
<?php
/**
* Side Box Template
*
* @package templateSystem
* @copyright Copyright 2003-2010 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.php 15881 2010-04-11 16:32:39Z wilt $
*/
?>
<script language="javascript"><!--
function submitonce()
{
var button = document.getElementById("btn_submit");
button.style.cursor="wait";
button.disabled = true;
setTimeout('button_timeout()', 4000);
return false;
}
function button_timeout() {
var button = document.getElementById("btn_submit");
button.style.cursor="pointer";
button.disabled = false;
}
//--></script>
<?php
$content = "";
$content .= '<script language="javascript" type="text/javascript"><!--' . "\n";
$content .= ' function popupHelp(url) {' . "\n";
$content .= " window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=650,screenX=150,screenY=200,top=150,left=400') \n";
$content .= ' } //--></script>' . "\n";
$content .= ' <div class="forward"><a class="legendText" href="javascript:popupHelp(\'' . zen_href_link(FILENAME_POPUP_SEARCH_HELP) . '\')">' . TEXT_SEARCH_HELP_LINK . '</a></div>' . "\n";
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
$content .= zen_draw_form('quick_find', zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', $request_type, false), 'get');
$content .= zen_draw_hidden_field('main_page',FILENAME_ADVANCED_SEARCH_RESULT);
$content .= zen_draw_hidden_field('search_in_description', '0') . zen_hide_session_id();
if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'no') {
$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 . '\';"') . '<br /><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" 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 . '\';"') . '<br /><input type="submit" value="' . HEADER_SEARCH_BUTTON . '" onsubmit="submitonce();" style="width: 50px" />';
}
$content .= '<br />';
$content .= CLICK_ONCE;
$content .= '<br /><br />';
$content .= EXACT_SEARCH;
$content .= "</form>";
$content .= '</div>';
?>
Bookmarks