Forum

Thread tagged as: Question

Category Sets and Collections

Hi,

Is it possible to use more than one category set in a collection?

I have a collection of products that'll be filtered by categories and sectors.

A single category set is likely to be quite big, as there are likely to be many subcategories too.

Can I create two category sets, one for categories and one for sectors and use them in a single collection?

Stephen Meehan

Stephen Meehan 4 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you can add as many as you like.

Neat.

So I could filter a collection with category sets, something like this:

perch_collection('products', array(
'category'=> 'solutions/'.perch_get('cat'),
)); 

perch_collection('products', array(
'category'=> 'sectors/'.perch_get('cat'),
));

I imagine the above should work...

What if I needed to filter by two category sets? Would something like this work?

perch_collection('products', array(
'category' => array('solutions/'.perch_get('cat'), 'sectors/'.perch_get('cat')),
)); 
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes - is that not working?