Prestashop: Product sorting doesn't work.

Created on 10 Jul 2019  路  48Comments  路  Source: PrestaShop/PrestaShop

Describe the bug

When activating the ps_facetedsearch, the frontend sorting capabilities (price low-to-high and price-high-to-low) are abolutely not ordered by price.

When not activating the module the sorting works fine.

Current stack:
ps_facetedsearch v3.1.0
Theme: Z.One 2.4.2
Prestashop 1.7.5.2

To Reproduce
Just visit super.albarsana.com which is my live shop and play around. Now the module is activated. You will see the sorting doesn't work.

Screenshots
If applicable, add screenshots or screenrecords to help explain your problem.

Additional information
PrestaShop version: 1.7.5.2
PHP version: N/A

1.7.5.2 Bug Can't Reproduce FO Faceted search

All 48 comments

Hi @Archikawa,

After the upgrade of the ps_facetedsearch module, could please try to follow these steps:

  1. Go to BO => Module Manager page => configure the ps_facetedsearch module
  2. Click on Rebuild entire price index, Build attribute index & Clear cache
  3. Try to force a refresh of the page, by pressing CTRL+F5 on Windows / Linux, Cmd+R on Mac OS while you are on the FO.

Thanks to check & feedback.

@khouloudbelguith

Done, but same result :(

More data: PHP 7.2 could this be influencing?

If you are online give me a ping and I can deactivate the module in my shop so you can check "before and after" style.

I remain online

@Archikawa, no, it is not a PHP version issue.
I'm using PHP version 7.2.13 & it is OK.
Could you please provide us with more info? We need more details to understand how we can reproduce your issue:

  • host
  • server setup and configuration
  • PrestaShop version (source)
  • debug mode report
  • PHP error logs
  • apache error log
  • javascript console log
  • screenshots

Don't you know how to get this information? Please read the following article:
http://build.prestashop.com/howtos/misc/how-to-create-bug-report/

Thanks!

Ok @khouloudbelguith I will try to gather all this info (will take me some time as I'm not an expert)
I will ask also for collaboration of my hosting services. Get back to you asap. Thanks for supporting!

Screenshots provided
with_psfacetedsearch
without_psfacetedsearch

@Archikawa, thanks!
Waiting for your feedback.

Here what I got @khouloudbelguith

PS-Console.txt
php error log empty :(

I don't know exactly how to gather useful data for you. Seems more like a logical error (I was a programmer but too, too many tears ago) There is no excepton, nor a crash in the php log and the firefox console shows everything is fine...

A remote session would help? Teamviewer for instance.... (Don't know if this an approved method in the community. This is my first report here)

@Archikawa,
Could you please try to enable debug mode in your store and debug request which is sent by sorting by price in your browser, using DevTools, so:

  1. enable debug mode
  2. go to the FO => Category page
  3. open up developer tools
  4. go to Network tab
  5. Sort by price
  6. wait for an error, you should see red request information in Network tab
  7. click on it, you should see the error message in "Response" or "Preview" tab

Thanks to check & feedback.

No error at all @khouloudbelguith sorry.

I attach a few infos to see if it helps, let me know where to search for more info that provides value.

snapshot
code (as per firefox console).txt
network-inspector-dump.txt

@Archikawa, Did you installed the ps_facetedsearch from Back office => module catalog page or did make an upgrade of this module from a previous version?

Thanks!

Hi @khouloudbelguith
since I started the configuration of the shop till today, it upgraded itself at least twice (the auto-upgrade feature embedded in the prestashop BO)

@Archikawa, could you please try to reset the ps_facetedsearch module, clear cache, check & feedback.
Thanks!

@khouloudbelguith

You mean de-install and re-install?

@khouloudbelguith sorry I didn't get your point yesterday. Now i did.

I will reset the module in the next hour, clear cache and come back to you with the results

@Archikawa, yes you can uninstall the module by removing the folder & install it again or by clicking on the reset button.
image

Thanks!

Hi @khouloudbelguith may be we found something finally... reset fails
O_o

@khouloudbelguith it somehow did a re-init but there was a default template. After deleting the template, I created a new one. Then:

  • cleared server cache
  • Rebuilt price index
  • Built attributtes and features
  • Clear cache (module)

Problem is still there (sigh)

You can try for instance at: https://super.albarsana.com/71-higiene-bucal?order=product.price.asc

@Archikawa, could you please try to navigate to your BO => Advanced Parameters => Performance => Enable the "Disable all overrides" option, Save, clear cache, check & feedback.

Thanks!

Hi @khouloudbelguith I have it like this by default

@Archikawa, it is Enabled?
image

Thanks!

@khouloudbelguith yap. Shouldn't?

btw @khouloudbelguith sorting alphabetically works perfect.
(idk if this helps)

@Archikawa, by enabling this option you are disabling all classes and controllers overrides.
@Archikawa, try to disable it, clear cache, check & feedback.

Thanks!

Done @khouloudbelguith Disable overrides set to "NO"
Cleared cache (performance tab)
Rebuilt, built, clear cache (module)
Same behaviour

Should I send you the code running on my server? Would this help anyhow?

@Archikawa, could you please check if your current theme is overriding the ps_facetedsearch module?

Thanks!

@khouloudbelguith negative. Already checked with Theme developers (Z.One)

There is barely anything in the override folder of my installation. Only two elements at:

  • classes/order (order.php)
  • controllers/front (CmsController.php)

Rest of folders only the index.php file

@khouloudbelguith I extracted in a 7z file the module code running on my server.

It is 2MB. Shall I attach it here?

@Archikawa, you need to attach your ps_facetedsearch module here?
Yes, you can.

Thanks!

Ok. Thanks @khouloudbelguith !
Here you have the code runing in my server. May be you can see something in the files although the code is huge...

I have a prestashop installation provided by hosting provider. It was a 1.7.xx, (4.x???) then via 1-click upgrade, upgraded to 17.5.2

I got notifications in the BO of upgrades of ps_facetedsearch (at least twice). There was no info on the upgrades but I did all of them.

ps_facetedsearch.zip

@Archikawa, I tried with the module attached and it is OK on my shop.
I attached a screen record
https://drive.google.com/file/d/1JuQWYU_STpr2-KMJfjaWkWdnN71QJ9R0/view

Thanks!

Then @khouloudbelguith if there are no overrides, where can it be the issue? Theme?

Hi, same issue on two different installation 1.7.5.2 !
I even got some product that don't belong to the category or to a child of the category...
Some years after launching the 1.7, is it still on development ?

We're testing in paralel with Theme developer. Keep you posted @khouloudbelguith

@rflorent, the last version stable of PrestaShop is release, it is PS1.7.6.0.
@Archikawa, thanks a lot.
Waiting for your feedback.

Hi @khouloudbelguith unfortunately nothing found :( Theme doesn't interfere with product listing. Developer points I am using multistore and this could important informatioon for you.
Another thing that didn't mention is that some products belong to more than one category (having one of these as main category, obviously). Is this relevant?

@Archikawa, thanks for your feedback.
I tried with the Multishop context, but it is OK.
Yes in my case, I have some products have more than one associated category and no issue reproduced.

https://drive.google.com/file/d/1acyNk9Kmj867ni_dczIvYPgl9X47TS0y/view
Thanks!

It's ok @khouloudbelguith I see you local installation works but in my case, a real productive shop hosted in a normal provider (ionos) is behaving, at least, strange. And only with prices. Alphabetically works great.
Do you have a way to trace what the module is doing? A version that can log the result of the database query and make a dump to understand what happens? I could try install it.
I mean, I can buy another module in the addons shop to do this, I guess, but I would preffer to use the in-built option. I've spent quite a lot in modules already but only for enhancement. I preffer to rely on the commuity and the original code source for the core stuff, like this one.

Hi again @khouloudbelguith If i disable the faceted search the sorting by price works perfectly. There's no other thing to prove the wrong behaviour of the product sort by price. Faceted search, somehow is messing the result of the query or getting an error that is not catched.

Hi, @khouloudbelguith some more screenshots.

  • Homepage with featured products (last arrivals) no faceted search, sorting per price ok
    Captura-OK-Homepage
  • Products per Brand. No faceted search. Sorting per price ok
    Captura-OK-BrandList
  • Category listing withour faceted search. Sorting per price ok
    Captura-OK-Category without Faceted Search
  • Category listing with faceted search active. Sorting per price NOT ok
    Captura-NOK-Category w  Faceted Search

Can we for instance, set some traces in the module? I can upload them to the server and give you back the log file.

@Archikawa, I make some tests with your shop & I found an error in the console when sorting by price.
image
This issue is occurred by your theme.
Thanks to check with your theme author & feedback.

Query sent. Keep you posted @khouloudbelguith
Thx!

@Archikawa, thanks!
Waiting for your feedback.

Hi, @khouloudbelguith we did some research. We found this code:
5d2f06ed9a5cc
But a detailed search shows that it belongs to the "Data mining for statistics" (statsdata) module.
So we think it is normal and not related to the price sorting issue.

Hi @Archikawa,

Despite our several trials, we could not reproduce your issue with the provided information.
It seems that your issue is not a PrestaShop's core bug but most likely a server configuration or customization problem.
I invite you to contact our support team: http://addons.prestashop.com/en/388-support to help you solve your issue.

Thanks!

Would have been nice to at least have the possibility to put a trace in the module to inspect the return of the query.

Hi,

I'm facing the exact same issue. All the sorting options work well but sorting the price from low to high doesn't show the correct results.
This only happens when viewing all the products. Selecting a category everything works as expected.

Tried all the possible solutions in this issue, but nothing seemed to work.

Shop details:

  • Prestashop 1.7.5
  • ps_facetedsearch v3.2.0

Any other solutions i might test to solve my issue?

@ricky2k7 no clue. I wanted to get a piece of code with a few traces to help investigate where interferences could exist but i got the "can't reproduce" in return. Sorry.
In my case I am still trying to figure out what causes the query to return a wrong order by sequence just by simply activating the module (not even using it) If ever i find the answer I will post it here.

@Archikawa thanks for the feedback. If i ever stumble upon a solution, I'll let you know too.

I have the same issue, see my example below. The sorting works fine, but the faceted search gives problems. As you can see, product ID 131 has position 5 on my 'Donuts' category. So you would expect that is will be the fifth item on my products page. But, product ID 131 shows up as the second item on my page. This is because it has more catagories, where it has another position. On the category 'Baby Thema', it has position 1. This gives the problem that is also comes 'first' on my products overview page, but I want it as fifth item there.

How can I fix this? Hopefully my problem is clear.

prestashop-example

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Van-peterson picture Van-peterson  路  3Comments

wikao2 picture wikao2  路  3Comments

centoasa picture centoasa  路  3Comments

PrestaShark picture PrestaShark  路  3Comments

vincent-dp picture vincent-dp  路  3Comments