Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

I'm having a problem with the search


Recommended Posts

I'm building a new site based on MS2.2 instead of my old, and rather simple store.

In the new one, when I search for keywords grouped together with "", I get no results, when I know there are matching products.


Though the site is mostly in Hebrwe, I left some products in English so you can see for yourselves:

go to www.madab-il.com

on the top you will fing the search box. Enter trek. You got 10 results? swell!

Now try searching for "trek". What do you get? Nada! I suppose this might be a problem with the search function, but then again, I may be totally off.


If you can give me a direction, I could post the code of a file and try to find the problem (I haven't changed any of the search files)...




Link to comment
Share on other sites

To add to the oddness of things, in case none of you havenoticed this, the same problem occures with the search option in this forum!

(not to mention the contribution search, which makes no sense to me).


help, anyone?

Link to comment
Share on other sites

I'm not the only one with this problem. Im surprised no-one noticed this before, or seems to care...

Take a look at This OSc store for example. Or this one, or this one for that matter!


These are all sites that you guys posted for reviewing in the "My Store" forum, and all have the same exact problem. This leads me to beleive that the problem isn't with my site, but with osC's search algorithm. Enter parenthasese, and get 0 results. Bummer, especially when they're meant to simplify the search. Imagine how many customers your losing because they can't find "mac OS" or "star trek" or "old yellow" on your site, simply because the search doesn't work the way it's meant to.


The only site with a functional search that I've found is this one, which seams to have made extensive changes to the osC code, including the search. (lok for "dress", and items that don't have it anywhere in their name OR description show up.

Still, the stock search doesn't work, and we ALL need to get this fixed!

Link to comment
Share on other sites

agree, " " does not work.

in the help file with samples howto search i have commented out that possibility.

and however, works o.k. :)

"If you're working on something new, then you are necessarily an amateur."

Link to comment
Share on other sites

If you meant that I can search for ACTION AND FIGURE, this is true. However, this will also retreive like ACTION DEFORMED FIGURE. There must be a functional way of searching for exact phrases. It's one of the basic things any search should be able to do!

Link to comment
Share on other sites

i don't understand the problem


on your site there is a dress described with the words- Comes in Blue and Gold-

if on yr site i search for -comes- that dress is found

Comes in Blue and Gold without "" is found

Comes in blue without "" is also found

Comes Blue Gold without "" is also found

the reason you are insisting on using "" is something that escapes me. ;)

"If you're working on something new, then you are necessarily an amateur."

Link to comment
Share on other sites

The purpose of the "" is to group words together, and search for the exact phrase (or at least that's what popup_search_help.php says it's meant to do). Like I had said - if I want to find "fat momma", but not anything relating to fat ugly momma, I'd group the words together.

Or if I want a "tea spoon", I don't want to find anything having to do with "spon and tea cup set". or "hair spray" is not the same as "hair string spray". Do you follow?...


And you may have misunderstood my previous post. My site is here.

Link to comment
Share on other sites

not to mention the contribution search, which makes no sense to me

that one indeed seems to have a bug if you look for "basic" you lots of contribs, if you look for "template" you''ll find lots of things too. But if you look for "basic template" (without the quotes) you''ll find nothing, while I am 100% sure there is something it should find :) .

If you do the same including the quotes it's like the whole site is going down or something :huh: Or was that coincidence?


Doing the same search but selecting Support Forums in the same osC top search box (the search box that also shows a.o. at the osCommerce index page) like this:



the output I get is:

Warning: preg_match() expects parameter 2 to be string, array given in /usr/www/users/hpdl/forums/sources/Search.php on line 1668

Link to comment
Share on other sites

oops the url does not work


it should be:



or even better fill in two words in the search input field (and select Support Forums) and click go

Link to comment
Share on other sites

  • 1 year later...

Has anyone fixed this problem? Overall the search does work pretty well, but people are used to grouping words with quotes when searching so this is a problem. I am tempted to just filter out quotes completely so they don't break any searches. Better to get too many results than none at all.

Link to comment
Share on other sites

  • 3 weeks later...

my client's search doesn't work at all. Here's his site:



He's using the old cvs version but I have an install of a new ms2 version and the search still don't work. I'm thinking the products are not registering in the database to be searchable or something. Any ideas?

Link to comment
Share on other sites

  • 1 month later...

same problem, something is wrong when searching for an "exact phrase"


I'm trying to figure it out and from what I understand theres a problem with the tep_parse_search_string function in functions/general.php


The function SHOULD take a string like "computer program" and bring it back into a single array, e.g. $search_keywords[0] = computer program


INSTEAD, the function is breaking up the term, adding an "and" inbetween the two terms, and not stripping the slashes so it becomes:


$search_keywords[0] = \"computer

$search_keywords[1] = and

$search_keywords[2] = program\"


However, the function itself does provide the correct logic, but I think its not working because the fucntion is not recognizing the "" (quotation maks), therefore some of the IF statements like:


if (substr($pieces[$k], -1 ) == '"') {


does not get executed, b/c it doesn't recognize the "".


The solution maybe to try and urldecode the $HTTP_GET_VARS['keyword'] variable and then put it into the function.


Hopefully this helps somebody find a solution.

Link to comment
Share on other sites



The tep_parse_search_string function was not working properly because \'s (slashes) were being sent into the function infront of the "" (quotation marks), so the word "computer" would be sent into the function as \"computer\"


This would messup all of the IF statments that looked to see if a " (quotation mark) was the FIRST character, which it wasn't




Find the code on advanced_search_results.php:


if (isset($HTTP_GET_VARS['keywords'])) {

$keywords = $HTTP_GET_VARS['keywords'];



and CHANGE IT too:


if (isset($HTTP_GET_VARS['keywords'])) {

$keywords = stripslashes($HTTP_GET_VARS['keywords']);



Now the function will read the "" (quotation marks) as the first character and perform the necessary IF statements.

Link to comment
Share on other sites


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

  • Create New...