emizentech / magento2-price-slider

Price Slider for Category Page:Magento2
20 stars 33 forks source link

Option to add a submit button #13

Closed onepack closed 7 years ago

onepack commented 7 years ago

A customer needs to reload the page 2 times to get for instance 250 - 500. Separating the slide from the direct submit would be a enhancement in my opinion.

onepack commented 7 years ago

Fixed it myself. First remove the Change section altogether. Then put this under like this: ` $( "#amount" ).val( "<?=$currencySymbol?> " + $( "#price-slider" ).slider( "values", 0 ) + " - <?=$currencySymbol?> " + $( "#price-slider" ).slider( "values", 1 ) );

$("#button-slider").click(function(){

    var minPrice = $("div#price-slider").slider("option", "values")[0];
    var maxPrice = $("div#price-slider").slider("option", "values")[1];
    return window.location.href = price_url+minPrice+"-"+maxPrice;

// alert ([minPrice,maxPrice]); });`

It makes it more usable (for mobile users) and prevents page reloads.