Developer forum

Forum » Rapido » Product categories - values from reference category as facet option

Product categories - values from reference category as facet option

Mikkel Hornbech Nielsen
Reply

Hi there DW.

I am trying to setup a facet option for a product field that belongs to a product category which is a reference category.
Is this possible and how exactly?

I have setup the Products.query to take the value from the product category like so:

But its not being rendered correctly in the frontend.
It shows up on ecom groups/productlist which doesent have this product field as a value on product level.

Am i missing something or is just not possible?
The soloution is hin.stagingsite.dk if you want to try some stuff out.

So to recap, i need to show filter/facet options based on a product reference category, which holds a specific product field and its values.

Product category settings:


Hoping that you guys can help me out.


Replies

 
Mikkel Hornbech Nielsen
Reply

Did you guys see this?

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Mikkel,

I have used this approach before, in one of our projects.

You have to set the Facet and Query expression to use the Reference field and not the ProductCategory field.

At least that's how it works in my project.

I hope this helps.

Adrian

 
Mikkel Hornbech Nielsen
Reply

Hi Adrian.

Yeah i saw your post, and followed that without any success, so to be honest i am not quite sure where to go from here.
The main problem is that we have a bunch of product fields, where the reference field would be ideal for using as a facet field.

But i am able to do that?
And how so exactly?

Thanks in advance.

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Mikkel,
Here is a short video with how I usually do it: https://www.screencast.com/t/730hqJsK3V

Please make sure you reindex after you make changes to the Query or Facets. I can't explain why, but I have noticed that sometimes the Reference based facets are not rendering correctly after making changes to the Query or the Facet.

I hope this helps.

Adrian

 
Mikkel Hornbech Nielsen
Reply

Hi Adrian.

I have followed your screencast and done all of the steps that you have.
And all of the different filtering options is shown in the productlist (the ones with a reference field).
But its only some of the filtering options that work.
Its like its only the ones that actually holds the data on the product.

Pr instance - this product has a value in "Chemistry/Kemi" in the backend:

 



You can see the example on our staging site:
https://hin.stagingsite.dk/da/produkter/el-teknik/forbrugsmaterialer/batterier

 
Mikkel Hornbech Nielsen
Reply

Hi again.

I forgot to mention that you pick the optionunder "L-AUS" it doesnt work correctly for some reason.
It attaches the query parametre to the URL, but because (at least that is my theory) that none of the products has data related to the L-AUS product field, then the filtering doesnt filter out any products.

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Mikkel,

I believe that the facets that are supposed to handle Yes/No options will have to be defined differently than regular fields.

From what I see, the system does not seem to "understand" the parameters LAUSRefrenceField and ESDReferenceField. 

I don't have an easy/simple answer to this issue but it seems like a configuration issue.

If you send me some credentials for the back-end, I can try and have a look at it.


Adrian

 
Mikkel Hornbech Nielsen
Reply

Hi again Adrian.

You mentioned that "boolean" (yes/no) options needed to be handled differently than regular fields, what exactly did you mean by that, and how would they be needed to setup in the backend?
Its because right now we have 3 facet options which is defined as system.boolean, and is showing up in productlists where they dont belong.

So we have "L-AUS, ESD, Lim og Lejesikringstype" which are the 3 booleans, which arent inherited to the specific ecom group (Batteries) by the product category field.
How is this possible???


You should be able to login to the solution using the "Angel" login that you guys have.

The url for the page with the faulty booleans:
http://hin.stagingsite.dk/da/produkter/batterier-og-lys/batterier

And the backend login:
http://hin.stagingsite.dk/admin

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Mikkel,

The boolean fields will always be False by default. That's why they will show up.

I will see if I can access your solution as I am not official Dynamicweb Support :)

Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Mikkel,

I don't think that the special configuration of the boolean would work for reference fields.

My best bet would be to use list-box field with Yes and No options instead of a boolean.
This way the options will be explicit on the product or null if nothing is set. The boolean will always be false regardless of the References it points to.

And creating a Range field based on the current boolean field might not work since it is a Reference field. For regular fields, it may work but I have not tried it on a Reference field.

Adrian

 

You must be logged in to post in the forum