Forums / General Questions / Is it true? No category search?

Is it true? No category search?

Locked

Views: 3,330

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
4 Dec 2008, 3:58 AM
#1
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Is it true? No category search?

A message for DrByte, Linda McGrath & other Totally Zenners:

Hello all. I have been a zenner for a few years now, and I've recently decided to completely redo my primary website. I have created a new template, and installed everything as it should be. It looks great.

I have 200 categories with 18 products in each one. I have planned the entire time to search ONLY BY CATEGORY. I have no need to search by any product keyword or description: only category name and metatags. (In fact, I won't have product keywords.)

So...I started to add my metatag data and for fun, I did a test and nothing came up. I have been reading on this board for a couple of hours, and it seems the search engine doesn't work on categories. IS THIS REALLY TRUE? EVEN IF I DON'T CARE TO SEARCH ON PRODUCTS?

I am willing to do just about anything here, including, perhaps making some crazy mapping in the DB in an attempt to only search category information. My problem is that I really don't have another option because of the nature of my products, I have to search by category or the results are useless and I NEED IMAGE RESULTS.

DrByte, Linda McGrath, other Totally Zenners? Any ideas? I will hack the h-e-double hockey sticks out of code if I need to.

Thanks for ANY thoughts.

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

4 Dec 2008, 4:10 AM
#2
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Re: Is it true? No category search?

I guess I should add I need the category images to appear in the search result, and NO product images whatsoever.

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

4 Dec 2008, 4:29 AM
#3
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Is it true? No category search?

dmfelder:

I guess I should add I need the category images to appear in the search result, and NO product images whatsoever.
Obviously for most cases ppl need to search products, not categories. Your requirement will require hacking into the search's code and use the category table instead of product table. Not something really hard, but it's not available out of the box.
Also, the code to display result probably will need some changes as well

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

4 Dec 2008, 4:41 AM
#4
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Re: Is it true? No category search?

Well, I did find many comments about people needing to search categories dating back to 2006. That aside, I am willing to do this, but I guess I need a little help.

I would think that searching for the same criteria in a different db table/field should be relatively simple...but I don't know where to start.

Do you know where the search code is written? I don't totally understand the form submit code, but if I know what process/function is doing the search, I can start to reverse-engineer it.

In terms of the results...one step at a time, but again, it's an array of images, so similar logic will apply.

Thanks!

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

4 Dec 2008, 2:04 PM
#5
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Re: Is it true? No category search?

I only want to search Category names and keywords (no need to search Products). My store contains 200 categories, with 18 similar products in each. My customers only want to see the resulting Category images.

The current search function doesn't include categories. I want to ONLY include categories, so I need to point to names and keywords in a different table, and pull images from yet another. If no one knows how, can someone tell me where the function is so I can try to modify it?

I'm in a world of trouble if I cannot solve this. I have spent weeks developing my cart, only to hit a snag this late in the game. Everything else is great.

Thanks!

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

4 Dec 2008, 2:36 PM
#6
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,684
Plugin Contributions:
0

Re: Is it true? No category search?

Moderator's note: Duplicate question/post merged into this thread.

One thread per topic is plenty.

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

6 Dec 2008, 1:31 AM
#7
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Re: Is it true? No category search?

Any more thoughts on this? It kind of died. I want to only search CATEGORY title, keywords, and description. I do not care about product information.

I HAVE successfully changed the search function to look into the categories_description and meta_tag_categories table, but how do I present the results on a page?

This shouldn't be too hard, I just have no idea...

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

28 Dec 2008, 7:48 PM
#8
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Re: Is it true? No category search?

To close this thread out...

I solved this by changing the SQL in the advanced_search_result/header_php.php file. It was actually pretty easy. I just needed to define/add the category meta_tags table to the query and search within it.

Anyway, it was completely done within that file.

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

29 Dec 2008, 4:30 PM
#9
yenmax avatar

yenmax

New Zenner

Join Date:
Sep 2006
Posts:
89
Plugin Contributions:
0

Re: Is it true? No category search?

Hi, dmfelder

Would you please teach me how to change the file. Which file name and code to add on. Thanks

31 Dec 2008, 2:51 PM
#10
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Re: Is it true? No category search?

Sure,

Locate the includes/modules/pages/advanced_search_result/header_php.php file.

Scroll to roughly line 200 where you define the SQL "FROM" string, and add a couple the relevant tables. In my case, I added zen_meta_tags_categories_description cd & zen_categories_description dc.

The join properties must be modified to associate the new tables, so go to around line 225 (WHERE string) and make sure you define the relationship. In my case:

$where_str = " WHERE (c.categories_status = 1
AND p.products_id = pd.products_id
AND pd.language_id = :languagesID
AND p.products_id = p2c.products_id
AND p2c.categories_id = c.categories_id
AND c.categories_id = cd.categories_id
AND c.categories_id = dc.categories_id

At this point, all you have left is to define the CONDITIONS. Somewhere around line 275-285, you'll find the clauses. In my case, I modified it to read:

$where_str .= "(cd.metatags_description LIKE '%:keywords%' OR cd.metatags_keywords LIKE '%:keywords%'
OR dc.categories_name LIKE '%:keywords%'
OR cd.metatags_title LIKE '%:keywords%'";

That should give you the results you need. They will be displayed as though you were searching products.

If you wait until around 1/15/09, you'll see it in action at our funny tee store, www.gafy.com.

The current GAFY.com site, btw, also uses ZenCart, but only as a back-end, which has detrimentally impacted the search feature. I was asked by another Zenner to describe how I did that. The details are here: http://www.zen-cart.com/forum/showthread.php?p=650850

Good luck!

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

5 Feb 2009, 7:11 PM
#11
quickinks avatar

quickinks

New Zenner

Join Date:
Jan 2009
Location:
Falkirk-Scotland
Posts:
58
Plugin Contributions:
0

Re: Is it true? No category search?

Hi,

This sounds like exactly what I need but just want to see if you can confirm if the changes you listed above are what I need to make if I want Search to search product names and my cat names please?

Any help you can offer would be really appreciated as this is exactly what I need for my site.

Thanks in advance for any help you can offer.

Cheers,

John

6 Feb 2009, 6:14 PM
#12
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Re: Is it true? No category search?

I think the answer to your question is yes. The SQL posted ties the product tables to the category tables. Then you just need to pull whatever variables you want in the SELECT clause.

First...MAKE SURE YOU BACK UP!! This can royally screw you if you don't know that much about databases.

I phased out the entire metatag function (and the metatag tables) and looked only at Category Names and Descriptions. You could keep the metatags in if you want, but it wasn't a part of my model.

So, tie together like I detailed, and add/subtract whatever you need to get the appropriate results.

FYI, in an earlier posting, I mentioned to check out www.gafy.com to see it in action. The NEW site is complete, put not yet published. You can see how it works at gafy.com /newweb.

As an FYI, the /newweb site only searches category names & descriptions, and a new field I created in the table called search_keywords. (It's different from SEO keywords in the page metatags.)

Good luck.

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

6 Feb 2009, 10:39 PM
#13
quickinks avatar

quickinks

New Zenner

Join Date:
Jan 2009
Location:
Falkirk-Scotland
Posts:
58
Plugin Contributions:
0

Re: Is it true? No category search?

Thanks for taking the time to post this info. I`ll see if I can get tit to make sense to me and see what ahppens.

Thanks again-much appreciated.

John

7 Feb 2009, 5:33 AM
#14
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Re: Is it true? No category search?

It's really not that difficult, even if you don't know SQL, but just be sure to back stuff up. (I typically make a copy of the file I'm working on and then change the extension from .php to .zphp.)

Now, just look at the overall SQL structure and you should be in good shape. It breaks down into a few segments

SELECT: grab the data I need. Note that a SELECT query doesn't change any data; it just reports it. In other words, you can screw up a SELECT query and you won't screw up your data. (SELECT zen_categories_description.categories_id)

FROM: defines the tables that contain the data for which you're searching. Also, ZEN seems to always use aliases. 'zen_cateories_descriptions zcd' allows you to use zcd.categories_id INSTEAD OF zen_categories_descriptions.categories_id.

WHERE: this defines the relationships and conditions. (This is how you relate one table to another.) A=B, B=C, C=D, etc. AND quantity=1000 AND product_id=1234 AND keyword='myspecialkeyword' etc.

Enjoy! It's another world once you learn how to use DBs!

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

11 May 2009, 2:16 PM
#15
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Re: Is it true? No category search?

dmfelder:

The SQL posted ties the product tables to the category tables. Then you just need to pull whatever variables you want in the SELECT clause.

I have sort of given up on the idea but when I was trying to do this I could not find the SQL patch you refered to, and got errors when I changed my header_php.php with out doing anything else

20 Aug 2009, 8:52 PM
#16
chefouvi avatar

chefouvi

New Zenner

Join Date:
Dec 2008
Posts:
15
Plugin Contributions:
0

Re: Is it true? No category search?

Hi DmFelder,
You have a great idea here.
I was trying to follow in your footsteps but screw up the header.php file for Advanced search. My line numbers do not correspond to yours.
Could you please post more details information about the lines to modify? Or better yet a copy of your advanced search header.php file?
I appreciate any help you can give.

Thanks a lot for a great idea.