Zen Cart Logo
Forums / General Questions / Internal Search and Advanced Search queries broken

Internal Search and Advanced Search queries broken

Locked

Views: 2,077

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
1 Dec 2009, 2:17 PM
#1
drone115b avatar

drone115b

New Zenner

Join Date:
Nov 2009
Posts:
7
Plugin Contributions:
0

Internal Search and Advanced Search queries broken

[In the forums, I find a lot about "search" ala google and other external engines. This question is about the keyword search and advanced search features of zen-cart that find products from the store inventory for customers.]

Our categories are in Title Case (e.g. Running Pants, Denim, Casual Wear). Also Title Case is used in some product descriptions, when they are not proper English sentences.

It seems that advanced search and search queries from the home page are not matching our text that is in Title Case.

If we leave the first letter off, then we get hits:

so "enim" matches all the "Denim" items,

but "Denim" and "denim" match nothing.

This is a big issue for us. :cry:

I looked through a zen-cart manual that we had purchased, and I went through the admin panel to see whether there is any sort of index-building that I need to do. I was unable to find any information about setup associated with the query, so I'm surmising that it must be a direct SQL query on "raw" product table attributes.

I'm not a prolific SQL/php programmer, but I did grep through the code several times; however, I have been unable to find the keystone holding up the search query.

Using zen v1.3.8sp1 with a few common mods installed (RMA, Easy Populate, Zone Rates)

Any pointers?
Thanks.

2 Dec 2009, 4:03 PM
#2
drone115b avatar

drone115b

New Zenner

Join Date:
Nov 2009
Posts:
7
Plugin Contributions:
0

Re: Internal Search and Advanced Search queries broken

Nobody pointed me in the right direction. After a good deal of time, this is the solution I came up with:

includes/modules/pages/advanced_search_result/header_php.php

around line 292, there is a for-loop which iterates over each keyword, building up the appropriate query string.

I duplicated the block, enclosed the two blocks' string output with "()" and linked them with OR so that I don't get crazy order-of-operations side effects.

For the second block, I used the php function mb_convert_case( $str, MB_CASE_TITLE) to convert each of the keywords at each of the four instances where they are bound to the query.

So now, I can match keywords to lower case and Title Case in my product names and descriptions (and other fields).

Seems to be working.

22 Dec 2009, 11:59 PM
#3
vatertime avatar

vatertime

New Zenner

Join Date:
Dec 2009
Posts:
18
Plugin Contributions:
0

Re: Internal Search and Advanced Search queries broken

Oh man drone115b. You are teh awesome. I just followed your instructions and got my search to work beautifully. I searched the web for a 'zen cart search' fix and finally found this post when I looked for 'zen cart search broken'. I hope other will find this and benefit from it as I have. Well done sir.