Jump to content

search box not working good


lucalg

Recommended Posts

Hallo,

i'm working from 2 weeks with presta 1.6 coming from older versions.

 

I think is good but i got a problem.

I'm preparing a site to sell toner and inkjet cartridges.

 

I index all the products and i got no error.

 

I make an example to explain what's happens:

i got a product that hasi in description "TONER CARTRIDGE FOR HP 1010 - OEM CODE Q2612A"

 

if i search for 1010 i find it

if i search for q2612a i find it

if i search for 2612 no result

 

It works in "like" mode but it seems that it wants a complete word. This is a big problem becaouse I can't be sure about the customer will search for.

 

Can anybody help?

 

Tnx

Luca

 

Link to comment
Share on other sites

Yes, you can edit the find() method of the search.php class, lines 207, 208

						? ' \''.pSQL(Tools::substr($word, 1, PS_SEARCH_MAX_WORD_LENGTH)).'%\''
						: '\''.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\''

CHange it to

						? ' \'%'.pSQL(Tools::substr($word, 1, PS_SEARCH_MAX_WORD_LENGTH)).'%\''
						: '\'%'.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\''

Please note that your search might become slower

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Thanks. Worked for me too. 

 

I have about 500 products, and the search works fast with this modification.

 

In my case, the problem was that i would search for :    Nokia X6 or nokia x7  or anything with an X, and would not come up at all.

 

Now it works.

 

 

:)

Link to comment
Share on other sites

Hi,

 

I hope someone can help please, I am using 1.4.4.1 the search function is not working at all, can anyone help please.

 

Alex

 

You should probably open a new topic and   specify type of issues you're having :)

Link to comment
Share on other sites

Hi,

 

I am using Prestashop 1.5.3.1 with multi store, the product search works, the only thing I like to see is:

 

how can I get the searched product on the sub store that owns it?

 

For example, I search a product on the main store, it does find the product, but the page still stays on the main store in stead it should go to the sub store that owns this product.

 

Can somebody help? Thanks in advanced.

Link to comment
Share on other sites

What do you exactly mean by substore?

Hi, Nemo1

 

Thank for your interests in response, my main store is (for example) www.mystore.com, and other "substore" is www.mystore.com/store1/.

 

when I search (on the www.mystore.com) the product which is belonged to the store1, yes, I can find it, but the search result sits on  the www.mystore.com page.

 

I am wondering is there a way that the search result can be on the www.mystore.com/store1. So people can actually know which store has this product.

Link to comment
Share on other sites

1 Hello Nemo, I found the files that you tell me, manon difference I see from what you've posted, compared to what I have??

 

THose are the lines, correct. They are different, notice the % symbols preceding words in my snippet

 

Hi, Nemo1

 

Thank for your interests in response, my main store is (for example) www.mystore.com, and other "substore" is www.mystore.com/store1/.

 

when I search (on the www.mystore.com) the product which is belonged to the store1, yes, I can find it, but the search result sits on  the www.mystore.com page.

 

I am wondering is there a way that the search result can be on the www.mystore.com/store1. So people can actually know which store has this product.

 

Ah no, that's normal, you cannot achieve that with the default search :)

Link to comment
Share on other sites

  • 3 months later...

Hi, Nemo1,  

 

I have an issue with PS 1.6.0.9 version. Ajax search box on top is not working.

 

I have made the changes someone proposed on other threads for a previous 1.5.5 version: enabling/disabling search in top menu, activating/deactivating ajax search block. But nothing changes. Result is always the same: 0 records found. Could you or someone else help me with this issue. I am not the only one with this problem (http://www.prestashop.com/forums/topic/355185-problem-with-the-search-box/?view=findpost&p=1785303)

Link to comment
Share on other sites

  • 5 months later...

Well yes, it should search in the description as well if it has weight in the preferences > search setting (bottom)

 

You can try this, in search.php, find() method

$eligible_products = array_intersect($eligible_products, $eligible_products2);

Set it to array_merge, but notice search results will be more loose

  • Like 1
Link to comment
Share on other sites

Hello.

We have little issue with search too.

We have Latest 1.6.11 version.

WE try to find "H-8" and it finds nothing when we have product named "Bāra krēsls H-8" and reference code is also set to "H-8"

If we change reference code to "H8" then search can find it. So probably there is some issue with symbol "-". But it would be very important to have it with symbol "-".

 

Tried solutions mentioned above but did not work.

Here is product - mebelestev.lv/lv/bara-kresli/bara-kresls-h-8.html

And here is search result - http://mebelestev.lv/lv/meklet?controller=search&orderby=position&orderway=desc&search_query=h-8&submit_search=

Link to comment
Share on other sites

Yes, the dash problem has been affecting prestashop since earlier version. I must admit I tried a bunch of solutions but couldn't find a proper one but modifying the sanitize() method of the search class, should be this line

 

$string = ltrim(preg_replace('/([^ ])-/', '$1 ', ' '.$string));

 

I can't recall what I exactly did though, at the moment

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...