Forums / Templates, Stylesheets, Page Layout / Search functions help..

Search functions help..

Locked

Views: 3,427

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
5 Dec 2007, 6:01 PM
#1
allister avatar

allister

New Zenner

Join Date:
Nov 2007
Posts:
9
Plugin Contributions:
0

Search functions help..

I added quite a few product description categories for my client. They have a rug store and needed an easier way to add product info than through attributes.
You can see the new descriptions here:
http://www.artforthemasses.us/FineDesign/ZCstore/index.php?main_page=product_info&cPath=66&products_id=192

Anyway, the thing I am looking to do is get the search functions to look at these new description items in the database. I can't seem to get what I need to change. I added this to the header_php.php under the advance search module and have found how to add the search parameters to the advanced search template, but that is where I have gotten stuck..

  $sData['products_origin'] = (isset($_GET['products_origin']) ? zen_output_string($_GET['products_origin']) : 0);
  $sData['products_make'] = (isset($_GET['products_make']) ? zen_output_string($_GET['products_make']) : 0);
  $sData['products_design'] = (isset($_GET['products_design']) ? zen_output_string($_GET['products_design']) : 0);

What do I need to alter to search the DB in the new columns.

Any help would be greatly appreciated..

Thanks,
Alli

5 Dec 2007, 7:02 PM
#2
allister avatar

allister

New Zenner

Join Date:
Nov 2007
Posts:
9
Plugin Contributions:
0

Re: Search functions help..

Does it have something to do with the advanced search result module?

5 Dec 2007, 7:43 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Search functions help..

You'll have to rewrite the logic in the /includes/index_filters files.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

5 Dec 2007, 7:57 PM
#4
allister avatar

allister

New Zenner

Join Date:
Nov 2007
Posts:
9
Plugin Contributions:
0

Re: Search functions help..

Thank You Much, I am burying my nose in it as you are reading this..

6 Dec 2007, 9:57 PM
#5
allister avatar

allister

New Zenner

Join Date:
Nov 2007
Posts:
9
Plugin Contributions:
0

Re: Search functions help..

OK, I've been adding the new columns to the queries I found in default_filter.php, for example:

// We are asked to show only a specific category
      $listing_sql = "select " . $select_column_list . " p.products_id, p.products_type, p.manufacturers_id, p.products_origin, p.products_make, p.products_design, p.products_price, p.products_tax_class_id, pd.products_description, if(s.status = 1, s.specials_new_products_price, NULL) AS specials_new_products_price, IF(s.status = 1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
       from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id , " .
       TABLE_PRODUCTS_DESCRIPTION . " pd, " .
       TABLE_MANUFACTURERS . " m, " .
       TABLE_PRODUCTS_TO_CATEGORIES . " p2c
       where p.products_status = 1
         and p.manufacturers_id = m.manufacturers_id
         and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "'
         and p.products_id = p2c.products_id
         and pd.products_id = p2c.products_id
         and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
         and p2c.categories_id = '" . (int)$_GET['filter_id'] . "'" .
         $alpha_sort;

To no avail.

I can't get it to look in those columns and spit out results.
I think maybe I need some guidance on this one.

What needs to be rewritten and how would it be rewritten?

Please help..

Thanks in advance,
Alli

7 Dec 2007, 5:55 PM
#6
allister avatar

allister

New Zenner

Join Date:
Nov 2007
Posts:
9
Plugin Contributions:
0

Re: Search functions help..

Are you sure it isn't in the Advanced search results module?

As I look at it, it seems to be the only page running comparisons of keywords.

7 Dec 2007, 6:11 PM
#7
allister avatar

allister

New Zenner

Join Date:
Nov 2007
Posts:
9
Plugin Contributions:
0

Re: Search functions help..

Or is it a combination?

7 Dec 2007, 8:27 PM
#8
allister avatar

allister

New Zenner

Join Date:
Nov 2007
Posts:
9
Plugin Contributions:
0

Re: Search functions help..

How about this, could I include the new parameters in the metatags?
Since the search already reads the meta tags.

Come on guys and gals, help a brother out here..

Thanks,
don

8 Dec 2007, 7:03 PM
#9
allister avatar

allister

New Zenner

Join Date:
Nov 2007
Posts:
9
Plugin Contributions:
0

Re: Search functions help..

Sigh, oh well, thanks for the tidbit..

1 Mar 2008, 6:55 AM
#10
molywerks avatar

molywerks

Zen Follower

Join Date:
Aug 2006
Posts:
136
Plugin Contributions:
0

Re: Search functions help..

Allister,

I only edited two files to get my search to go into my products table and scan the extra fields I added and return results. The instructions below may be too exacting, but they work. And I won't be bothering with cleaning up unnecessary codes for several weeks.

Anyway, here is what I did:

PART ONE

  1. OPEN includes\index_filters\default_filter.php
  2. SEARCH for $listing_sql = "select " . $select_column_list . "
  3. INSERT your new table fields [Note: I am not sure this is necessary or not either, but I inserted my fields in the same exact order as they appear in my products table. Since all my fields were tacked on at the end, I placed my fields AFTER p.products_tax_class_id, and BEFORE pd.products_description, if (ignoring the backticks of course).]
  4. Repeat steps 2 and 3 three more times.

PART TWO

  1. OPEN includes\modules\pages\advanced_search_result\header_php.php
  2. SEARCH twice for LIKE '%:keywords%'.
  3. INSERT AFTER OR details_model_name\nLIKE '%:keywords%' and BEFORE OR m.manufacturers_name\nLIKE '%:keywords%'"; your information in the same OR p.yourfield\nLIKE '%:keywords%'.

Hope this helps!

20 Jun 2010, 6:01 PM
#11
dropbop avatar

dropbop

Zen Follower

Join Date:
Apr 2008
Location:
Athlone, Ireland
Posts:
177
Plugin Contributions:
1

Re: Search functions help..

molywerks:

Allister,

I only edited two files to get my search to go into my products table and scan the extra fields I added and return results. The instructions below may be too exacting, but they work. And I won't be bothering with cleaning up unnecessary codes for several weeks.

Anyway, here is what I did:

PART ONE

  1. OPEN includes\index_filters\default_filter.php
  2. SEARCH for $listing_sql = "select " . $select_column_list . "
  3. INSERT your new table fields [Note: I am not sure this is necessary or not either, but I inserted my fields in the same exact order as they appear in my products table. Since all my fields were tacked on at the end, I placed my fields AFTER p.products_tax_class_id, and BEFORE pd.products_description, if (ignoring the backticks of course).]
  4. Repeat steps 2 and 3 three more times.

PART TWO

  1. OPEN includes\modules\pages\advanced_search_result\header_php.php
  2. SEARCH twice for LIKE '%:keywords%'.
  3. INSERT AFTER OR details_model_name\nLIKE '%:keywords%' and BEFORE OR m.manufacturers_name\nLIKE '%:keywords%'"; your information in the same OR p.yourfield\nLIKE '%:keywords%'.

Hope this helps!

I know its an old tread, but I have been searching everywhere for a way to make my new fields searchable.

Its spot on, works like a charm and very easy to do. I have just made all my new fields searchable.

I have also seen many other people looking for the same fix, so I hope bumping this post will help other to find it quicker