Contributions

Credit Modules (Category Index)
Search: 

Search Descriptions simple mod

I've looked everywhere in the forums last week to find out how to make quick search, search in descriptions. I've tried editing search.php in includes/boxes, and editing advanced_search.php. But the one thing that worked for me was posted by: Emmett Brosnan. Maybe its because my site is STS modified. Hope this helps someone.

File: advanced_search_result.php

Change:


CODE
default:
$keyword = tep_db_prepare_input($search_keywords[$i]);
$where_str .= "(pd.products_name like '%" . tep_db_input($keyword) . "%' or p.products_model like '%" . tep_db_input($keyword) . "%' or m.

manufacturers_name like '%" . tep_db_input($keyword) . "%'";
if (isset($HTTP_GET_VARS['search_in_description']) && ($HTTP_GET_VARS['search_in_description'] == '1')) $where_str .= " or pd.products_description

like '%" . tep_db_input($keyword) . "%'";
$where_str .= ')';
break;


To:


CODE
default:
$keyword = tep_db_prepare_input($search_keywords[$i]);
$where_str .= "(pd.products_name like '%" . tep_db_input($keyword) . "%' or p.products_model like '%" . tep_db_input($keyword) . "%' or m.

manufacturers_name like '%" . tep_db_input($keyword) . "%' or pd.products_description like '%" . tep_db_input($keyword) . "%'";
if (isset($HTTP_GET_VARS['search_in_description']) && ($HTTP_GET_VARS['search_in_description'] == '1')) $where_str .= " or pd.products_description

like '%" . tep_db_input($keyword) . "%'";
$where_str .= ')';
break;


Expand All / Collapse All

Admin config version 13 Nov 2009

Same principle, but uses an admin configuration to control whether or not to search descriptions by default instead of having the choice hard-coded.

Just added the php file 24 Mar 2007
Search Descriptions simple mod 18 Jun 2006

Note: Contributions are used at own risk.