Price range “min’ and “max” attributes
-
Hi.
I’ve got an issue with price range slider and input type=”number”. Slider can be dragged to the point where it’s actually out of range, e.g my lowest price is 1.299 and my highest price is 3.299. There’s no “min” and “max” values included, so you can set any value. Can you fix that? There’s already a “data-min” and “data-max” values, just use them as “min” and “max” values.
-
Hi @johnwandler
Please send the link to the page with the issues so that we can check it.
Best Regards,
VictorI’m using in on a closed, dev-only environment.
I’m using _price as a meta tag, but it happens on every input type=”number”. Where’s the issue:
- input type=”number” is missing its “min” and/or “max” value. It already has “data-min” and/or “data-max”. E.g. you can either use input type=”number” or a slider, if enabled, to set values that are “not allowed” to be set. Like i said before, in my case, i’ve got 1.349 as min. price and 3.299 as max. price in a specific category. If slider is enabled, make sure you don’t have any active filters selected, then either grab “min” slider even more to the left or right slider even more to the right, and you’ll see that input type=”number” will be disabled and a slider won’t work anymore.

- Another problem with input type=”number is:

You are even able to set negative values somehow…

-
This reply was modified 1 year, 2 months ago by
johnwandler. Reason: Fixed typos
@johnwandler Unfortunately, this is not something that can be checked via screenshots, as we have it on our back, and the price slider is working without any issues there. So it can be said that there is either some conflict or other issues on the site.
What you can do is use a clean WP installation, install only our plugin and WooCommerce if you are using it, and test if everything is working correctly. If yes, then you can pull all of your other plugins, themes, and custom codes. In order to understand what exactly is causing this issue on the site.
The negative values are allowed as many clients asked for them to be allowed, especially when they have a filter for temperatures and other options.
Best Regards,
Victorhttps://smartwebsite.pl/filter-everything_test/sklep/
Frest install, two products with different prices. Everything is just default, basically. SAME ISSUE. My settings on fresh install:




@johnwandler can you please remove this – https://prnt.sc/JYDDth8jmeMR so we can see it?
Best Reagrds
VictorDone, my bad.
@johnwandler Hmmm, very weird. We just installed it on the local server, everything is clean, and it is filtering without any issues. But in your case, it is returning a 403 forbidden error, like there is no access to it after filtering. Do you have any settings that potentially could cause it on your server? Maybe some security plugins or anything else like that?
Try going to the Filters > Settings >URL VAR Names > and change the price to something else like fe_price and hit the save button then refresh the page with the filter and test it.Best Regards,
VictorEverything is “new”. That installation is on a different server, no custom changes. After adding:
$(document).on('change input blur focus', '.wpc-filters-range-min', function(){ $(this).removeAttr('disabled')}it’ll no longer display 403. Looks like disabling inputs (price in this case) is not recommended. Also you’ve mentioned that negative numbers are allowed, because people requested it. One simple “if” statement checking for “_price” meta is enough. You don’t even have to add server-side validation, because it’s not a critical function, it’s only a sorting addon, but adding some jQuery to check for empty/NaN/too low/too high values would be super helpful.
My super lazy, unoptimized code (there’s even a gap in “range-min” checking), not finished code fixed a lot of problems. I’ve been checking for multiple events just to be sure that everything works as it should. I will no longer update this, because i found another addon/widget.
$('.wpc-filters-range-min').attr('min', $('.wpc-filters-range-min').attr('data-min'))
$('.wpc-filters-range-max').attr('max', $('.wpc-filters-range-max').attr('data-max'))
$(document).on('change input blur focus', '.wpc-filters-range-min', function() {
$(this).removeAttr('disabled')
$(this).attr('min', $(this).attr('data-min'))
})
$(document).on('change input blur focus', '.wpc-filters-range-max', function(e) {
$(this).attr('max', parseFloat($(this).attr('data-max')))
if (parseFloat($(this).val()) >= parseFloat($(this).attr('data-max'))) $(this).val(parseFloat($(this).attr('data-max')))
if (parseFloat($(this).val() == '0')) $(this).val(parseFloat($(this).attr('data-max')))
if ((e.type === 'blur' || e.type === 'change') && (parseFloat($(this).val()) < parseFloat($('.wpc-filters-range-min').attr('data-min')) || $(this).val() == '')) $(this).val(parseFloat($(this).attr('data-max')))
$('.wpc-filters-range-min, .wpc-filters-range-max').removeAttr('disabled')
})@johnwandler We are sorry to hear that.
Here is the clean testing site – https://streamable.com/uwwjrs and working without any issues. And there are no other errors on the site.If it was a common issue with the range slider, then this issue would be on a forum from each and every client, as it is working the same for the PRO and Free versions of the plugins and the most required filter as this is a price filter. And from the requests, you are the only one who is facing such an issue.
This is only telling us that the issue lies either on the server side/hosting which you are using for the site or some .htacess or anything else that is shared for new subdomains as well. If we cannot recreate it in our clean environment, and other clients do not have such an issue, at least, no one reported any issues yet with the range slider, you are the only person with such an issue for far, then we cannot fix something that we cannot even recreate.
Best Regards,
VictorTry one more thing, as i said before “(…) make sure you don’t have any active filters selected, then either grab “min” slider even more to the left or right slider even more to the right (…)”. On this video, you’ve started by dragging right slider to the left, try pull that slider even more to the right, or left even more to the left. URL must be clean – no active filters must be present.
https://vimeo.com/1072504041/8cf667aaed?share=copy
I wasn’t able to record console, but it actually prints out errors as i reported before.
-
This reply was modified 1 year, 2 months ago by
johnwandler. Reason: Added link to a video
-
This reply was modified 1 year, 2 months ago by
johnwandler. Reason: Added comment for console
Well, everything is deleting on our side in the URL – https://streamable.com/f1npxd the only issue that we spotted is when deleting the price fully, it is returning an error, so we added this to the bug list already. You can see that issue in our video with fully deleting the price.
Best Regards,
Victor
The topic ‘Price range “min’ and “max” attributes’ is closed to new replies.