Jump to content

Prestashop 1.7 Product listing how to add sorting by Unit Price


Alien(PL)

Recommended Posts

How to add feature to sort by unit price to the listing page.

 

I've tried to add


        $sortUnitPriceAsc = new SortOrder('product', 'unit_price_full', 'asc');
        $sortUnitPriceDesc = new SortOrder('product', 'unit_price_full', 'desc');

to /modules/ps_facetedsearch/src/Product/SearchProvider.php

 

Edited by Alien(PL) (see edit history)
Link to comment
Share on other sites

  • 3 years later...

this feature will be great (anyone solved it?) - I guess the issue is that not necesarily we will be talking about the same units... (unless forced by the developer) so I can see why it is not by default...

Link to comment
Share on other sites

  • 4 weeks later...
On 12/9/2020 at 5:10 AM, Alien(PL) said:

How to add feature to sort by unit price to the listing page.

 

I've tried to add


        $sortUnitPriceAsc = new SortOrder('product', 'unit_price_full', 'asc');
        $sortUnitPriceDesc = new SortOrder('product', 'unit_price_full', 'desc');

to /modules/ps_facetedsearch/src/Product/SearchProvider.php

 

Hi,

You need to override the SearchProvider class in your custom module and write the sorting customization.

Also modify the template file responsible for rendering the listing page to include the sorting options.

Thanks! 

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