aurmil / magento-customize-price-filter

Allows to customize the layered navigation price filter with some options (e.g. custom price ranges)
MIT License
19 stars 7 forks source link

Incorrect price ranges using floats #15

Open hebestreit opened 9 years ago

hebestreit commented 9 years ago

First, thanks for this really nice extension!

Unfortunately your regex pattern doesn't support floats. I still get an error when saving configuration: "Provided Layered Navigation Price Ranges are incorrect."

We've very low prices in many categories so I need to define a range like: -0.25;0.25-0.50;0.50-1;1-2;2-5;5-10;10-25;25-

Is it possible to implement this feature or could you/someone else help me to change the pattern? My regex skills are too bad... * facepalm *

$pattern = '#^(\d+)?\-\d+;(\d+\-\d+;)*\d+\-(\d+)?$#';
aurmil commented 9 years ago

hello and thanks first, managing floats in this module is not only about the regex second, I already tried to do this, can't remember right now but there was a good reason why floats were not allowed just let me somte time to remember it :p I'll try to code it again (can't tell when) and it will come back to my memory I guess regards

aurmil commented 9 years ago

GCD is supposed to be calculated on integers, not on floats guess it could be done after multiplying both numbers until they are integers and then dividing the result by the same count of "x 10" we did before I will try to do it this way but as for others open issues, can't tell when I will have time for that :-/

hebestreit commented 9 years ago

Hey thanks for your quick response! I am convinced that you'll get it :)