This CubeCart mod changes the search feature so that a search for "red car" will list products containing ALL of the words (both red and car), rather than listing products containing just one or more of the words.
Version: 1.0
Files Affected:
- includes/content/viewCat.inc.php
Instructions:
DOWNLOAD includes/content/viewCat.inc.php from your web server.
MAKE A BACKUP copy of the file so that you can restore the backup copy if any problems arise.
EDIT includes/content/viewCat.inc.php with a text editor (such as Wordpad).
FIND this line:
$like .= "(name LIKE '%".$searchArray[$i]."%' OR description LIKE '%".$searchArray[$i]."%' OR productCode LIKE '%".$searchArray[$i]."%') OR ";
REPLACE with this:
/* start mod: Simple Search Improvement v1.0 - by Estelle */ /*$like .= "(name LIKE '%".$searchArray[$i]."%' OR description LIKE '%".$searchArray[$i]."%' OR productCode LIKE '%".$searchArray[$i]."%') OR ";*/ $like .= "(name LIKE '%".$searchArray[$i]."%' OR description LIKE '%".$searchArray[$i]."%' OR productCode LIKE '%".$searchArray[$i]."%') AND "; /* end mod: Simple Search Improvement v1.0 - by Estelle */
FIND this line (it occurs TWICE in the file):
$like = substr($like,0,strlen($like)-3);
REPLACE with this (for BOTH occurrences of the line:
/* start mod: Simple Search Improvement v1.0 - by Estelle */ /*$like = substr($like,0,strlen($like)-3);*/ $like = substr($like,0,strlen($like)-4); /* end mod: Simple Search Improvement v1.0 - by Estelle */
SAVE the file and upload to your server.
CubeCart Version: 3