[SOLVED] noUiSlider throwing JS error if only one product or all values are same

  • Posts: 2143
  • Thank you received: 747
4 years 10 months ago #307046

-- HikaShop version -- : 4.1.0 [1905241756]
-- Joomla version -- : 3.9.6
-- PHP version -- : 7.2
-- Error-message(debug-mod must be tuned on) -- : Uncaught Error: noUiSlider (13.1.4): 'range' 'min' and 'max' cannot be equal.

Hi,

The new noUiSlider, used in a filter module as "cursor" on price, is causing trouble if there's only a single product in the listing, or multiple products with the same price for all.
The error breaks following JS, of course.

See attachments for complete error in console, as well as filter settings.

Thanks for a quick fix.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Attachments:
Last edit: 4 years 10 months ago by lousyfool. Reason: Solved

Please Log in or Create an account to join the conversation.

  • Posts: 2143
  • Thank you received: 747
4 years 10 months ago #307054

Removing the code

if(e.min===e.max)throw new Error("noUiSlider ("+ut+"): 'range' 'min' and 'max' cannot be equal.");
from nouislider.min.js fixes the issue, indeed.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

Please Log in or Create an account to join the conversation.

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
4 years 10 months ago #307049

Hi,

Thank you for your feedback and the details on the issue. That's apparently a common issue with noUISlider:
github.com/leongersen/noUiSlider/issues/236
github.com/leongersen/noUiSlider/issues/633
It's been reported several times and they decided to not support that case in noUISlider.
So I've made a patch on our end to skip the display of noUISlider alltogether in such case (there is no point in having it anyways as there is nothing to select in the first place).
You can download the HikaShop install package on our website and install it on yours to get the patch.

The following user(s) said Thank You: lousyfool, n00bster

Please Log in or Create an account to join the conversation.

  • Posts: 2143
  • Thank you received: 747
4 years 10 months ago #307076

Brilliant - thank you, Nicolas, for your quick fix! Your patch is working well, of course.

(And I replaced my modded nouislider.min.js with the original one again ;) )


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
The following user(s) said Thank You: Mohamed Thelji

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum