Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Parsing Search String


Recommended Posts

Something strange is happening. When I do a search I can't retrieve the first word from a description such as Gerber or Beech. I remember along time ago having an issue were I was returning too many results, and I thought I fixed that. I am now thinking that it may have caused this current problem, but I'm not sure where to start looking.


My tep_parse_search_string function and the advanced_search_results.php file are default installation and haven't been modified. WHERE ELSE COULD I POSSIBLY LOOK!


I'm not using the Manufacturers for products, and I thought that might have something to do with it? But after installing a fresh oscommerce and removing the default manufacturers from the products I still don't have the problem?



Link to comment
Share on other sites

  • 3 weeks later...


I may have found the issue hopefully I don't create any additional problems with this fix:

In the advanced_search_results.php

In the like clause there was a space between the % and the keyword in the $where_str variable that builds the SQL statement. When I remove the space I now return the first word from the product name. I am still not sure why this was giving me a problem and no one else?



Link to comment
Share on other sites

  • 2 months later...

The % is a wildcard character. When there are two of them, it is telling the code to search for any matches for what's between the two %'s. So if you have " name " in the database and the msyql has % name % in it, then that field will return. But if you have "name" in the field, the result would be empty because there are not any spaces in the database entry. When you change it to %name%, it will return a result for either case.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

So originally osCommerce has % searchterm %. So I now have %searchterm% which returns the first and last words and seems to include words in the middle. Any thoughts as to whether this could create any problems, or is this just something that was missed in the development?

Link to comment
Share on other sites


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

  • Create New...