- Posts: 101
- Thank you received: 8
Price slider 4 decimal places
-- Joomla version -- : 5.3.0
-- PHP version -- : 8.2.28
-- Browser(s) name and version -- : Firefox 1385.0.4
-- Error-message(debug-mod must be tuned on) -- : none
Maybe I did tweak things to much but my cursor price slider, with or without input fields, has 4 decimal places any idea how to change that to 2 decimal places?
Also the decimal separator is a dot (.) not a comma (,) it’s always been this way but can that be changed as well?
If I set the use of the input fields to “No” and change the format for the cursors label it still will display the the dot and not the comma and the decimal places setting does not have any effect.
I did not change anything in administrator/components/com_hikashop/classes/filter.php
For some items I did make some changes (custom field) to display 3 decimal places, but that did not effect the slider decimal places display in Hikashop 4.2.2.
Please Log in or Create an account to join the conversation.
Try changing the line:
That should help.
Please let us know how it goes. If it works fine, we'll include the change on our end for the next version of HikaShop.
Please Log in or Create an account to join the conversation.
well that was a quick fix, it does work as intended 2 decimal places and a comma thank you!
The only odd thing that I have left is that if you assign the price filter to a main category without products or prices, or an empty category, it will still show the price slider with a strange price range, but any other filter item like brand or colour is not displayed. The sub categories of that main category will display the price slider and the other filter items like brand and colour correctly, as long as there are items with prices to display.
In the above situation the nouislider.min.css will load after the site template.css so any css override will be lost or you need to use !important (not a fan). The only neat option is to not use the main category and assign each sub category individually to the price filter or use Regular Labs Conditions paid version to block the display of the module to the main category.
On pages with products and prices the nouislider.min.css will load before the site template.css so changes to the display of the slider will be possible.
I think it's the last 1% that will take 99% of the effort to get it perfect
So thank you again for the fix!
Regards, Rene
Please Log in or Create an account to join the conversation.
Try changing the line:
Please Log in or Create an account to join the conversation.
there are 3 positions with $cursorMax=1000; (line 2592 and lower), I only need to change the first one?
from:
}else{
$cursorMax=1000;
}
to:
}else{
return '';
}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
If you click it it will display some unrelated prices.
Not sure if it is worth your time to put more effort in this. In the final version I will not display the empty sub-categories and I can suppress the main category.
Please Log in or Create an account to join the conversation.
So it will display the correct filter module on the pages with items and prices but not on pages without.
Please Log in or Create an account to join the conversation.
Well, I would need to look deeper into it, with backend and FTP access.
If that's not needed for you, we can leave it at that.
We can always revisit the issue in the future if necessary.
Please Log in or Create an account to join the conversation.
Thank you for the great support!
Please Log in or Create an account to join the conversation.
had some time this morning and did read up on noUiSlider and Wnumb.
If you change line 2744 in filter.php from:
$value = 'parseFloat(values[handle]).toFixed('.(int)$currencies[$currency_id]->currency_locale.')';
to:
$value = 'parseFloat(values[handle]).toFixed(2)';
You get the 2 decimals instead of 4 from Hikashop itself, regardless of the type of browser you use.
As far as I can see code from line 2756 and lower with the formatting settings is not passed on to NoUiSlider and should also be changed, but I did not spend time on that.
else {
$options = '[true, true]';
$format = null;
if(in_array($filter->filter_data, array('price', 'b.product_sort_price'))) {
$format = array(
'mark' => '.',
'thousand' => ' ',
'prefix' => '',
'suffix' => $currency,
'decimals' => '2'
);
I did remove the previous changes to filter.php but I suppose that I need to change filter.php on a Hikashop update.
Please Log in or Create an account to join the conversation.
If that's the case, then it means the problem is that you configured your currency to have 4 decimals instead of 2 in the System>Currencies menu.
So please check there.
Please Log in or Create an account to join the conversation.
yes indeed International fractional digits was set to 4 and Local fractional digits was set to 2. No idea why since it has been this way since version 2.6 and only became a problem for me with 5.1.6 with the changed code in filter.php
In the end there are no changes needed at all, so sorry for wasting your time ;-(
Regards, Rene
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.