how to search by Categories in oscommerce

364 Views Asked by At

am using oscommerce v2.3.1 in this advanced_search. php ,advanced_search_result.php i think they Search by default Product_name Product_model Manufacturess_name

but i have to add one more field(Categories ) in this

here they are filtering the keyword

$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) . "%'";

here i tried but not succeed please help me how to add that one

2

There are 2 best solutions below

0
On

Try adding:

$where_str .= "p2c.categories_id = '" . (int)$categories_id . "' and ";

after

$keyword = tep_db_prepare_input($search_keywords[$i]);

where $categories_id is the specific id of the category to be searched. Searching all sub cats is a different story.

0
On

The following contribution allows searching of the entire site. It adds the following features:

  • Search in product descriptions
  • Search in product attributes
  • Search in language files
  • Search in articles (if Article Manager addon installed)
  • Search in pages (if Page Editor addon installed)
  • If a search is performed on a word and no product matches are found, a form appears allowing the customer to email the shop owner asking for information about the product.
  • A modified version of the Advanced Search Box is included. The price boxes and category selector can be enabled/disabled via settings in the includes/boxes/search.php file.

download template from here: http://addons.oscommerce.com/info/6351