Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with searchbox. If searchfield is blank


Zuncan

Recommended Posts

Hi!

 

Im have altered the searchbox a bit. Making it also search in descriptions. This helps me getting rid of the advanced search that I think is unnesseccery. Everything works fine, but if searchfield is left blank and the custumer press "search" it takes the customer to advanced_search.php. Is there a way to stop that from happening. Maybe redirect them to index.php instead.

 

Here is the code for the searchbox: Please help me..

 

<?php
 $info_box_contents = array();
 $info_box_contents[] = array('form' => tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'),
                              'align' => 'center',
                              'text' => tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords','','size="10" maxlength="30" style="width: ' . (BOX_WIDTH-69) . 'px"') . ' ' . tep_hide_session_id() . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH, 'ALIGN="ABSMIDDLE"') . ''
);

 new CategoriesBox($info_box_contents);
?>

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

I think you need to change the advanced_search_results.php ...

 

backup first, then find this in line 108:

 if (tep_not_null($keywords)) {
     if (!tep_parse_search_string($keywords, $search_keywords)) {
       $error = true;

       $messageStack->add_session('search', ERROR_INVALID_KEYWORDS);
     }
   }

 

I'd add an else there right at the end, doing a tep_redirect to index.php

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...