Developer forum

Forum » Ecommerce - Standard features » New index comma facet (pre-selection)

New index comma facet (pre-selection)

António Ramos
Reply

Hi guys,

We have a list facet that one option have a comma value. When rendering in the front-end and the facet is in the query the facet will not be pre-seletected. The facets option without commas work fine.

See screencast: http://screencast.com/t/Ct06osZG02ce

Best regards,


Replies

 
Nicolai Høeg Pedersen
Reply

You cannot have comma in the value for facets - comma is handled as arrays in the implementation, so you need to use another value.

 
António Ramos
Reply

Hi Nicolai,

Thanks for your answer. We actually cannot simply change these values because this is a migration from an existing website and it integration with AX (with already data imported). 

Do you know any other possible workaround for this?

Thanks in advance.

Best regards,

António Ramos

 
Nicolai Høeg Pedersen
Reply

Not currently. I have a backlog item that we should give an alternative for this scenario - there was another thread on this matter some weeks ago.

You can run a SQL during/after the import that will copy the data to another column and make a conversion when doing that.

Alternatively you can create an extender to the indexer that will manipulate the data when going into the index:

namespace Dynamicweb.Examples.CSharp
{
    class IndexBuilderExtenderExample : Indexing.IndexBuilderExtenderBase<Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder>
    {
        public override void ExtendDocument(IndexDocument document)
        {
            if (document.ContainsKey("ID"))
            {
                string productid = (string)document["ID"];
            }
            
            document.Add("CustomField", DateTime.Now);
        }
    }
}

 
António Ramos
Reply

For future reference we workaround the pre-selection problem in the front-end by verifying all the keywords from XX parameter (facet) in the facet options.

BR,

António Ramos

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Nicolai,

 

Have you been able to implement a solution for commas in the facet handling?

 

Best regards, Anders

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Anders

Try this format: [12,23][456,67][etc,someother]

I think that if you have brackets in the parameter value, that will be used as array seperator instead.

BR nIoclia

Votes for this answer: 1
 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Nicolai,

 

Thank you so much!!! It works like a charm! :-)

 

You must be logged in to post in the forum