Search Item and Category Descriptions (v. 2.81)

Currently, the system searches the item or category name, the keywords field and the catalog number (for items) when searching the catalog or site. If you'd like to also search the description, use the following modification.

Please keep in mind that descriptions may contain HTML code, so tags with the keywords a site visitor is searching for may show up. For example, if you use

tags in your description, and someone searches for the keyword table, that item will appear.

  1. Open the openinfo.php file in the /enc/ folder (this changes the catalog search to search item descriptions).

  2. Change the line:

    $searchquery .= " AND (Item LIKE '%$addkeyword%' OR Keywords LIKE '%$addkeyword%' 
    OR Catalog == '$addkeyword')";

    to:

    $searchquery .= " AND (Item LIKE '%$addkeyword%' OR Keywords LIKE '%$addkeyword%' 
    OR Catalog == '$addkeyword' OR Description LIKE '%$addkeyword%')";
  3. Change the line:

    $searchquery .= "(Item LIKE '%$addlterm%' OR Keywords LIKE '%$addlterm%' 
    OR Catalog = '$addlterm')";

    to:

    $searchquery .= "(Item LIKE '%$addlterm%' OR Keywords LIKE '%$addlterm%' 
    OR Catalog = '$addlterm' OR Description LIKE '%$addlterm%')";
  4. Open the sitesearch.php file in the /enc/ folder (this changes the site search to search through item descriptions).

  5. Change the line:

    $keyquery .= "Item LIKE '%$keyword%' OR Keywords LIKE '%$keyword%' OR Catalog = '$keyword'";

    to:

    $keyquery .= "Item LIKE '%$keyword%' OR Keywords LIKE '%$keyword%' OR Catalog = '$keyword' 
    OR Description LIKE '%$keyword%'";
  6. Change the line:

    $keyquery .= "(Item LIKE '%$addlterm%' OR Keywords LIKE '%$addlterm%' OR Catalog = '$keyword')";

    to:

    $keyquery .= "(Item LIKE '%$addlterm%' OR Keywords LIKE '%$addlterm%' OR Catalog = '$keyword' 
    OR Description LIKE '%$addlterm%')";
  7. Change the line:

    $catquery .= "Category LIKE '%$keyword%' OR Keywords LIKE '%$keyword%'";

    to:

    $catquery .= "Category LIKE '%$keyword%' OR Keywords LIKE '%$keyword%' 
    OR Description LIKE '%$keyword%'";
  8. Change the line:

    $catquery .= "(Category LIKE '%$addlterm%' OR Keywords LIKE '%$addlterm%')";

    to:

    $catquery .= "(Category LIKE '%$addlterm%' OR Keywords LIKE '%$addlterm%' 
    OR Description LIKE '%$addlterm%')";
  9. Save and reload all files.

We use cookies to enhance your web site experience. By using this site, you agree to our use of cookies. Please view our privacy policy for details.
© 2018. All rights reserved.