Developer forum

Forum » Ecommerce - Standard features » Product groups as facets

Product groups as facets

Søren Jakobsen
Reply

Hi,

I'm working on product groups as facets. I'm trying to setup a facet that could be used as filters for product groups from third level and down (first two level is in a megamenu). I have tried to used the "Third level groups" as field on the facet. This field renders the groupid as facet value. Selecting a facet will result in a empty page.

url: https://staging.avn.dk/teknik and select webshop

Any ideas or suggestions on how to implement groups as facets?

2021-01-22_10_55_06-Window.png

Replies

 
Nicolai Pedersen
Reply

The field you have defined (group_facet) is a string field. It has to be a string[] - an array. 

You combine it with a IN statement which will also mean that all selected facet values has to be matched - you should change it to MATCH ANY

 
Nay Chi Phyo Dynamicweb Employee
Nay Chi Phyo
Reply

Hi Nicolai, 

I have configured the Product subgroups as facet filters in the frontend. The problem is when the product has a Related product group > sub-category, it also appears in the frontend filter field. I don't want to include that related sub-category under the main product page. 

Please see my attached files to be clear;

In the backend, I only have 8 subcategories under Babies group,  but in the frontend, it is 10. The related sub-category also appeared under the main product page even it is not under the Babies group. 

If there have any solution, could you please let me know? We really need to solve it asap. 

Thanks and Regards,

Nay Chi

 

catBE.PNG catFE.PNG subgroup.PNG
 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nay Chi,

 

You need to customize this then. What you're trying to achieve is a mix of EcomNavigation with Facet Options.

 

Here's what I recommend you do:

  • Create a new Render Type for Facets
    • This is just to make it easier for you to customize it
    • i.e. call it EcomNavigation
  • In the templates, when it's of type Ecom Navigation, you actually render the Ecom Navigation (OR using the API you get the topLevel groups)
    • At this point you can use LINQ to only render the groups you have facet options for
      this means that you'll not traverse through EcomGroups you won't have results for
  • Then you check the subgroups and filter out the options the same way

 

The Query expression will be the same, but the the way lucene documents and facets work will always give you all of those groups, so you will never get the group tree context, that's why you need to customize it.

 

 

Hope this makes sense.

 

Best Regards,

Nuno Aguiar

 

You must be logged in to post in the forum