How can I make search only show products with all words

[quote name=‘cpugeek’]Not working for me. and i am using the newest version of cscart[/QUOTE]



Are you maybe doing an edit on the wrong skin? We had no problem and we are using the latest version too.



Can you provide more info as to what you did and maybe a site? There are a lot of good people here in the forum so someone may be able to direct you.

AH!!!

I know what you are all doing wrong!



The list is in order. It needs this perameter to be loaded before the others are taken into account. So it should be at the top of the list not added to the bottom.



Paste







at the top of the list just below







This makes it the first call and this solves it.

Hope this helps guys

Dan

Well it works at the bottom for me.

[quote name=‘mdekok3000’]Well it works at the bottom for me.[/QUOTE]





Depends on the server and how litterally it takes it into account i suppose. I found it works at the bottom on the heart server but not on my bluehost one. Its mad. If someone could explain why this is then please let me know it might answer a few other questions lol



Dan :wink:

I am having the opposite problem. I have a search by product feature, and when someone checks off more than one checkbox, the only results I get have ALL of the checked features. What I need is for the search to return products with ANY of the features checked off. I’ve added the “match” field to the form, set to “any”, but I get the same results.



You can see this at www.plans2build.com. Any ideas on how to fix this? Thanks!

[quote name=‘adders’]Sorry just taken a look at it and I think I didn’t word my request very well.



What I actually wanted to ask was how to get the search box that is permanently at the top of the screen to search using match type all.



Applying the info you gave me I have got it working now, so thanks again, but thought I’d post to let others know what I did.



I added this line as a hidden field to skins/basic/customer/side_boxes/search.tpl



[HTML][/HTML]



Pretty simple but I just need pointing it the right direction.



Cheers[/QUOTE]



Thanks! I just did this mod and it worked out wonderfully, and the front page (side box) search function now does exactly what I need it to do. With this and the advanced search default being set to “all” terms, the CS cart search function is greatly improved.



-Nate

How to you do with Cs-cart 2.04?



I want to search exact in the Product name and the Search words only. I don’t want it searches in short and full description.



Here are some adjust I made to search Exact in the Quick search and search by product code but it doesn’t work well



---------------Original code----------------------

// Search string condition for SQL query

if (!empty($params[‘q’])) {



if ($params[‘match’] == ‘any’) {

$pieces = explode(’ ', $params[‘q’]);

$search_type = ’ OR ‘;

} elseif ($params[‘match’] == ‘all’) {

$pieces = explode(’ ', $params[‘q’]);

$search_type = ’ AND ‘;

} else {

$pieces = array($params[‘q’]);

$search_type = ‘’;

}



$_condition = array();

foreach ($pieces as $piece) {

$tmp = db_quote(“(descr1.search_words LIKE ?l)”, “%$piece%”); // check search words



if ($params[‘pname’] == ‘Y’) {

$tmp .= db_quote(" OR descr1.product LIKE ?l", “%$piece%”);

}



-------------------Adjusted code--------------------------------------



// Search string condition for SQL query

if (!empty($params[‘q’])) {



if ($params[‘match’] == ‘exact’) {

$pieces = explode(’ ', $params[‘q’]);

$search_type = ’ OR ‘;

} elseif ($params[‘match’] == ‘all’) {

$pieces = explode(’ ', $params[‘q’]);

$search_type = ’ AND ';

} else {

$pieces = array($params[‘q’]);

$search_type = ‘’;

}



$_condition = array();

foreach ($pieces as $piece) {

$tmp = db_quote(“(descr1.search_words LIKE ?l)”, “%$piece%”); // check search words



if ($params[‘pname’] == ‘Y’) {

$tmp .= db_quote(" OR descr1.product LIKE ?l", “%$piece%”);

}



if ($params[‘pname’] == ‘Y’) {

$tmp .= db_quote(" OR products.product_code LIKE ?s", “%$piece%”);

}



Any one can help me?

You should be looking in YOUR_SKIN/customer/common_templates/search.tpl. At the top of the page add/change the following red parts:

```php









[COLOR="Red"][/COLOR]
{hook name="search:additional_fields"}{/hook}
```

[quote name=‘baballuci’]You should be looking in YOUR_SKIN/customer/common_templates/search.tpl. At the top of the page add/change the following red parts:

```php









[COLOR="Red"][/COLOR]
{hook name="search:additional_fields"}{/hook}
```[/QUOTE]

Many thanks baballuci. Many thanks

I tried and it works well for me.

But when I turn the Setting: Search also in Pages and Site News, it behaves stranged
The result is not perfect.

Any idea?

:smiley: :smiley: :smiley: :smiley:



Stumbled accross this thread purely by accident, but has been something that has bugged me for so long. There is only so much that can be done by tweaking the search phrases!



Customers reach my site in a host of different ways, not necessarily via the product page they want, so making a search facility that would enable them to easily find what they needed was imperative.



I’m forever greatfull and can really see this helping turn visitors into paying customers.



Thanks



Alfie

Yes, thank you also. This was something bugging me for awhile also but I forgot to look it up to fix it. Fixed.

How you I get cs cart to search all words but it should match each word exact. So for example if I search mens shoes right now it’s returning womens shoes also as it is partially matching “mens” in the word womens. However I want it to search all words too. It seems you can’t tell cs cart to do this by default.

[quote name=‘adders’]Sorry just taken a look at it and I think I didn’t word my request very well.



What I actually wanted to ask was how to get the search box that is permanently at the top of the screen to search using match type all.



Applying the info you gave me I have got it working now, so thanks again, but thought I’d post to let others know what I did.



I added this line as a hidden field to skins/basic/customer/side_boxes/search.tpl



[HTML][/HTML]



Pretty simple but I just need pointing it the right direction.



Cheers[/QUOTE]



Ran a store for 3 years and the search bugged the life out of me. Was useless to be fair.



This fix on a client’s store has finally made the search work.



Forever grateful :smiley: Wish I’d got it 3 years ago! lol