Hello,
I am looking for a way to tell the script to only display the results of the "EXACT" title only.
So if the product search:
baby easter ears
only exact match results would appear:
(1) found.
baby easter ears
How would I do that. Right now it brings up other variations.
Thank you
Hello,
I tried edit this exactly as above and I cannot get it to display any results. As with the above edit it says no results found on all results.
Any ideas? I am using the most current version.
Thank you,
Michael
Hi Mike,
All you need to do is replace the default search handler with a much more basic name = query version. To do this, look for the following section in search.php:
default:
...83 lines...
break;
...and REPLACE with:
default:
$where = "name = '".database_safe($parts[0])."'";
$sql = "SELECT SQL_CALC_FOUND_ROWS * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants FROM `".$config_databaseTablePrefix."products` WHERE ".$where.$priceWhere." GROUP BY name";
$orderBySelection = $orderByDefault;
break;
That will perform an exact match only (so continuing your example would NOT match "baby easter ears yellow". If you want to still match the exact string but allow other words in the title as well, use an alternative where clause as follows:
$where = "name LIKE '%".database_safe($parts[0])."%'";
Cheers,
David.
--
PriceTapestry.com