Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Search box in header navigation bar


33 replies to this topic

#21 wayne miller

  • Community Member
  • 35 posts
  • Real Name:Wayne Miller

Posted 19 August 2011, 06:58

View Postkymation, on 19 August 2011, 01:21, said:

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:

#22 wayne miller

  • Community Member
  • 35 posts
  • Real Name:Wayne Miller

Posted 19 August 2011, 18:49

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);
?>&nbsp&nbsp</form>

#23 wayne miller

  • Community Member
  • 35 posts
  • Real Name:Wayne Miller

Posted 19 August 2011, 19:52

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);
?>&nbsp&nbsp</form>

<div id="headerShortcuts">

Edited by wayne miller, 19 August 2011, 19:58.


#24 wayne miller

  • Community Member
  • 35 posts
  • Real Name:Wayne Miller

Posted 19 August 2011, 20:01

View Postwayne miller, on 19 August 2011, 19:52, said:

<?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); ?>&nbsp&nbsp</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

#25 wayne miller

  • Community Member
  • 35 posts
  • Real Name:Wayne Miller

Posted 19 August 2011, 20:16

View Postwayne miller, on 19 August 2011, 20:01, said:

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>'. '&nbsp;'.'&raquo;'.'&nbsp;'.
'<a class="headerShortcutLink" href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" alt="" >' . HEADER_TITLE_CHECKOUT . '</a>' .'&nbsp;'.'&raquo;'.'&nbsp;'.
'<a class="headerShortcutLink" href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '" alt="" >' . HEADER_TITLE_MY_ACCOUNT . '</a>';

if (tep_session_is_registered('customer_id')) {
echo '&nbsp;'.'&raquo;'.'&nbsp;'.'<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);
?>&nbsp&nbsp</form>

<div id="headerShortcuts">

<div class="grid_24 ui-widget infoBoxContainer">
<div class="ui-widget-header infoBoxHeading"><?php echo '&nbsp;&nbsp;' . $breadcrumb->trail(' &raquo; '); ?></div>
</div>

Edited by wayne miller, 19 August 2011, 20:18.


#26 wayne miller

  • Community Member
  • 35 posts
  • Real Name:Wayne Miller

Posted 19 August 2011, 21:39

View Postwayne miller, on 19 August 2011, 20:16, said:

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?

Ive sorted number 2 out by spcing things using margins :-) I dont know wether this is the correct way but it works for me :-)

<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:10px;">

<?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>'. '&nbsp;'.'&raquo;'.'&nbsp;'.
'<a class="headerShortcutLink" href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" alt="" >' . HEADER_TITLE_CHECKOUT . '</a>' .'&nbsp;'.'&raquo;'.'&nbsp;'.
'<a class="headerShortcutLink" href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '" alt="" >' . HEADER_TITLE_MY_ACCOUNT . '</a>';
if (tep_session_is_registered('customer_id')) {
echo '&nbsp;'.'&raquo;'.'&nbsp;'.'<a class="headerShortcutLink" href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '" alt="" >' . HEADER_TITLE_LOGOFF . '</a>';
}
?>

<div style="margin-top:5px;">

<?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);
?>&nbsp&nbsp</form>
</div>


That just leaves me with :

1 I want to get a button that says search on it
2 My text shortcuts are black and I cant see them, how do I change them to white?

Can anybody help?

Edited by wayne miller, 19 August 2011, 21:40.


#27 mrLaBoeuf

  • Community Member
  • 2 posts
  • Real Name:James

Posted 01 September 2011, 14:54

Wish I came here 24 hours ago, thanks you for the code!

#28 sydjeii

  • Community Member
  • 91 posts
  • Real Name:cj losaria
  • Gender:Female

Posted 15 October 2011, 03:57

i tried this code

<?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);
?>&nbsp&nbsp</form>


and it worked but i have another problem..the button doesnt align with the field..any suggestion guys?
-=PINOY AKO=-

#29 multimixer

  • Community Sponsor
  • 3,592 posts
  • Real Name:George Zarkadas
  • Gender:Male
  • Location:Greece

Posted 15 October 2011, 06:10

You need to apply "vertical-align:middle;" to the button image either via css or as inline style
Looking for a way to create your own osCommerce template ? click

#30 fan4chevy

  • Community Member
  • 367 posts
  • Real Name:Charles

Posted 25 February 2012, 06:08

For installing a search field in the header and be able to easily move it in various positions, I did it as a layer. Some may not like layers but it has worked for me in all browsers for years.

<div id="Layer1" style="position:absolute; width:256px; height:32px; z-index:1; left: 734px; top: 24px;"><?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="75" style="width: ' . (125) . 'px"') . ' ' . tep_hide_session_id() .'<input type="submit" name="Submit" value="Search">' . '</form>';

?></div>

I put this in the header div.

#31 missery

  • Community Member
  • 55 posts
  • Real Name:steve

Posted 25 February 2012, 07:35

just what i was looking for ....Cheers..

#32 fan4chevy

  • Community Member
  • 367 posts
  • Real Name:Charles

Posted 25 February 2012, 09:16

hey missery I think you might like another way better! In the new cart 2.3.1 it doesn't work as well because when you resize the browser the search box does not move with the page causing it to be off!

So let me know if you are interested in having the search box fixed to move with the cart. I have the method and will probably put it in addons.

#33 fan4chevy

  • Community Member
  • 367 posts
  • Real Name:Charles

Posted 27 February 2012, 02:53

I just created a quick and easy addon for 2.3 that adds a search box field in your header area. This can also add it to the breadcrumb bar. I am sure it will work the same for 2.2 as well.

This contrib will not change any existing scripts but rather simply adds simple fields in header.php and stylesheet.css.
Search Box In Header 2.3



Hope this helps,

Charles
fan4chevy

#34 missery

  • Community Member
  • 55 posts
  • Real Name:steve

Posted 27 February 2012, 21:37

View Postfan4chevy, on 25 February 2012, 09:16, said:

hey missery I think you might like another way better! In the new cart 2.3.1 it doesn't work as well because when you resize the browser the search box does not move with the page causing it to be off!

So let me know if you are interested in having the search box fixed to move with the cart. I have the method and will probably put it in addons.

i am using 2.2 rc2a, i have installed it and all seems ok , cheers for this..