Jump to content

How to order product list by 'unity'


Vico_b

Recommended Posts

Hello,

 

tl;dr. I need to order my product list (in the catalog pages) by ps_product_shop.unity.

 

In prestashop 1.7.5 you have this field in product/price/ screen

image.thumb.png.d2048acfd54572dacd669f2f47f369f0.png

 

The field on the right (the one with '2' inside) is refered in the table 'ps_product_shop->`unity`

I want to sort my product list using this field

 

I have tried to change the `getProductSearchQuery()` method in "CategoryController.php" like so


            ->setSortOrder(new SortOrder('product', Tools::getProductsOrder('by','unity'), Tools::getProductsOrder('way')))

It doesn't work (but if I put for exemple 'date_upd' instead, it does sort by date update)

 

I also tried to change the Product.php class

`getProducts()` method. But no matter what I do in that class, nothing change. Even if I remove the code inside that method, the catalog keep showing up and no error.

 

Link to comment
Share on other sites

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...