Developer forum

Forum » Swift » Product group facet with hierarcy

Product group facet with hierarcy

Aki Ruuskanen
Aki Ruuskanen
Reply

Hi,

If I would like to create a facet with product groups and wanted the facet to have the same hierarcy as in eCom. What would a good approach be?

I mean a face like here : https://www.systembolaget.se/sortiment/ol/ale/

I was thinking about a ecom navigation that acts like a facet but it would not contain any product count. 

Regards / Aki

 


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Aki,

 

We've done this in the past; not sure if I can find the source code for it, but I can give you the gist of it:

  • You need to have a facet that gives you the list of Group IDs that contain results
  • In the facet templates, you need to have an if statement looking for that special facet system name
  • When you're rendering that facet, you need to render the group navigation instead and then check against the loop of options to determine if there are results. If there are, show the number of results or 0
  • When rendering the group name, you need to render the markup to look like a tree view, but submitting the checkbox as if it was a regular facet option

 

 

Does that make sense?

 

Nuno Aguiar

 
Aki Ruuskanen
Aki Ruuskanen
Reply

Hi,

Thanks for the input. Yes it makes sense. 

I started with the approach to create a groupnavigation that behaves like a facet when clicking the nodes but your way sound better. 

Regards / Aki

 
Aki Ruuskanen
Aki Ruuskanen
Reply

Hi again Nuno,

If you happened to find the code, feel free to send it. And I'll buy you a drink at the next summit. :) 

Regards / Aki

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Aki,

 

No such luck, sorry

 

// Nuno

 

You must be logged in to post in the forum