Guest Posted March 25, 2006 Posted March 25, 2006 This will add a search box to the header navigation bar at the top of the page. If you like it you can disable the standard oscommerce search box by opening includes/column_left.php and adding 2 forward slashes before: require(DIR_WS_BOXES . 'search.php'); Thus: //require(DIR_WS_BOXES . 'search.php'); This works well on my site, may be different on yours, I have a header bar 22px high, this can be set in catalog/stylesheet.css under this setting: TD.headerNavigation So Backup and open catalog/includes/header.php Find: <table border="0" width="100%" cellspacing="0" cellpadding="1"> <tr class="headerNavigation"> <td class="headerNavigation"> <?php echo $breadcrumb->trail(' ? '); ?></td> Change the cellpadding to "0" Add the following after the above code: <script type="text/javascript" language="JavaScript1.2"> <!-- function clearThis(it){ it.value = ""; } //--> </script> <td class="headerNavigation" align="right" valign="top"><form name="quick_find" method="get" action="/catalog/advanced_search_result.php"> <input type="text" name="keywords" size="15" maxlength="50" style="width: 110px" value="Search..." onFocus="clearThis(this);" style="width: 90px"> <input type="image" src="includes/languages/english/images/buttons/button_quick_find.gif" alt="Quick Find" title="Quick Find"> <input type="checkbox" name="search_in_description" alt="Search in descriptions" title="Search in descriptions" value="1">Keywords </form> So BACKUP FIRST and see if it pleases you or not. It includes a "search in description" checkbox. Have fun!
Guest Posted March 27, 2006 Posted March 27, 2006 there is already a contribution about it. http://www.oscommerce.com/community/contributions,3295 also your code will not work with sessions as you do not use the osc functions to preserve it. and jscript functions should be included wihin the html head section
Guest Posted March 29, 2006 Posted March 29, 2006 there is already a contribution about it.http://www.oscommerce.com/community/contributions,3295 also your code will not work with sessions as you do not use the osc functions to preserve it. and jscript functions should be included wihin the html head section There may be a contribution, but it's probably more work than my suggestion. The jscript works fine where it is, I don't use sessions so that never occurred to me, anyone is welcome to modify the code, I offered it as a plugnplay solution. But I appreciate your concerns.
Stargater07 Posted April 13, 2006 Posted April 13, 2006 Looks good on my site http://www.devonlightingcentre.net/catalog/index.php Thanks for the code. Jason Jason :)
ChrisTheGrant Posted May 23, 2006 Posted May 23, 2006 Hi, I have just installed it on my site, and it looks fine, but when i click on the search icon it doesn't work and returns an HTTP 404 error (Page not found). If anyone can help me to resolve this i would appreciate it. My site is: car-puters.com Thanks, Chris
insomniac2 Posted May 23, 2006 Posted May 23, 2006 Example: <tr> <td class="smallText" valign="bottom" colspan="0"> <?php echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '">' . TEXT_ENTER_KEYWORDS . '</a>'; php echo TEXT_CHOOSE_CATEGORY; ?> <?php echo tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_hide_session_id(); ?> <table background="images/backgrounds/toolbar_haze.gif" align="center" width="98%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="middle"> </td> <td valign="middle"><?php echo tep_draw_hidden_field('search_in_description', '1') . tep_draw_hidden_field('inc_subcat', '1', true) . tep_draw_input_field('keywords', ' > Enter Keywords < ', 'onfocus="this.value=\'\'" size="10" maxlength="30" style="width: ' . (BOX_WIDTH+50) . 'px"'); ?> <?php echo tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => BOX_ADVSEARCH_ALLCAT)))) . tep_hide_session_id(); ?></td> </tr>
triaxis Posted May 24, 2006 Posted May 24, 2006 Hi,I have just installed it on my site, and it looks fine, but when i click on the search icon it doesn't work and returns an HTTP 404 error (Page not found). If anyone can help me to resolve this i would appreciate it. My site is: car-puters.com Thanks, Chris Reason it wont work is because he has it set to work if your root oscommerce install folder is called "catalog" you have to change it to your root folder name. the code line is <form name="quick_find" method="get" action="/catalog/advanced_search_result.php"> change "/catalog/ to your oscommerce folder.
Guest Posted June 23, 2006 Posted June 23, 2006 I add this search box to my header, but beside it I want to add the drop down list with the Manufacturers. But for some reason I can't get it work? anyone give me a hint...
bharti Posted January 22, 2011 Posted January 22, 2011 Hi, I am trying to do the same (move the search box to header navigation bar) in oscommerce 2.3.1 but it is not working... could any please advise how to do this in 2.3 version? Thanks Bharti I add this search box to my header, but beside it I want to add the drop down list with the Manufacturers. But for some reason I can't get it work? anyone give me a hint...
pdcelec Posted January 22, 2011 Posted January 22, 2011 Hi, I am trying to do the same (move the search box to header navigation bar) in oscommerce 2.3.1 but it is not working... could any please advise how to do this in 2.3 version? Thanks Bharti similar to this ? www.electricalcity.co.uk
bharti Posted January 23, 2011 Posted January 23, 2011 similar to zcom.co.nz similar to this ? www.electricalcity.co.uk
bharti Posted January 27, 2011 Posted January 27, 2011 could i please get some help on this... this is forum and no reply :(
WallaceNetworks.co.uk Posted February 13, 2011 Posted February 13, 2011 I have a similar problem with search in the header.php Well, i says similar... Basicly, I have altered my header.php so instead of having this code at the start: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2010 osCommerce Released under the GNU General Public License */ if ($messageStack->size('header') > 0) { echo '<div class="grid_24">' . $messageStack->output('header') . '</div>'; } ?> <div id="header" class="grid_24"> <div id="storeLogo"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'company_logo.gif', STORE_NAME) . '</a>'; ?></div> <div id="headerShortcuts"> <?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); echo '<strong>Search Site:</strong> ' . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: 100px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description', '1') . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH); } ?> <?php echo tep_draw_button(HEADER_TITLE_CART_CONTENTS . ($cart->count_contents() > 0 ? ' (' . $cart->count_contents() . ')' : ''), 'cart', tep_href_link(FILENAME_SHOPPING_CART)) . tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) . tep_draw_button(HEADER_TITLE_MY_ACCOUNT, 'person', tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); if (tep_session_is_registered('customer_id')) { echo tep_draw_button(HEADER_TITLE_LOGOFF, null, tep_href_link(FILENAME_LOGOFF, '', 'SSL')); } ?> </div> I now have the following: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2010 osCommerce Released under the GNU General Public License */ if ($messageStack->size('header') > 0) { echo '<div class="grid_24">' . $messageStack->output('header') . '</div>'; } ?> <div id="header" class="grid_24"> <div id="storeLogo"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'company_logo.gif', STORE_NAME) . '</a>'; ?></div> <div id="headerShortcuts"> <?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); echo '<strong>Search Site:</strong> ' . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: 100px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description', '1') . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH); ?> <?php echo tep_draw_button(HEADER_TITLE_CART_CONTENTS . ($cart->count_contents() > 0 ? ' (' . $cart->count_contents() . ')' : ''), 'cart', tep_href_link(FILENAME_SHOPPING_CART)) . tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) . tep_draw_button(HEADER_TITLE_MY_ACCOUNT, 'person', tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); if (tep_session_is_registered('customer_id')) { echo tep_draw_button(HEADER_TITLE_LOGOFF, null, tep_href_link(FILENAME_LOGOFF, '', 'SSL')); } ?> </div> And the search box itself works fine, BUT (and this is a bit of a problem) If i got to view a product in the catalog, i can add it from the catalog category view page, but when i select the individual product view page, the "Add to Cart" button tries to do Advanced search instead. Anyone got any ideas? Thanks in advance.
germ Posted February 13, 2011 Posted February 13, 2011 Your <form...> </form> tags are screwed. You have to close one form before opening another. When the results from one form are passed to another this is always the case. Look at the HTML source and search for the <form...> </form> tags. If you have two <form...> tags in succession without an intervening </form> tag - there's the problem. I think there is some mechanism in osC that's supposed to supply the closing form tag, but sometimes you have to "brute force" them in. :blush: If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
WallaceNetworks.co.uk Posted February 16, 2011 Posted February 16, 2011 Your <form...> </form> tags are screwed. You have to close one form before opening another. When the results from one form are passed to another this is always the case. Look at the HTML source and search for the <form...> </form> tags. If you have two <form...> tags in succession without an intervening </form> tag - there's the problem. I think there is some mechanism in osC that's supposed to supply the closing form tag, but sometimes you have to "brute force" them in. :blush: Thank you so much for your help, you were absolutely spot-on with your advice. Many thanks!
wayne miller Posted August 18, 2011 Posted August 18, 2011 Your <form...> </form> tags are screwed. You have to close one form before opening another. When the results from one form are passed to another this is always the case. Look at the HTML source and search for the <form...> </form> tags. If you have two <form...> tags in succession without an intervening </form> tag - there's the problem. I think there is some mechanism in osC that's supposed to supply the closing form tag, but sometimes you have to "brute force" them in. :blush: Hi there, Im completely new to all of this and loving it already !!!!! Ive just updated my header.php with the code below that Allan supplied to get a search box in my header: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2010 osCommerce Released under the GNU General Public License */ if ($messageStack->size('header') > 0) { echo '<div class="grid_24">' . $messageStack->output('header') . '</div>'; } ?> <div id="header" class="grid_24"> <div id="storeLogo"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'company_logo.gif', STORE_NAME) . '</a>'; ?></div> <div id="headerShortcuts"> <?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); echo '<strong>Search Site:</strong> ' . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: 100px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description', '1') . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH); ?> <?php echo tep_draw_button(HEADER_TITLE_CART_CONTENTS . ($cart->count_contents() > 0 ? ' (' . $cart->count_contents() . ')' : ''), 'cart', tep_href_link(FILENAME_SHOPPING_CART)) . tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) . tep_draw_button(HEADER_TITLE_MY_ACCOUNT, 'person', tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); if (tep_session_is_registered('customer_id')) { echo tep_draw_button(HEADER_TITLE_LOGOFF, null, tep_href_link(FILENAME_LOGOFF, '', 'SSL')); } ?> </div> I am now obviously getting the same problem as Allen did. I can see by your response that the form tags are screwed but what exactly does that mean? rembember Im completely new to this, I do pick things up pretty quickly though so please be gentle for a little while :thumbsup: Do I need to alter the code above or make another change elsewhere? Thanks in advance Wayne
♥kymation Posted August 19, 2011 Posted August 19, 2011 Most HTML tags have to match. That is, for every <form> there must be a closing </form>. In the code you posted, tep_draw_form() draws the opening <form> tag. You don't have any closing </form> tag, so you need to add that at the end of the part you posted in bold above. You can see the tags by viewing the page in your browser and selecting "View Page Source." The Firebug addon in Firefox is also very good at showing things like this, and lets you try fixes without changing the source code. Regards Jim See my profile for a list of my addons and ways to get support.
wayne miller Posted August 19, 2011 Posted August 19, 2011 <?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); echo '<strong>Search Site:</strong> ' . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: 100px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description', '1') . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH); ?> </form> Simples, Thanks a million Jim I love this stuff! gotta go to bed, work in the morning and its now 01:30am tee hee, thanks again for the advice
wayne miller Posted August 19, 2011 Posted August 19, 2011 You can see the tags by viewing the page in your browser and selecting "View Page Source." The Firebug addon in Firefox is also very good at showing things like this, and lets you try fixes without changing the source code. Regards Jim No way! thats sounds too easy. So if I download the Firebug addon I can look at the code on any website?
♥kymation Posted August 19, 2011 Posted August 19, 2011 Yes, Firebug will let you look at and change the code on any website. Only in your own browser, of course, but it's handy to check out bits of code to see what they do. Regards Jim See my profile for a list of my addons and ways to get support.
wayne miller Posted August 19, 2011 Posted August 19, 2011 Yes, Firebug will let you look at and change the code on any website. Only in your own browser, of course, but it's handy to check out bits of code to see what they do. Regards Jim Ive downloaded it, thx Jim :thumbsup:
wayne miller Posted August 19, 2011 Posted August 19, 2011 Ive added the search bar but its below my logo, I want it on the right of my logo. How can I move it around? <div id="header" class="grid_24"> <div id="storeLogo"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'store_logo.png', STORE_NAME) . '</a>'; ?></div> <div id="headerShortcuts"> <?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); echo tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: 200px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description', '1') . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH); ?> </form>
wayne miller Posted August 19, 2011 Posted August 19, 2011 No worries peeps, managed to sort this one out myself :thumbsup: <div id="header" class="grid_24"> <div id="storeLogo"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'store_logo.png', STORE_NAME) . '</a>'; ?></div> <div style="margin-top:28px;"> <?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); echo tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: 200px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description', '1') . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH); ?> </form> <div id="headerShortcuts">
wayne miller Posted August 19, 2011 Posted August 19, 2011 <?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); echo tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: 200px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description', '1') . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH); ?> </form> <div id="headerShortcuts"> I have another question for you, the search function button has a magnifying class on it. I would like to change this to a button with search written on it. I guess its gonna be easy but as Im a newby could anyone point me in the right direction? Thanks in advance Wayne
wayne miller Posted August 19, 2011 Posted August 19, 2011 I have another question for you, the search function button has a magnifying class on it. I would like to change this to a button with search written on it. I guess its gonna be easy but as Im a newby could anyone point me in the right direction? Thanks in advance Wayne Hmm seems I was a bit premature. My problems are now 1 I want to get a button that says search on it 2 My search box is now next to my text shortcuts 3 My text shortcuts are black and I cant see them, how do I change them to white? Please see code it may make sense :-) I need to get my search box underneath the text links <div id="header" class="grid_24"> <div id="storeLogo"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'store_logo.png', STORE_NAME) . '</a>'; ?></div> <?php echo '<a class="headerShortcutLink" href="' . tep_href_link(FILENAME_SHOPPING_CART) . '" alt="" >' .($cart->count_contents() > 0 ? ' (' . $cart->count_contents() . ')' : '') . HEADER_TITLE_CART_CONTENTS . '</a>'. ' '.'»'.' '. '<a class="headerShortcutLink" href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" alt="" >' . HEADER_TITLE_CHECKOUT . '</a>' .' '.'»'.' '. '<a class="headerShortcutLink" href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '" alt="" >' . HEADER_TITLE_MY_ACCOUNT . '</a>'; if (tep_session_is_registered('customer_id')) { echo ' '.'»'.' '.'<a class="headerShortcutLink" href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '" alt="" >' . HEADER_TITLE_LOGOFF . '</a>'; } ?> <?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); echo tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: 200px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description', '1') . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH); ?> </form> <div id="headerShortcuts"> <div class="grid_24 ui-widget infoBoxContainer"> <div class="ui-widget-header infoBoxHeading"><?php echo ' ' . $breadcrumb->trail(' » '); ?></div> </div>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.