You are here:  » product relevance

Support Forum



product relevance

Submitted by mally on Wed, 2009-12-09 16:53 in

Hello David

Is it possible where someone types in a name, for example Shares Magazine into my search box, they get the following results; http://www.magazinesubscription.co.uk/search/shares+magazines/

Would it be possible to show at the top of results, any that match the exact name of the product, with the remaining products underneath?

Thanks Mally

Submitted by support on Wed, 2009-12-09 18:50

Hi Mally,

Slightly easier (if this would be an option) is to check for an exact match to the query and redirect straight to the product page - just like your predictive search is doing. To do this, in search.php, near the very top immediately after the following line:

  $q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],":\."):"");

...add this code:

  $sql = "SELECT name FROM `".$config_databaseTablePrefix."products`
            WHERE name='".database_safe($q)."'";
  if (database_querySelect($sql,$result))
  {
    header("Location: /subscribe-to/".tapestry_hyphenate($result[0]["name"]).".html");
    exit();
  }

Hope this helps!

Cheers,
David.