Skip Navigation

[Resolved] Price filter

This support ticket is created 6 years, 7 months ago. 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by christopheV-2 6 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#906281
prix.png

Hello,

I have a price field (number)
I would like to set up checkboxes to check.
with as information what is on the attached image

How can I do ?

Thank you in advance.

#906461

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Christophe,

Thank you for contacting our support forum.

Actually this is possible but not with a single filter. What you will need to do is to use the between comparison when adding the filters and then add the values that you want the filters to check so there will be a min value and a max value.

So in one filter you will be able to define 200 and then in the max filter you will be able to define 1000 and then views will be able to filter for all the values between 200 and 1000.

Similarly here: https://toolset.com/documentation/user-guides/front-page-filters/

Thanks,
Shane

#906727

Ok Shane.

I'm trying to finally make a price range
hidden link

I almost arrived there.

I would only like numbers without decimal.

I know there is a problem in this code:
var formatNumber = function (number)
{
number + = "";
var parts = number.split ('.');
var integer = parts [0];
var decimal = parts.length> 1? '.' + shares [1]: '';
var regex = / (\ d +) (\ d {3}) /;
while (regex.test (integer))
{
integer = integer.replace (regex, '$ 1' + ',' + '$ 2');
}
return integer + decimal;
};

Thank you

#906945

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Christophe,

I can't look at the code and know what is wrong.

Could you provide a bit of context, maybe where you're trying to put the code and what this code is suppose to do.

Looking forward to hearing from you soon.

Thanks,
Shane

#907066

I would like to make a price range like here:
hidden link

in a view I have a field "price"

In looking for this view I put:

    <span id = "price-search">
 <div id = "price-slider-filter"> </ div>
[wpv-control-postmeta field = "wpcf-price" url_param = "wpv-wpcf-price_min" placeholder = "0 €" class = "infoprix"]
[wpv-control-postmeta field = "wpcf-price" url_param = "wpv-wpcf-price_max" placeholder = "3200000 €" class = "infoprix right"]
    </ span>

And in the editor js:

jQuery ( "# slider-price-filter"). slider ({
    / * You can change min, max, step and values ​​* /
    range: true,
    min: 0,
    max: 3200000,
    step: 50000,
    values: [0, 3200000],
    slide: function (event, ui) {
        jQuery ( '# wpv_control_textfield_wpv-WPCF-prix_min') val (formatNumber (ui.values ​​[0])).
        jQuery ( '# wpv_control_textfield_wpv-WPCF-prix_max') val (formatNumber (ui.values ​​[1])).
}});
jQuery ('# wpv_control_textfield_wpv-wpcf-price_max, # wpv_control_textfield_wpv-wpcf-price_min') change (function () {
jQuery ('# price-slider-filter'). slider ('values', [parseInt (jQuery ('# wpv_control_textfield_wpv-wpcf-price_min'). val ()), parseInt (jQuery ('# wpv_control_textfield_wpv-wpcf-max_price' ) .val ())]);
});

function formatNumber (number)
{
    number = number.toFixed (0) + '';
    x = number.split ('.');
    x1 = x [0];
    x2 = x.length> 1? '.' + x [1]: '';
    var rgx = / (\ d +) (\ d {3}) /;
    while (rgx.test (x1)) {
        x1 = x1.replace (rgx, '$ 1' + ',' + '$ 2');
    }
    return x1 + x2;
}

but I do not want decimal numbers as whole numbers
example: 32000, 12000, 150000 ...

Thanks

#907341

It work.

Now I have the price range filter that disappears when I do a search.
The same problem as here:
https://toolset.com/forums/topic/jquery-range-slider-disappearing-on-parametric-search-results-page/

Here is the link on which I work:
<hidden>http: //testlightweb.fr/terraimmobilier/ventes-immobilieres</hidden>

#907516

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Christophe,

Thanks, I'm able to see this issue now.

Could you send me a link to the page where the slider is setup ?

Thanks,
Shane

#908870

It's ok

Thanks