0

I'm trying to implement a free-range price slider in Hybris 1811. However, I got stuck when trying to find any useful resources on this subject.

I've found that the basic price facet is only able to search based on price ranges which are stored in strings, so I cannot make any useful slider out of that.

I also found that the actual price (double), not the range, is contained in the priceValue field. However, when I tried to enable this field as a facet in Backoffice, it's never treated as such and never appears as a facet even in the code, let alone in the faceted search in product page.

Can you recommend any sources or provide any tips on how to go about implementing this feature?

fugasjunior
  • 461
  • 1
  • 6
  • 22

1 Answers1

2

We achieved similar object sometime back as follows

1) Make sure that price values are indexed in the solr index for each product/variant

2) Create a custom ajax based component to provide front end view and accept price inputs as a slider value

3) Use solr query post processor to change your solr query before it is fired to Solr server. Here instead of using facet, use it as a simple search query. Take the handle of the solrSearchQuery and append price field values

public class SimpleSolrQueryPostProcessor implements SolrQueryPostProcessor
{
    @Override
    SolrQuery process(final SolrQuery query, final SearchQuery solrSearchQuery)
    {
        query.setSortField("id", ORDER.asc);
        query.setStart(Integer.valueOf(0));
        query.setRows(Integer.valueOf(10));
    }
}

For more details, refer to SAP documentation on https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/1905/en-US/8bb1b4bf866910149a8593d8e78aacaa.html?q=solr%20query

Hope it helps!

www.hybriscx.com
  • 1,129
  • 4
  • 22