Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display correct count in price slider if range ‚from value‘ = ‚to value‘ #1125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

annakoehler
Copy link

f.e. we have products in shop with price 100$. If we make in price slider "from value" = "to value", we got "No products in the selected range." message. Also if we open direct url https://some_shop/some_url?price=100-100 we didn't see the products with price 100$

@annakoehler
Copy link
Author

this is also related to the fix b647b03 and issue #381

@annakoehler
Copy link
Author

we had the problem not with price, but with other attribute. I saw you did changes for price and you have an step -0,01, but it doesn't work if you have no decimal numbers

@romainruaud romainruaud force-pushed the master branch 2 times, most recently from 28eb80b to 3cbc361 Compare July 31, 2020 12:58
@rbayet
Copy link
Collaborator

rbayet commented Nov 30, 2021

While the issue does exist when min = max in the slider, changing the behavior of the filter would lead to other problems, because the slider is built around an histogram which takes the floor() of a price.
So, considering you have in the middle of your slider four products with actual prices 68.0, 68.30, 69.0 and 69.30, the corresponding histogram slots will be :

  • 68 = 2
  • 69 = 2

At the moment, if you put min on 68 and max on 69, the number of available products will be displayed as 2 (because of the lt).
And the resulting page, on a price=68-69 will also display 2 products because of the (lt).

Now, if we adopt your changes, and if you put min on 68 and max on 69, the number of available products displayed will be 4 (because of the lte).
But on the resulting page, you will only see 3 products, because ['gt' => 68, 'lte' => 69] does not include 69.30.

@rbayet
Copy link
Collaborator

rbayet commented Nov 30, 2021

Not closing this PR right now, but the correct approach would be to prevent the from and to value to be equal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants