Sorting by price in category (with faceted search) does not work.
Faceted search indexes (or it should, currently not working) the regular price AND the lowest price after catalog discounts or specific prices. It creates a range MIN-MAX.
But, when sorting products, it sorts them by the MIN value in the index, so, when a product has some specific prices, the order is completely wrong.
It needs to be sorted by the prices the customer sees on the page.
Thanks for opening this issue! We will help you to keep its state consistent
Hello @Hlavtox ,
which version of faceted search module are you using ? This seems to be working well with 3.5.0 version, i've just tested it.
Thanks !
@colinegin See #19849, I found the cause.
Hello @Hlavtox, I guess we can close this issue if this is a duplicate of the other issue you've created ?
@PierreRambaud Hi, should we keep CRON and sorting issue separated? Because while indexing thing is fixable relatively easily, sorting is not, in my opinion.
Yes, we need to split issues as must as possible. Easier to test, easier to fix (when it's easy :sweat_smile: )
@PierreRambaud Updated the issue description. After #19849 is fixed, how this can be solved?
@Hlavtox
could you check the issue mentionned by @khouloudbelguith ?
Thank you :)
@sarahdib @khouloudbelguith The issue has the same cause, but was not fixed. Actually, this issue was introduced by fixing the related issue.
Hi @Hlavtox,
I did not manage to reproduce the issue with PS1.7.6.7 and ps_facetedseach v3.5.0.
I attached a screen record
https://drive.google.com/file/d/1ZG6hWkoTUandczit_7f1RCz7V52V2Sb4/view?usp=sharing
Thanks to check and feedback.
Hi @Hlavtox,
Since we had no news from you for more than 20 days, I'll close this ticket. Feel free to open another one if you can give specific details.
Thanks!
Hi @khouloudbelguith, can you reopen this? The bug is there and needs to be fixed. Try to reproduce it with this scenario and I am sure you will see it. :-)
@PierreRambaud @eternoendless Can you have a look at it guys?
Scenario
Hi @Hlavtox,
I tried with the release stable ps_facetedsearch v3.6.0. and the dev branch.
I have the same result
When I try to sort by Price from High to low, Product B is the second.
I attached a screen record
https://drive.google.com/file/d/1koVnQAal2C0_kJSzurTkf3mA-ywPOdBu/view?usp=sharing
Thanks to check and feedback.
@khouloudbelguith I am not alone.
@ioweb-gr has the same issue https://github.com/PrestaShop/PrestaShop/issues/21137
@Hlavtox I think the use cases are slightly different though that's why I opened other issue. I did provide detailed instructions on how to replicate my use case though and it's definitely a bug in the module.
Also while debugging that, I noticed that during the upgrade process my table hadn't updated the table columns from INT(11) to DECIMAL(11) and I had to manually force the update on them.
It seems that if you delete the table, the module won't recreate it. I would expect it to since it's an index table.
@khouloudbelguith @PierreRambaud @ioweb-gr Just reproduced it on a clean PS install.
Exactly this table needs to hold a column with the group id too to sort properly
@ioweb-gr That will not help. It needs to resort it by the real displayed price. You say customer group, this all can alter the price you see.
etc. etc. not easy bro 馃く 馃槃
Hehe yeah I wasn't looking for the rest use cases
Hi @Hlavtox,
I followed these steps but it is ok in my case:
1. Install 1.7.7 beta 2
2. Install Faceted search 3.6.0
3. For simplicity. Keep only one language. Keep only one currency. Keep only one country active.
4. Make a customer group ID 4.
5. Make 3 products.
-- 5A. Product A, Price 100, 21% tax included.
-- 5B. Product B, Price 150, 21% tax included.
-- 5C. Product C, Price 200, 21% tax included.
-- 5D Set specific price 90 (21% tax included) for customer group 4.
-- 5E. Add products to some category.
6. Setup faceted search for this category. rebuild all indexes.
7. Go to FO, open this category and sort from the cheapest.
I attached a screen record
https://drive.google.com/file/d/1aA-YN9DI_ee8gwIM71twyzOcXR_yFXgw/view?usp=sharing
Thanks to check and feedback.
@khouloudbelguith Nono don't do it by catalog rules. Open the product B and add a specific price on Pricing tab. Then rebuild index and go check the category, it's gonna do it... (I hope :-D)
Hi @Hlavtox,
Thanks for your feedback.
I manage to reproduce the issue with PS1.7.6.8 and PS1770beta2 & ps_facetesearch v3.6.0. But it is random.
I attached a screen record
https://drive.google.com/file/d/1JhCSn4ORPuI-UUP--ct7GNm2bexMyhEj/view?usp=sharing
Record about the random issue
https://drive.google.com/file/d/1GfYOgUk0Z9ibtNgyapSxlsfdjuQC_Vbc/view?usp=sharing
Ping @PierreRambaud
I鈥檒l add this to the debug roadmap so that it鈥檚 fixed. If you have already fixed it on your end or if you think you can do it, please do send us a pull request!
Thanks!
@khouloudbelguith It's random because you added the specific price to all 3 products.
If you keep it only on product B, the order will be like on my screenshot.
But you discovered another bug, if the products have the same price, they are sorted randomly.
I opened this in the past - https://github.com/PrestaShop/PrestaShop/issues/18674, It was closed, but clearly it's happening even on 1.7.7...
@PierreRambaud Check it when you have time, please... 馃檹
Most helpful comment
@khouloudbelguith It's random because you added the specific price to all 3 products.
If you keep it only on product B, the order will be like on my screenshot.
But you discovered another bug, if the products have the same price, they are sorted randomly.
I opened this in the past - https://github.com/PrestaShop/PrestaShop/issues/18674, It was closed, but clearly it's happening even on 1.7.7...
@PierreRambaud Check it when you have time, please... 馃檹