Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

advanced search tweaks


Anguz

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...