Developer forum

Forum » Ecommerce - Standard features » Create an AND rule for applying facets

Create an AND rule for applying facets

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

The title of the post may not be very clear about what I am trying to achieve and there may be at least another post on the same request (but I could not find it).

On short, I have a situation where we need to create a facet on a Multi-select field on the product.

The Multi-select field allows (as the name says) the selection of multiple options for the same field.

The facet, however, will list all individual options for that field.

For example, the field could have the following options: Metal, Plastic, Glass.

Product One has Metal selected. Product 2 has Metal and Plastic, Product 3 has Metal and Glass.

The facet will obviously list Metal, Plastic and Glass.

What I am looking for is a method of filtering on the combination of elements if there is more than one value (Match All) but also on the individual value if there is only one (Match Any). If someone selects Metal and Glass, I want to display only Product 3. If it selects Metal, I want to show all 3 products.

My take on this request it's that it cannot be supported. but just to make sure, I am trying to figure out if there is a solution tested by somebody else.

Thank you,

Adrian

 


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Adrian,

 

The "Match all" is what you need, but you need to ensure that:

  • The query parameter is a String[] (string array)
  • The field is also a String[] (string array) - that should be covered, since the UI would not allow you to choose "MatchAll" if it weren't an array

 

The concept is that you want products that match all of the selected options.

 

Best Regards,

Nuno Aguiar

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nuno,

Thank you very much for the reply.

Of course "Match All" would solve my problem. I am not sure how I have missed the logic.

Thank you very much for clarifying it to me.

Adrian

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Happens to everybody. You are welcome :)

 

You must be logged in to post in the forum