Hi guys, below is default OSCommerce complete search file, the file name is advanced_search_result.php oscommerce is very free famous script, but.. ironically this file is searching all words that typed by user, even just a single word like "A" or "An" it is searching in mysql, so its make very very high load for the server, imagine its need to search for all words that contain "A", how if you have 100.000 products/items in your site maybe the best option to reduce the load server is to set the minimum character to search, example to search only minimum 4 or more character, there is no setting for doing this in oscommerce setting, so its need to change some code in a file, i had asking this in oscommerce forum, but they cant do this http://forums.oscommerce.com/index.php?showtopic=340368 i think the part need to edit is in red bold below, please help guys to make it only search 4 or more character words here is advanced_search_result.php file content : I had try change to red bold below, but no one working or or
Fiddle with this (added strlen): if (isset($search_keywords) && (sizeof($search_keywords) > 0) && strlen($search_keywords[$i]) > 4) { $where_str .= " and ("; { switch ($search_keywords[$i]) { case '(': case ')': case 'and': case 'or': $where_str .= " " . $search_keywords[$i] . " "; break; default: $keyword = tep_db_prepare_input($search_keywords[$i]); $where_str .= "(pd.products_name like '%" . tep_db_input($keyword) . "%'"; $where_str .= ')'; break; } } $where_str .= " )"; } PHP: