Add Category Keyword Search (v. 2.83)
To add a search box in the storeadmin area to allow clients to search for categories with a specific keyword, you can use the following modification:
-
Open the categories.php file in the /storeadmin/ folder.
-
Find the code:
// DISPLAY ORPHANS
-
Just above that code, add the code:
// MOD - SEARCH BY KEYWORD $cat_kw = str_replace('"', '"', $catkw); echo <<END; if (!empty($catkw)) { $lowercat = strtolower($catkw); $catkresult = mysql_query("SELECT ID, Category FROM " . SB_DB_PREFIX . "_categories WHERE LOWER(Category) LIKE '%" .addslash_mq($lowercat) . "%' OR LOWER(Description) LIKE '%" .addslash_mq($lowercat) . "%' OR LOWER(Keywords) LIKE '%" .addslash_mq($lowercat) . "%'", $dblink); if (mysql_num_rows($catkresult) > 0) { echo " Categories with the keyword '$catkw'
"; echo ""; while ($catkrow = mysql_fetch_array($catkresult)) { $ckid = $catkrow[ID]; echo "
"; } } echo " "; } echo "" . stripslashes($catkrow[Category]) . " Edit | Delete | Items | Reassign
Save and reload the file.
At this point, your client will be able to search for categories with a particular keyword in the category name, description or keywords field.