Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / How do i get the basic search to only search title?

How do i get the basic search to only search title?

Locked

Views: 1,721

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
3 Aug 2009, 11:23 AM
#1
filfish avatar

filfish

New Zenner

Join Date:
Feb 2006
Posts:
24
Plugin Contributions:
0

How do i get the basic search to only search title?

My version of Zencart is 1.3.8a

The search function in the sidebox searches both title and description by default, is there a way to make this search only the title by default as many of my items descriptions have the keywords for other items in them making the search results a bit useless. I'd rather only show 3 or 4 items with the word in the title than 50 with the word in the description, especially if the ones with it in the title end up lost at the end!

Cheers

Phil

4 Aug 2009, 2:10 AM
#2
fakedecoy avatar

fakedecoy

Zen Follower

Join Date:
Jul 2006
Posts:
309
Plugin Contributions:
0

Re: How do i get the basic search to only search title?

I think you can comment out this code in

includes/modules/pages/advanced_search_result/header.php

        if (isset($_GET['search_in_description']) && ($_GET['search_in_description'] == '1')) {
          $where_str .= " OR pd.products_description
                          LIKE '%:keywords%'";

          $where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');
        }
4 Aug 2009, 8:19 AM
#3
filfish avatar

filfish

New Zenner

Join Date:
Feb 2006
Posts:
24
Plugin Contributions:
0

Re: How do i get the basic search to only search title?

Thanks fakeDecoy

Unfortunately it didn't do it quite right, it did cut down my results a little.

the site is https://www.homebrewandwinemaking.co.uk and doing a search for 'yeast' returns anything with 'yeast' in the descriptions not just in the item title.

The offering from fakedecoy (mypage was header_php.php) stopped a couple of results but not the bulk of them, if the item is called "beer kit", with a description of "this beer kit comes with yeast" Then i don't want it returned when I do a basic search for 'yeast'.

I would rather only show: "Yeast for beer", "Yeast for wine", etc rather than anything with yeast in the rest of the listing.

Thanks in advance

Phil

13 Aug 2009, 2:38 PM
#4
giftmeister avatar

giftmeister

Zen Follower

Join Date:
Jan 2009
Location:
Montreal, Canada
Posts:
230
Plugin Contributions:
0

Re: How do i get the basic search to only search title?

See this thread-

http://www.zen-cart.com/forum/showthread.php?p=644559

I changed a few instances of 1 to 0 (uploaded and tested one at a time) and my search improved, but it still did not limit the results to titles. Hm... Let me know if and how you do better.

R

14 Aug 2009, 12:51 PM
#5
fergusmacdonald avatar

fergusmacdonald

Zen Follower

Join Date:
Oct 2007
Location:
Edinburgh, Scotland
Posts:
243
Plugin Contributions:
0

Re: How do i get the basic search to only search title?

Hey,

I've also used that thread to update my search results to exclude descriptions, however searches appear to be searching in other areas.

Specifically, they appear to be searching the meta descriptions. Does anyone know how to stop the search functionality searching meta information?

Thanks.