Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I must be overlooking something...
I'd like to be able to sort by price, but don't see how.
In the View for catalog product listing, I go to Table settings and I see the columns, and I see some are checked off as "Sortable", but the Price column has no checkbox.
Searching the net for threads or modules concerning this, not finding anything.
Comment | File | Size | Author |
---|---|---|---|
#11 | 1559676-display-price-click-sort.patch | 1.67 KB | longwave |
Comments
Comment #1
Cablestein CreditAttribution: Cablestein commentedI figured it out...
I should be using Sell Price as a field in my View, not Display Price.
Sell Price is sortable, but not Display price.
Which now leaves a question: Why can't you sort Display Price?
Comment #2
TR CreditAttribution: TR commentedA sort can be added to display price - I don't know why it was left out. Anyone willing to roll a patch for this?
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedThis problem is still present. I had to use "Sell price" as a workaround for now but would very much like for "Display price" field to be sortable. Thanks.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedSorry guys. Didn't mean to change the version from -dev.
Comment #5
longwaveDisplay price is calculated, not stored in the database, so I'm not sure it's possible to sort on it. Sell price should be good enough for most cases, except perhaps where you have inclusive taxes and untaxed products in the same listings, or are handling discounts with display price somehow - in which case please give more detail, as I'd like to know how people are using display price, and why sell price isn't suitable for you.
Comment #6
divcg CreditAttribution: divcg commentedI just ran into this issue also. We need to use display price because we utilize Price Per Role module for our distributors pricing, and sell price does not reflect the role pricing
Comment #7
mandreato CreditAttribution: mandreato commentedOn the current D6 site, I'm using "Product: Sell price" field in a table formatted view. It is sortable and contains VAT.
During the migration to D7, I've found that Sell price is not comprensive of VAT, so I should use "Product: Display price" (which has VAT) instead. But it cannot be used as "sortable" in the settings of Table format of the view.
Comment #8
evidence CreditAttribution: evidence commentedHello, Longwave,
I see this problem has existed for a while now.
I want to create a webshop. I cope with the problem as described above, so I'll answer your question.
It seems logical that one would want to use display price, as it automatically includes the VAT:
1) There is the possibility to add a "Incl. VAT" string after a price.
2) I assume it's the only way you can get your tax reports to work.
But it also seems very logical you want to sort on the price...
I hope someone of the contributor team will pick this up! :)
Kind regards
Comment #9
longwave@divcg: You will need Price Per Role to support price sorting in Views, which I don't think is implemented yet.
@mandreato: That is an issue but I wonder if allowing table sorting on sell price for the display price field is good enough for most cases?
@evidence: You can still sort on sell price, and that will work for many cases - the only time it's an issue is if you have products with different VAT rates mixed in the same listing. Does this work for you?
Comment #10
mandreato CreditAttribution: mandreato commentedActually, after D7 migration, I don't display Sell Price at all because it doesn't include VAT.
So, only Display Price is displayed, which is not sortable.
Comment #11
longwaveThe attached patch adds click sorting to the display price field when used in a table. Behind the scenes it actually sorts on sell price - this should be good enough for many cases, though it will fail when the display price is not altered consistently.
Comment #12
mandreato CreditAttribution: mandreato commentedIt works !
Comment #13
evidence CreditAttribution: evidence commented@Longwave
I did not yet try the patch. But your solution works well when there is one VAT rate applied. The click sorting is the only problem I had left, but apparently your patch fixes that as well.
Kind regards,
Evidence
Comment #14
longwaveCommitted.