Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Advanced Search new fields


Pica

Recommended Posts

I tried to find an answer for this before posting but... found nothing.

 

I wish to use additional fields in the Advanced Search page. This could be with existing fields from the original DB but also with recently added fields.

 

Any clues on this ?

 

Thx in advance.

 

P.

Link to comment
Share on other sites

Still no reply to previously posted help-request....

 

In order to be clearer, here is what I wish to do :

 

In the Advanced Search page, I would like to search for products based on weight, price, ...

 

Search should be done on predefined values as well as between user-input values (same as Price From...)

 

 

 

Desperatly hoping for someone to help me out with this...

 

P.

Link to comment
Share on other sites

I keep looking in every forum and related message BUT still not finding an answer.

 

I'm sure out there one of you know how to do this....

 

Please, please, please... :oops:

 

P.

Link to comment
Share on other sites

Hi Maxi....

 

I took a look at that file... the only thing I found close to what you suggest was :

 

          default:

           $where_str .= "(pd.products_name like '%" . AddSlashes($search_keywords[$i]) . "%' or p.products_model like '%" . AddSlashes($search_keywords[$i]) . "%' or m.manufacturers_name like '%" . AddSlashes($search_keywords[$i]) . "%'";

           if ($HTTP_GET_VARS['search_in_description']) $where_str .= " or pd.products_description like '%" . AddSlashes($search_keywords[$i]) . "%'";

             $where_str .= ')';

           break;

In your other post, I notice "isset" in the code before the HTTP_GET_VARS... could this be a problem ?

 

Also, should I change the code elsewhere ? or can I just add that as follows :

 

if ($HTTP_GET_VARS['search_in_description']) $where_str .= "

or pd.products_description like '%" . AddSlashes($search_keywords[$i]) . "%'"

or p.products_myfield_name_1 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_myfield_name_2 like '%" . addslashes($search_keywords[$i]) . "%'";

 

Thanks in advance.

 

P.

Link to comment
Share on other sites

Mine has heaps of new fields that looks like this:

 

            break;

         default:

           $where_str .= "(pd.products_name like '%" . addslashes($search_keywords[$i]) . "%' or p.products_model like '%" . addslashes($search_keywords[$i]) . "%' or m.manufacturers_name like '%" . addslashes($search_keywords[$i]) . "%'";

           if (isset($HTTP_GET_VARS['search_in_description']) && ($HTTP_GET_VARS['search_in_description'] == '1')) $where_str .= " or pd.products_description like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st1 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st2 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st3 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st4 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st5 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st6 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st7 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st8 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st9 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st10 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st11 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_st12 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_movie_sub_title like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_director like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_audio like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_screen_format like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_pal_format like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_region like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_year like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_rating like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang1 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang2 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang3 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang4 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang5 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang6 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang7 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang8 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang9 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang10 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang11 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_lang12 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub1 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub2 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub3 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub4 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub6 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub7 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub8 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub9 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub10 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub11 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub12 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub13 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub14 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub15 like '%" . addslashes($search_keywords[$i]) . "%'

or p.products_sub16 like '%" . addslashes($search_keywords[$i]) . "%'";



             $where_str .= ')';

           break;

       }

     }

     $where_str .= " )";

   }

 }

 

 

In your other post, I notice "isset" in the code before the HTTP_GET_VARS... could this be a problem ?
No.

 

The code placement you have is right.

 

Also, should I change the code elsewhere ? or can I just add that as follows :

 

Basically this is just a really quick and simple way to get your new fields in the advanced search, so basically a customer would need to click advanced Search and tick the "search in descriptions" tick box to find the results.

 

The "search in descriptions" tick box can be turned ON by default and can also be turned ON in the quick search box.

 

I am working on something at the moment that involves, having multiple tick boxes and drop down boxes as options in the advanced_search for custom fields and excetera,

 

I will post my code as I advance more, its just time permitting at the moment.

 

Cheers Lee

Link to comment
Share on other sites

Ok... thx Maxi - I'll try that as soon as possible (for the time being, some sleep is greatly needed !!! ).

 

BTW, feel free to send me the URL of your site for me to take a look on your Advanced Search layout.

 

Best regards,

 

P.

Link to comment
Share on other sites

Say...

 

I was looking at the code in both "advanced_search.php" and "advanced_search_result.php" files... and I guess I should adapt your idea to what I really need.

 

Like PriceFrom and PriceTo, I wish to search for records between user-input values in specific fields... and not really in the products_description.

 

Therefore, I should put something like this (below), right ?

 

(in advanced_search.php) :

 

                 '  <tr>' . "n" .

                '    <td class="fieldKey">' . ENTRY_NEWFIELD1_FROM . '</td>' . "n" .

                '    <td class="fieldValue">' . tep_draw_input_field('field1from') . '</td>' . "n" .

                '  </tr>' . "n" .





                '  <tr>' . "n" .

                '    <td class="fieldKey">' . ENTRY_NEWFIELD1_TO . '</td>' . "n" .

                '    <td class="fieldValue">' . tep_draw_input_field('field1to') . '</td>' . "n" .

                '  </tr>' . "n" .

 

(...and in advanced_search_result.php) :

 

  if ($HTTP_GET_VARS['field1from'] {

   $where_str .= " and p.products_field1 >= " . $field1from . ")"; }



 if ($HTTP_GET_VARS['field1to'] {

   $where_str .= " and p.products_field1 <= " . $field1to . ")"; }

 

 

Does that make any sens to you ?! :shock:

 

Keep in touch,

 

Thx.

 

P.

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...