Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Display products in intersection of 2 categories?

Display products in intersection of 2 categories?

Locked

Views: 1,222

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
15 Jan 2008, 12:44 PM
#1
lbowenc avatar

lbowenc

New Zenner

Join Date:
Jan 2004
Posts:
38
Plugin Contributions:
1

Display products in intersection of 2 categories?

I would like to display all the products that belong to 2 categories, ie, the intersection of products belonging to both categories. Is there a way to do this?

Thanks,

Lucy Caldwell

15 Jan 2008, 12:49 PM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Display products in intersection of 2 categories?

There is no code in Zen Cart to do this, but plenty of code that could be used as an example for writing and displaying your own database extract. However, as you haven't indicated where or how you would want to display this intersection, it's not possible to be more specific.

15 Jan 2008, 12:51 PM
#3
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Display products in intersection of 2 categories?

If I understand your want correctly admin > catalog > select category > select blue circle with "C" in it > copy as link to another category

Edit: I might have understood what you seek incorrectly??

15 Jan 2008, 3:16 PM
#4
lbowenc avatar

lbowenc

New Zenner

Join Date:
Jan 2004
Posts:
38
Plugin Contributions:
1

Re: Display products in intersection of 2 categories?

Sorry, I will be more specific. For instance, two of my categories are face cream AND organic. I want to display on a product page only my products that are both face cream AND organic. I don't want to display all face cream and all organic. I know I can have a product linked to multiple categories so it will show up in multiple categories, but I'm not sure how to search on and display products that are in BOTH of those categories...Lucy

16 Jan 2008, 7:18 AM
#5
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Display products in intersection of 2 categories?

I don't want to display all face cream and all organic. I know I can have a product linked to multiple categories so it will show up in multiple categories, but I'm not sure how to search on and display products that are in BOTH of those categories
Still confused as to what you seek???

How is one item in both categories?

If you are only trying to get certian items from a search - then tailor your description to include both terms i.e. organic face cream in the description

16 Jan 2008, 10:27 AM
#6
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Display products in intersection of 2 categories?

There is a table that maps products to categories so if you category 1 was face cream and category 2 was organics, the following sql statement would give you a list of products in both> select p2c1.products_id from products_to_categories p2c1

left join products_to_categories p2c2 on p2c1.products_id = p2c2.products_id
where p2c1.categories_id = 10 and p2c2.categories_id = 22However, that's a long way short of being a complete answer, as you would need to flesh that out to retrieve all the data that you wish to save, prepare it for display on a page, generate the HTML into which it will be inserted and finally integrate that with your Zen Cart.

In the current version of Zen Cart, it's a lot of programming, but there is a ton of example code that could be copied, depending upon where and how you wished to display these products.

2 Aug 2010, 8:45 AM
#7
kolobok avatar

kolobok

New Zenner

Join Date:
Aug 2010
Posts:
1
Plugin Contributions:
0

Re: Display products in intersection of 2 categories?

kuroi, thank you for your tip.

Lucy, I'm implementing now "categories intersection" feature. Do you still need this feature?

2 Aug 2010, 1:22 PM
#8
lbowenc avatar

lbowenc

New Zenner

Join Date:
Jan 2004
Posts:
38
Plugin Contributions:
1

Re: Display products in intersection of 2 categories?

No ... I don't remember exactly what we ended up doing, but are happy with what we have. Thanks for asking, though.

Lucy