Anguz 0 Posted May 3, 2003 how do I add more fields to the search? I'd like to be able to search by product weight also and would like to not make it a requisite to put a query for the search, I'd like for example to be able to get all the products in categ A and cost between 1 and 5, without using a keyword how can I do this? also, how do I make the "Search In Product Descriptions" checkbox checked by default? Share this post Link to post Share on other sites
Steve 0 Posted May 4, 2003 1. Look in the advance_search_result.php and half way down or so you will find a line that looks like this default: $where_str .= "(p.products_keywords like '%" . addslashes($search_keywords[$i]) . "%' or p.products_model like '%" . addslashes($search_keywords[$i]) . "%'"; $where_str .= ')'; I included a new field called products_keywords the products_?????? will be different, but follow this format to include your new fields to the search. 2. To make the search in description on all the time - modify the line in advanced_search.php $info_box_contents[] = array('align' => 'right', 'text' => tep_draw_checkbox_field('search_in_description', '1', TRUE) . ' ' . TEXT_SEARCH_IN_DESCRIPTION); this will always have the check box on the page marked true. you also have to modify a piece of code since when the search is run from the search box, it will not include the description. I will look for that line and send it ASAP. Steve Have a Charming Day !!! Lisa Share this post Link to post Share on other sites
Anguz 0 Posted May 4, 2003 great!! I'll look into that code and hopefully make it work :P if not, I'll post here with details about the search box, I found this contribution: http://www.oscommerce.com/community/contri...ons,1036/page,5 so maybe you don't need to bother with that thank you :) Share this post Link to post Share on other sites
Anguz 0 Posted May 4, 2003 1. Look in the advance_search_result.php and half way down or so you will find a line that looks like this default: $where_str .= "(p.products_keywords like '%" . addslashes($search_keywords[$i]) . "%' or p.products_model like '%" . addslashes($search_keywords[$i]) . "%'"; $where_str .= ')'; I included a new field called products_keywords the products_?????? will be different, but follow this format to include your new fields to the search. hmm... ok, I found it and read the code around it and figured this is to decide what fields it'll look for the keywords in, right? the new criteria I want to add to the search is "weight", but more than looking for the keyword there, I need to have a range, pretty much like the "date" and "price" options... I'm looking into the code for those two, but haven't figured it out yet... about the keywords thing, I want to be able to run a search without keywords, and although the first time I tried it it didn't work, it seems to work now lol, I wonder what I did wrong before :P the checkbox is checked now, thx for that too :) Share this post Link to post Share on other sites