Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

search mod


davidstummer

Recommended Posts

i have a gap in each product name ie D4 AVE, so when someone types in D4AVE, D4 AVE doesn't show even though i have it. I know how to make D4 AVE show, but need someone to tell me how to do it...

 

if you type D4 and AVE into search box, D4 AVE comes up, therefore, i need ' and ' to automatically be added before the last three letters that someone types in.

 

eg, if someone types in G4DFR, when they click on the seacrh button, the ' and ' will be inserted automatically before the last three letters before the search to make G4 and DFR.

 

how do i do this?

 

thanks

Link to comment
Share on other sites

what if you were to take the keyword and just search for the first two characters - would that be enough ?

 

You could do this by modifying the keywords entered in advanced_search_result.phplook for the line ....

 

 

if ($HTTP_GET_VARS['keywords']) {

   if (tep_parse_search_string( StripSlashes($HTTP_GET_VARS['keywords']), $search_keywords)) {

     $where_str .= " and (";

     for ($i=0; $i<sizeof($search_keywords); $i++ ) {

 

and right after this, just before the switch statement, add the following ...

 

$search_keywords[$i]=substr($search_keywords[$i],0,2);

 

This will take each keyword, take the first two characters and serach with them only....

 

HTH

BrianD

Link to comment
Share on other sites

thanks for the reply, but if for example someone types in D5 ADX, so your idea searches for the two characters D and 5, i only want the results for D5 with ADX at the end, otherwise i would get all results from

 

D5 AAA to D5 AYY (roughly about 1200 combos)

 

david

Link to comment
Share on other sites

I see where your comming from - the above example would only search for D5.

 

I'm not 100% sure, but I think a regular expression is whats required here.

 

Not my strong point I'm afraid - try www.php.net and search for the ereg() function - this could be a good start.

 

HTH

BrianD

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...