Developer forum

Forum » Development » Facet template extender

Facet template extender

Anders Ebdrup
Anders Ebdrup
Reply

Hi Dynamicweb,

 

We have a lot of different values for a lot of different facet groups. Will it be possible to have added a "FacetTemplateExtender" where we can isolate all our logic?

 

Best regards, Anders


Replies

 
Nicolai Pedersen
Reply

Hi Anders

Can you explain a bit about what you want to achieve as the end result?

We could easily make you a template extender, but I am not sure it is the best solution (to all issues anyways).

One thing we are looking at is a "value mapper" add in for the facet options. So if you get something from the index named "WhateverID" and that is the only data in the option, you can create a value mapper add in for the source field or source data type, and have it mapped to a human value, i.e. "Whatever label".

BR Nicolai

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Nicolai,

 

We are working on a wine solution and have to handle; wine houses, grape type, "fits to", sweetness and so on (all imported from Perfion), so on the product we do only have the id from the related entities and we need a way to map alle these ids to a human value.

Does it answer your question? :-)

 

Best regards, Anders

 
Nicolai Pedersen
Reply

Yes, that makes sense. Mapping values to a meaningful label...

We just made this concept for DW9's query editor - you get a list of "terms" and you decorate the list with labels in your add in. So you basically create a lot of these. In the AddInName attribute you have the source field from your provider. Could that make sense for your needs?

[AddInName("GroupIDs"), AddInName("ParentGroupIDs"), AddInGroup("Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder, Dynamicweb.Ecommerce")]
public class GroupIDsValueMapper : ValueMapperBase
{

    public override IEnumerable<FieldValueMapping> MapValues(IEnumerable<string> terms)
    {
        dynamic groups = Group.GetGroupsByIDs(terms);

        dynamic mappings = groups.Select(x => new FieldValueMapping {
            Key = x.Id,
            Value = x.Name
        });

        return mappings;
    }
}
 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Nicolai,

 

It seems like that is exactly what we need. Does it match the field based on the "AddInName"?

Our solution is based on 8.9.1 and we are a bit nervous moving the implementation to DW9...

 

Best regards, Anders

 
Nicolai Pedersen
Reply

Yes, it matches the field based on the AddInName which can be added multiple times so the same provider can be reused on fields.

This is currently a feature on DW9 - I'll see if it possible to move to DW8 with little effort.

BR Nicolai

 

You must be logged in to post in the forum