Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

quick search advanced search


johnnybebad

Recommended Posts

Hi,

 

been looking at a fe mods today and not sure the best way about changing the search function.

 

Okay so i have a fields in a table.

 

rather than search through the entire table for the details, i want search fields 1 and 2, or fields 1 or 2

 

eg products_name

products_description

products_weird_wonderful

 

so if I have a check box say in the quick search it will just search the one field selected and one search input box

 

but say I used advanced search I would have the three search inputs available along side the fields this is so i can search on different things in each search box to narrow down the item I am looking for.

 

 

Can you advise/ point us to the mod that best emulats what i am trying to achieve as i am not sure that what I found in the add ons is really what i am after.

 

Thanks

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

HI not sure if my wordrding helped me get anywahere so I will try again to trya and explain what I am trying to achieve.

 

I want to be able to search just a particular fied and or mutipul fields that reside in the products_table database.

 

1. products_name

2. products description

3. products_author_name

4. products_publisher

 

ideally with a check or raido box/button at the side of each option in includes/boxes/search.php, that when selected only searchs that field in the database, but it would also be useful is if you could select more than one field in advanced_search.php and have a box to enter the text in to search those fields.

 

I have been looking for the mod and cant find one that tells me how to do this at all any help would be much appreciated.

 

Thanks

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

Hi again,

 

okay I know have my list fileds I want to search on showing as check boxs in boxs/search.php

 

Now I need to know how to get the information from selecting these check boxs added to the advance_search_results.php ??

 

one example should be enough if anyone can help I be grateful.

 

I am going to try and see f I can work it out in the menntime, but some guidance might help me get things moving a bit smoother.

 

Thanks

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

Okay, I have got it whoopie, now I need to get the alignment of everything right.

 

I inserted in the products_description table field products_authors_name

 

 

files that I have altered:-

 

includes/boxes/search.php

includes/languages/english.php

advanced_search_results.php

 

In includes/boxes/search.php

 

find:-

'text' => BOX_SEARCH_TEXT . '<br>' .  tep_draw_hidden_field('search_in_description','1') .  tep_draw_hidden_field('inc_subcat', '1', true) . tep_draw_input_field('keywords','','size="10" maxlength="30" class="searchForm" style="width: ' . (BOX_WIDTH-30) . 'px"') . '<br>' . tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)))) . '<br>' . tep_hide_session_id().

 

 

 

add after

 

 tep_draw_checkbox_field('search_in_authors_name','1') . ENTRY_AUTHORS_NAME . '<br>' . 

 

 

 

if its the last entry it should end with ; rather than .'<br>'.

 

in includes/languages/english.php add:-

 

define('ENTRY_AUTHORS_NAME', 'Author');

before the last

 ?>

 

 

 

then in catalog/advanced_search_results.php

 

find

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

 

 

add after it

if (isset($HTTP_GET_VARS['search_in_authors_name']) && ($HTTP_GET_VARS['search_in_authors_name'] == '1')) $where_str .= " or pd.products_authors_name like '%" . tep_db_input($keyword) . "%'";

 

 

 

Note this will allow you to search just authors name when the check box is selected

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...