amcho
26-03-08, 13:30
I installed a modded version of IntroSites Search Spy described at
http://www.shopwindowforum.com/showthread.php?t=461
On analysing the results some of the searches that returned no results
included a special character (eg AEG-C41022GNM) while a search on "AEG C41022GNM"
was more fruitful.
The following bit of code gives us a second chance by stripping the search query of special characters,
and should be added to search.php just after the line
$oPage = new pageSearch($_......
if (count($oPage->oSearch->searchProductReturn) < 1) {
$q= $_GET['q'];
echo "No results for ".$q."\n<br>";
$n = preg_replace('/[-\/\\\(\)\"]/', ' ', $q);
if ($n!=$q) {
echo "Trying ".$n."\n<br>";
$_GET['q']=$n;
$oPage = new pageSearch($_GET['iListLimit'], $_GET['iListOffset'], '', $_GET['sListSort']);
}
}
To see the code in action go to
http://pricecompareuk.com/search.php?q=AEG-C41022GNM&c=0&search=Search
Usual disclaimers:
This worked for me, it may not for you, so use at your own risk, back everything up before messing with code, etc.
If you improve the code please post updates here so all can benefit.
Enjoy...
http://www.shopwindowforum.com/showthread.php?t=461
On analysing the results some of the searches that returned no results
included a special character (eg AEG-C41022GNM) while a search on "AEG C41022GNM"
was more fruitful.
The following bit of code gives us a second chance by stripping the search query of special characters,
and should be added to search.php just after the line
$oPage = new pageSearch($_......
if (count($oPage->oSearch->searchProductReturn) < 1) {
$q= $_GET['q'];
echo "No results for ".$q."\n<br>";
$n = preg_replace('/[-\/\\\(\)\"]/', ' ', $q);
if ($n!=$q) {
echo "Trying ".$n."\n<br>";
$_GET['q']=$n;
$oPage = new pageSearch($_GET['iListLimit'], $_GET['iListOffset'], '', $_GET['sListSort']);
}
}
To see the code in action go to
http://pricecompareuk.com/search.php?q=AEG-C41022GNM&c=0&search=Search
Usual disclaimers:
This worked for me, it may not for you, so use at your own risk, back everything up before messing with code, etc.
If you improve the code please post updates here so all can benefit.
Enjoy...