I list my products by single item name eg: 900 (79 - 92) spark plug - BP7 ES
It seems that if somebody searches in the plural for 'spark plugs' an empty result set is brought up by the search facility, consequently the potential customer thinks I don't sell spark plugs, this is obviously not good.......
So I have a quick fix below.
This code addition will strip an 's' off the end of the search term entered if it contains one. The good thing is that even if the 's' should be there the search will still match the correct terms due to the in-built partial matching facility.
The code:
In advanced_search_result.php at the top, just above:
require('includes/application_top.php');
ADD
if(isset($_GET['keywords']) && $_GET['keywords'] != ''){
$pwstr_check = strtolower(substr($_GET['keywords'], strlen($_GET['keywords'])-1, strlen($_GET['keywords'])));
if($pwstr_check == 's'){
$pwstr_replace = substr($_GET['keywords'], 0, strlen($_GET['keywords'])-1);
header('location: ' . $_SERVER['PHP_SELF'] . '?keywords=' . $pwstr_replace . '&search_in_description=1');
exit;
}
}
Hopefully this will help others.














