Zen Cart Logo
Forums / General Questions / Limit Search Results To Model Number and Product Title

Limit Search Results To Model Number and Product Title

Locked

Views: 3,009

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
26 Jun 2009, 2:03 PM
#1
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Limit Search Results To Model Number and Product Title

I need to limit the search results on one of my websites to the Product Title and model number. The reason being is that if a customer search for a car make and model the search result will render results that are irrelevant just because the content has the same keywords. The way I have my product setup is that the car make and model are listed in the title so if a customer search for a car they will see a relevant result. Plus I am using the model number to display the part number so most customers are going to either search by the car make and model or by the part number.

26 Jun 2009, 2:55 PM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Limit Search Results To Model Number and Product Title

I believe that searches already include name and model by default. Therefore you would need to remove the other fields from the advanced_search template. To do a thorough job your would probably removes them from the search algorithm in the includes/modules/pages/advanced_search_result/header_php.php file too.

29 Jun 2009, 1:48 AM
#3
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Re: Limit Search Results To Model Number and Product Title

I thought I would post the solution that I found, alter the following lines (around line 323) in the module/pages/advanced_search_results/header.php

$where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');

To:

$where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');
				unset($_GET['search_in_description']);
27 Nov 2009, 7:33 PM
#4
roooot avatar

roooot

New Zenner

Join Date:
Jun 2009
Posts:
13
Plugin Contributions:
0

Re: Limit Search Results To Model Number and Product Title

Very good. Very useful. Thank you:clap:

13 May 2010, 7:34 PM
#5
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Limit Search Results To Model Number and Product Title

CoolCarPartsOnline:

I thought I would post the solution that I found, alter the following lines (around line 323) in the module/pages/advanced_search_results/header.php

$where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');

> 
> To: 
> ```php
$where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');
				unset($_GET['search_in_description']);

I would need TWO search boxes and limit both of them:

  • the first one only to give results of the PRODUCT MODEL
  • the second one only to give results of the PRODUCT NAME / TITLE

I think it could be somehow lead out of this solution above... It would be nice if anybody can help.

Elli

7 Jul 2010, 9:48 AM
#6
sushigal avatar

sushigal

Zen Follower

Join Date:
Mar 2009
Posts:
435
Plugin Contributions:
0

Re: Limit Search Results To Model Number and Product Title

I've used this bit of code also but changed it to 'search_in_title' however, when I search for 'pen' it still brings up irrelevant products that dont have the word 'pen' in their title. Does anyone know how I can sort this?

Thanks.

7 Jul 2010, 9:59 AM
#7
sushigal avatar

sushigal

Zen Follower

Join Date:
Mar 2009
Posts:
435
Plugin Contributions:
0

Re: Limit Search Results To Model Number and Product Title

sorry, 'search_in_name' which works, however when I search 'pen' a load of hip flasks are still coming up and I cannot see the word pen in their product name at all.

my site is at http://www.thegreatgiftshop.co.uk