Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Searchform on every page


mitchlin71

Recommended Posts

Good evening,

 

I have a lot products in my OsCshop and it is hard for costumers to find them. I was thinking of an quick search body on top of the productlistings and other pages.

Does anyone know how I could do this?

 

Thanks in advance.

Richard

Link to comment
Share on other sites

Good evening,

 

I have a lot products in my OsCshop and it is hard for costumers to find them. I was thinking of an quick search body on top of the productlistings and other pages.

Does anyone know how I could do this?

 

Thanks in advance.

Richard

 

I don't know what OsCshop is, I am guessing it is not a stock OSC store, because the stock one comes with search in the side bar. I am not real hip on all versions.

 

You can call the search box from just about any where. I placed it in the header myself. Course getting everything lined up right is something i am still working on. Plus you might need to modify the /includes/boxes/search.php if you don't want all the box stuff, course that change is site wide. I made mine just show the input box and search button.

 

I just use this to call up the search box.

 

<? require(DIR_WS_BOXES . 'search.php'); ?>

 

I'm searching on how to get the layout right, as the style sheet doesn't seem to be helping me with the search box position and related.

Link to comment
Share on other sites

A better way to add the search form to your header.php in a stock osc is this.

 

If you wanted it right below the breadcrumb trail for example then find this part in header.php

	<td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  |  <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   </td>
 </tr>

Right after that add

  <tr>
<td colspan="2" align="left"><?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description' , '1') . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH) . '</form>';?></td>
 </tr>

Link to comment
Share on other sites

A better way to add the search form to your header.php in a stock osc is this.

 

If you wanted it right below the breadcrumb trail for example then find this part in header.php

	<td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  |  <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   </td>
 </tr>

Right after that add

  <tr>
<td colspan="2" align="left"><?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description' , '1') . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH) . '</form>';?></td>
 </tr>

 

The only drawback to that code is you don't have the CSS for more control over the search box, position, ect. Least I don't know how.

 

I found this after I posted http://www.oscommerce.com/forums/index.php?sho...p;#entry1276092 and it worked perfectly for me. I was able to add CSS to the search and put it exactly where I wanted.

Link to comment
Share on other sites

Just an FYI. This is taken right from osc.

 

The product search form can be added to any page on the site using only HTML code, or to any page on the catalog using HTML and PHP code.

 

 

The preferred method is to use HTML and PHP code otherwise the customers session may be lost when cookies are disabled and the session ID does not exist in the URL.

 

You see it here

 

http://www.oscommerce.info/kb/osCommerce/G...s_and_Tricks/55

 

Note: If using the php way from that page make sure to make 2 changes

 

1 osc_draw_input_field

Should be

tep_draw_input_field

 

2 osc_draw_hidden_field

Should be

tep_draw_hidden_field

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...