Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Search in Description


veni

Recommended Posts

Is there a contribution that will allow searches to also search the description of the items as well?

So basically when a search is triggered, not only does it search the product's name it also searches in the description field as well.

 

Thanks

Link to comment
Share on other sites

Yes, it's called the Advanced Search Infobox, as I recall. This thread may also help.

 

Jack

 

After a quick look I think you can do the following: -

 

catalog/advanced_search_result.php

 

		  $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) . "%'";
	  // FWR mod
	  //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 .= " or pd.products_description like '%" . tep_db_input($keyword) . "%'";
	  $where_str .= ')';
	  break;

Link to comment
Share on other sites

After a quick look I think you can do the following: -

 

catalog/advanced_search_result.php

 

		  $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) . "%'";
	  // FWR mod
	  //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 .= " or pd.products_description like '%" . tep_db_input($keyword) . "%'";
	  $where_str .= ')';
	  break;

 

 

Thanks I will give that a try

Link to comment
Share on other sites

  • 1 year later...
After a quick look I think you can do the following: -

 

catalog/advanced_search_result.php

 

		  $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) . "%'";
	  // FWR mod
	  //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 .= " or pd.products_description like '%" . tep_db_input($keyword) . "%'";
	  $where_str .= ')';
	  break;

 

Fantastic, thanks FWR, just what I was looking for for my CRE install :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...