• Resolved amitramani

    (@amitramani)


    I am trying to add a range slider widget for the price. However, when I add the following code, it does not work. The results show correctly when the page loads, but when I adjust the slider, it says “No Results Found”.

    Here is the code I added in instantsearch.php

    				/* Price Slider Widget */
    				search.addWidget(
    					instantsearch.widgets.rangeSlider({
    					  container: '#facet-price-range-slider',
    					  attributeName: 'price',
    					  min: 100,
    					  max: 1000,
    					  sortBy: ['isRefined:desc', 'count:desc', 'name:asc'],
    					  pips: true,
    					  tooltips: true,
    					  templates: {
    						header: '<h3 class="widgettitle">Price</h3>'
    					  }				  
    				})
    				);

    Please note that I have indexed the ‘price’ field in the ‘wp_posts_products’ index previously. I know it works since it shows up in the Automcomplete drop down results.

    Any ideas?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter amitramani

    (@amitramani)

    Never mind, I figured it out.

    The code in instantsearch (by default) uses the ‘searchable_posts’ index when instantiating instantsearch. However, I had added the ‘price’ field to the wp_posts_product index. So when I added the range slider for the Price, it really did not find the ‘price’ field in the ‘wp_searchable_posts’ index.

    When I change the code to instantiate Instantsearch with ‘wp_posts_product’ instead, it started working fine.

    I would still like to get your advise on this. Is this the right way to implement InstantSearch on WooCommerce? Do you suggest doing it another way?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    You’re probably more in the right than not, at least until I’m told otherwise. We don’t have any official WooCommerce integration with the current state of the plugin. That also means that majority of this is probably more on the InstantSearch.js side of things and getting that playing as nicely as possible.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘InstantSearch How to Add Range Slider for Price’ is closed to new replies.