-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unite price can't be used as sorting method #27171
Comments
Hello @vincent-dp Thank you for your suggestion. The Product Team will take it into consideration for future developments. If you are willing to implement this feature into PrestaShop as a Pull Request, the teams will be happy to help you by ensuring that it is appropriate and coherent with the rest of the project. If that is the case, please let us know! Thank you |
Now the unit price will be stored in the database with this PR #26762 for the next version. So after this PR is merged, we could rename this feature request 'can't sort with unit price' ;) |
Thank you, I have edited my request and the title |
Hi @vincent-dp as @MatShir told you we are introducing this unit price column in 8.0.0 However if you need it in your module for prior versions of PrestaShop you should be able to compute it in your SQL request. Similarly to what was done here for upgrade scripts PrestaShop/autoupgrade#441 You should be able to request something like this: SELECT p.*, IF (`unit_price_ratio` != 0, `price` / `unit_price_ratio`, 0) AS unit_price FROM product p ORDER BY unit_price; That's just a simple example (because you should also consider values from the |
Thank you very much for answering. Yes after reading the whole #26762 I was able to reproduce on an old release (1.7.5+) since it is pretty much straight forward. About the sorting method, I don't think I can make a module to make this sorting method works, since my client use another module for filtering search/catalog and it will be really messy to make all these works. So I think I have to wait for a release |
Prerequisites
Is your feature request related to a problem?
Hello,
We cannot chose to sort product by its unite price.
Describe the solution you'd like
To be able to sort product by their unite price
Alternatives you've considered
I have tried to find/modify the method for a client, and I'm not able to follow the trace that leads to a sql query and I drown myself into the functions that build the search. So even if I wanted to add a column myself, the documentation is too rich/too poor to give me the oportunity to find a solution about productSearchQuery
Additional context
No response
Do you plan to work on this feature?
The text was updated successfully, but these errors were encountered: