8

I'm using Drupal Commerce, Search API, and Facets API; I'd like to put the product prices as a facet. Configuring my search API index, I managed to get this facet, but the Search API module doesn't seem capable of handling price ranges facets. This is how the facet looks like.

  • 1230,23
  • 340,21
  • ...

I'd like it to be like the following.

  • From 10 to 100
  • From 100 to 200
  • ...

It seems that there is existing code for handling ranges, but not decimal ranges.

Did I miss something?

1
  • I tried the search_api_ranges module, and it doesn't fit here for two reasons: 1) It only brings a slider (don't need it) and 2) it fails and throws a lot of PHP notices
    – Pierre
    May 16, 2012 at 8:21

2 Answers 2

3

commerce_search_api sounds like exactly like what you're looking for. Be aware of the commerce >= 1.4 dependency as of this writing.

The module includes a product display index (configurable at admin/config/search/search_api/index/product_display):

  • Auto-generated search index that includes all product display node types* and related product data.
  • Auto-generated facets for all node type categories and product attributes.

I've used the price facet filters, with and without the search_api_ranges widget, with great success.

2

This was asked long time ago, but as I have just landed here, let me add another answer - it seems that Facet API Ranges is the module you are looking for:

What it could give you:

how it looks

Configuration options:

configuration options

2
  • 1
    I ended up writing my own facet block rendering function, but I guess this would be solution. Please note that at the time, all of Search API, Facet API were terribly bugguy, and Facet API Ranges existed only in -dev version.
    – Pierre
    Jan 14, 2015 at 12:29
  • Hi Pierre can you please share the source code what you have written. Mar 25, 2020 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.