Jump to content

Arnaud_R

Recommended Posts

Hello,

We are using Prestashop 1.6.1.10 and we currently face an issue that we are not able to solve.

As you know it's possible to change the sorting by default in preference tab > products > sorting by default.

We chose to sort by quantity in order to display first all products that we have in stock. When we take a loot at the product listing, it properly displays max quantity first, but after displaying all products that we have in several quantities then sorting by default is by product id.

It's fine to have a 'second' sorting by product id, but we would like to use DESC sorting and not ASC sorting in order to display the newest products first. We checked a lot of php files but we don't find where this sorting by id/position is set. I guess we would only have to change ASC to DESC to have the expected behavior.

I think it could benefit to a lot of merchants to know where the second sorting is configured, after the first sorting which is easy to change in the backoffice.

Hope it was clear enough, thanks the community for your help ! :)

Link to comment
Share on other sites

I haven't tested it but I would assume that the function assignProductList() in /controllers/front/CategoryController.php might a good place to do this.

You would then add at the beginning a line like

if($this->orderBy == 'id_product") $this->orderWay = "DESC";

  • Like 1
Link to comment
Share on other sites

Hello @musicmaster,

Thanks for your help ! Just tested but unfortunately it doesn't change the sorting, do you have or somebody else another idea to solve this issue ? I guess this behavior is configured somewhere and we would just have to change ASC to DESC.

Thanks a lot,

Best

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...