Developer forum

Forum » CMS - Standard features » Facet name and label

Facet name and label

Thomas Schroll
Reply

Hi

I have setup a facet that gets options from an item field of type 'Checkbox list'. The options are visible frontend, and everything seems to be working. The only problem is that FacetOption.Name, FacetOption.Value and FacetOption.Label is the same. In the checkbox list the label is a nice product name (with spaces) and the value is an abbreviation (without spaces). When the name, value and label in the facet all gets the options from the value field of the checkbox list, I can choose to manual hardcode the options in the template (not use facets), use the abbreviation or show the option with spaces substituted by '+' (which probably are going to cause trouble in the serch results).

Does anybody know how to get the label option from the checkbox label field and the name or value from the checkbox value field?

Regards Thomas


Replies

 
Nicolai Pedersen
Reply

Hi Thomas

Not sure I understand the + thing you write about.

But currently it is not possible to show the labels for the checkbox. Only the values are indexed, and there is no mapping back to the field label when using the query publisher. I think for now the best solution is to code something in the template that can lookup the right label. The longer term solution is that Dynamicweb should also index the labels so they can be used directly as a facet.

Sorry about the inconvenience...

BR Nicolai

 
Thomas Schroll
Reply

Thanks Nicolai

I also tried to setup a list facet. I couldn't find any documentation about what a list facet is, so I hoped it would mean a facet where I manually wrote in the Name/value pairs and then used those values in the querystring, but again the FacetOption.Name and FacetOption.Label were the same. Is it because I am using it wrong or have I misinterpreted the functionality of facet lists?

Regards Thomas

 
Nicolai Pedersen
Reply

Hi Thomas

Hm, that is strange - the list facets are found in the docs regarding the index: http://doc.dynamicweb.com/documentation-9/platform/indexing-search/indexing-search#2472

But, yes you should be able to use list facets - you just have to define one for each facet you want.

BR Nicolai

 
Nuno Aguiar
Reply

Hi Nicolai,

 

Could it be that Thomas was looking for some UI resolution to the ValueMapper feature in DW9? http://doc.dynamicweb.com/forum/development/development/facet-template-extender

 

I can relate to the problem as well and we addressed it with in a Razor template to get the mappings.

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen
Reply

Hi Nuno

It might be that is what he want. But I also have a suspicion that you are doing something odd.

Because, as discussed in other threads, you already have the label for ANYTHING that comes out of Dynamicweb by standard. So if you have a custom productfield of type checkbox list, you get the values AND the labels when facets are rendered. See dumps.

It is only if you have custom indexing code or you have custom fields with some weird stuff in them without any labels in Dynamicweb, that these mappings makes sense.

From the dumps you can see that a facet option has a Value, Name and a Label - could it be you are using only Value and Name when rendering and forget about the Label?

BR Nicolai

Capture.PNG Capture1.PNG Capture2.PNG
 
Thomas Schroll
Reply

Thanks guys

I don't understand the concet of 'value mapper', so I can't say if that is what I mean. Nicolai, I also don't understand when you write that 'it is not possible to show the labels for the checkbox' and 'you already have the label for ANYTHING that comes out of Dynamicweb by standard'. It seems contradictory. Is it only ecom field labels that are available and not item field labels?

I'll try to describe my setup in detail, and maybe you can see where it goes wrong:

I have an item with a field of type checkbox list (see file-item.png). The checkbox list has a pretty label and an abbreviated value. I have setup the index with a free tet field and 2 fields from the checkbox list (see index.png). The query has 3 parameters (1 free text and 2 corresponding to the checkbox list - see query.png).

Right now I have the facets set up with one field facet and one list facet (see facet.png and list-facet.png). No matter how I set up the facets (field, list or term facet), the result is the same (see frontend.png). Only the values from the checkbox shows up frontend.

The item is in a content folder and shown in the module query publisher. I have tried to use purge=true in the address line and I have updated the index after every change.

I cannot use the value as label frontend, I would prefer not to hard code the labels (or checkboxes) in the template.

Can you see if I am doing anything wrong or if what I need is currently impossible?

Regards Thomas

facet.png file-item.png frontend.png index.png list-facet.png query.png
 
Nicolai Pedersen
Reply

Hi Thomas

Yes, Ecommerce labels comes out. Item labels does not. Sorry for the lack of precision in that one.

A simple way to solve this is to add a @Translate(Option.Value) in your facet template (query publisher template inside the facetoptions loop). Then you can use the translation module to translate from the core values to readable labels.

BR Nicolai

 
Thomas Schroll
Reply

Thanks, I'll use the the Translate solution, and hope the labels are accesible soon ;)

Regards Thomas

 
Harald Brouwers
Reply

Hi Nicolai,

I'm running into the same problem as Thomas described earlier:

"The only problem is that FacetOption.Name, FacetOption.Value and FacetOption.Label is the same."

The DW version we are using is 8.9.1.6.

Can you tell me if this issue will be addressed in a upcoming DW 8.9 release?

Greetings Harald

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

I believe this is the same as my feature request here: http://doc.dynamicweb.com/forum/feature-requests/new-index-list-type-facets?PID=1605

Adrian

 
Nicolai Pedersen
Reply

Hi Harald

Using it for products or items?

BR Nicolai

 
Harald Brouwers
Reply

Hi Nicolai,

I'm using it for products. To be more precise, I'm using the facet filtering on Product Category fields.

Greetings Harald

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Harald

Ok, product category fields of type listbox has this issue - I can see that.

I will create a backlog to get that fixed.

BR Nicolai

Votes for this answer: 1
 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

I am trying to implement List Facets. I have followed the steps described in the documentations (and illustrated in your screen dumps) but I don't see the Labels rendered.

I have posted a few screendumps to illustrate the problem. I am using 9.2.14.

Thanks,
Adrian

ListFacets-output.png ListFacets-Setup.png
 
Jacob Storgaard Jensen
Reply

Ok, we're now writing late november 2018 and I just tried to use the QueryPublisher (DW 9.5.3) to show some facets, and facet options... But my FacetOption.Value and FacetOption.Label still have the same value (the one from FacetOption.Value that is)...

Is this intended behaviour or a bug that has returned? (seems to be the same as here: https://doc.dynamicweb.com/forum/ecommerce-standard-features/ecommerce-standard-features/wrong-option-name-from-facetoptions)

 
Nicolai Pedersen
Reply

Hi Jacob

The QueryPublisher does not support the value/label mappers and therefore you get the raw data out of the index. It requires Ecommerce context in order to run, and that only exists in the Ecommerce catalog app...

I know it is a technical and boring explanation. But the query publisher can only show stored data directly from index.

BR Nicolai

 
Jacob Storgaard Jensen
Reply

Hi Nicolai,

Ok, then I'll just have to go with the @Translate workaround you wrote about earlier...

But is this something which is planned to be introduced later on?

 
Nicolai Pedersen
Reply

I do not think we will do that in the querypublisher. It is meant to render whatever is in the index.

 
Jacob Storgaard Jensen
Reply

Ok, roger that :-)

 
Jacob Storgaard Jensen
Reply

But... a small feature request... a feed template for the QueryPublisher, just as the one you have on the eCom Catalog app... Just to avoid having all these hidden ajax-pages ;-)

Moved - or copied to a new post :-D Sorry, got caught up :-D

 

You must be logged in to post in the forum