Skip Navigation

[Résolu] Price range slider and fields

This support ticket is created Il y a 7 années. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Ce sujet contient 4 réponses, a 2 voix.

Dernière mise à jour par toolset-dave Il y a 7 années.

Assisté par: Luo Yang.

Auteur
Publications
#596383

Hi,

I continue from https://toolset.com/forums/topic/price-range-slider/.

I have a price range slider, but I still cannot connect it with fields for price:

<div class="form-group">
	<label>Cena od</label>
	[wpv-control field="wpcf-cena" url_param="wpv-wpcf-cena-min" type="textfield"]
</div>
<div class="form-group">
	<label>Cena do</label>
	[wpv-control field="wpcf-cena" url_param="wpv-wpcf-cena-max" type="textfield"]
</div>

See lien caché

Slider code:

<input id="cenovy-rozsah" data-slider-id="muj-slider" type="text" value="" data-slider-tooltip="hide" data-slider-min="0" data-slider-max="[wpv-view name="nejvyssi-cena-kurzu"]" data-slider-step="100" data-slider-value="[0,[wpv-view name="nejvyssi-cena-kurzu"]]">

jQuery:

$("#cenovy-rozsah").on("slide", function(slideEvt4) {
	$('#wpv-wpcf-cena-min').val(slideEvt4.value[0]);
    $('#wpv-wpcf-cena-max').val(slideEvt4.value[1]);
});

I have set it up to work with AJAX and it also work with text inputs for testing purposes, but not with price max and min fields.

#596631

Dear Dave,

It is a custom codes problem, you will need to use the "range slider" to update the value of text fields "wpv-wpcf-cena-min" and "wpv-wpcf-cena-max", I have modified the JS codes you mentioned above as below:

$("#cenovy-rozsah").on("slide", function(slideEvt4) {
	//$('#wpv-wpcf-cena-min').val(slideEvt4.value[0]);
	//$('#wpv-wpcf-cena-max').val(slideEvt4.value[1]);
	$('input[name="wpv-wpcf-cena-min"]').val(slideEvt4.value[0]);
	$('input[name="wpv-wpcf-cena-max"]').val(slideEvt4.value[1]);
});

Please check if it is fixed, thanks

#596650

Hi Luo,

thank you so much for fixing the code, it works. But new problem arised. When I change the price on slider or anything from searching parameters, the new search results will show, but the slider disappears.

There is the page of the slider: lien caché

#596700

You are using AJAX search feature and custom JS codes to setup the range slider, so you will need to trigger the custom JS codes after the AJAX search is completed, see similar thread here:
https://toolset.com/forums/topic/trigger-js-event-after-ajax-filtering-finished/

Since it is a new question, if you still need assistance for it, please create new thread for new question, that will help other users to find the answers.

#596969

OK, this issue is resolved. I will create separate thread with the second question.