You are here:  » need to modify search

Support Forum



need to modify search

Submitted by lukesloot on Mon, 2008-11-03 15:32 in

guys,

i have traffic coming from adwords, so what i want to do is this. when coming from adwords i want to set a flag like:

http://www.myurl.com/search.php?q=i+want+to+match+this+exactly&match=exact

i'd want it to match like so:

anything else before + "i+want+to+match+this+exactly" + anything else here

so if send them to http://www.myurl.com/search.php?q=hitachi+drill&match=exact

i want to match small hitachi drill but not hitachi rotary drill or hitachi hammer

this way my search results are more targetted coming from google. i'm finding that while sometimes i like the broader reults once a user is ony my site, when they first land i want to give them as targetted search results as i can. how can i achieve this?

thanks,

- lucas

Submitted by support on Mon, 2008-11-03 15:49

Hello Lucas,

This should be relatively straight forward; in search.php, look for the following code on line 78:

        if ($useFullText)

...and REPLACE that with:

        if ($_GET["match"]=="exact")
        {
          $sql = "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants FROM `".$config_databaseTablePrefix."products` WHERE name LIKE '%".database_safe($parts[0])."%' GROUP BY name";
          $sqlResultCount = "SELECT COUNT(DISTINCT(name)) as resultcount FROM `".$config_databaseTablePrefix."products` WHERE name LIKE '%".database_safe($parts[0])."%'";
          $orderBySelection = $orderByDefault;
        }
        elseif ($useFullText)

That will match the text exactly within the product name if match=exact is in the URL...

Cheers,
David.