Zen Cart Logo
Forums / General Questions / In-site search 2-digit/char

In-site search 2-digit/char

Views: 504

Results 1 to 4 of 4
5 Mar 2012, 3:39 AM
#1
zcadqliv avatar

zcadqliv

New Zenner

Join Date:
Jan 2011
Posts:
69
Plugin Contributions:
0

In-site search 2-digit/char

http://www.glimm_erdog.com

I am selling a lot of products where people may type into the in-site search with 2-digit codes such as "72" or "hp 72". This never comes out well. With 3-digit codes it works pretty well.

Any ideas as a way to modify the search parameters? I'm guessing a lot of results would come up, but if it pulled from the "Model" or "Name" first that would be helpful.

Thanks!

6 Mar 2012, 1:04 PM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: In-site search 2-digit/char

zcadqliv:

http://www.glimm_erdog.com

I am selling a lot of products where people may type into the in-site search with 2-digit codes such as "72" or "hp 72". This never comes out well. With 3-digit codes it works pretty well.

To the best of my knowledge zencart doesn't place any limit (upper or lower) on the permissible length of search strings, so whatever the difference is between the 2 and 3 character strings, it is more likely to be a coincidence rather than a connection.

zcadqliv:

Any ideas as a way to modify the search parameters?

A skilled coder could make many modifications. What is your skill level, and exactly what is it you wish to modify?

zcadqliv:

I'm guessing a lot of results would come up,

Computers don't guess. When trying to solve problems it is always best to assume the computer is correct and your guesses are incorrect. You can save a lot of headscratching that way. :)

zcadqliv:

but if it pulled from the "Model" or "Name" first that would be helpful.
Thanks!

I'll need to look at the code to be sure, but seriously doubt that there will be a 'check this first, check that second' type code in place. It will be a matter of checking all (specified) fields without any preference.. in other words, things will match, or they won't match.

Someone more familiar with the code may be able to tell you exactly which fields are being searched (or better yet, if you can identify the relevant code yourself it will probably become 'obvious' and you'll probably also be able to cut n paste code to add additional search fields (if necessary/required).

The most difficult part is in trying to find the correct file that holds the search code.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

7 Mar 2012, 5:01 AM
#3
zcadqliv avatar

zcadqliv

New Zenner

Join Date:
Jan 2011
Posts:
69
Plugin Contributions:
0

Re: In-site search 2-digit/char

Thanks for the info RodG!

I need to have it so that if someone types "hp 45" - with the space - that the product which is hp 45 shows up. Preferably first.

Ideally, just "45" would bring it onto the first group of results, but I would live with the first part.

That is all I care about. If you type it in a search engine the right thing comes up. My skill is medium, but I don't want to try and rewrite lots of code.

7 Mar 2012, 5:33 AM
#4
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: In-site search 2-digit/char

zcadqliv:

If you type it in a search engine the right thing comes up.

Search queries tend to be application Dependant, meaning they don't all work the same way, so trying to compare how a search engine search works with how ZenCarts search routines work is a bit like comparing apples and oranges.

zcadqliv:

My skill is medium, but I don't want to try and rewrite lots of code.

You shouldn't need to, even though I still can't explain why your 3 character searches work but the 2 character ones don't (within zen cart).

As I said b4, unless someone familiar with this aspect of zencart code speaks up, the only way to figure out whats going on would be to inspect the code.

Although probably unlikely, it could be that your 2 character search queries are failing not because they are only 2 characters, but perhaps because they both happen to be numbers rather than letters and zencart isn't seeing this as a text string....... I really don't think this would be the case in code as mature as Zencart, but this kind of thing isn't uncommon in less mature code.

Sorry, but I really can't be of any more help than this at this point in time.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.