I have a view which displays a list of products with exposed filter for the sort criteria. I want to sort the products by PRICE and by DATE. I've done that already with no problem.
My issue is that I need to "order by" text to be specific for each sort criteria like this:
Price (Highest/Lowest)
Date (Newest/Oldest)
Instead of:
Price (Ascending/Descending)
Date (Ascending/Descending)
Is this possible?
Comments
Comment #1
dawehnerYes, you can configure it under the exposed form settings.
Comment #2
ismail cherri commentedI'm sorry, I think I didn't explain my issue very well...
I need to change the text for each sort criteria. I mean to have a descriptive text corresponding to each sort criteria.
e.g. highest and lowest for price, heaviest and lightest for weight, recent and old for date etc...
Right now, I can only assign one descriptive text for ascending and another one for descending.
Comment #4
halloffame commentedLooking for the exact same thing.
@necromancerfinal How did you go about doing this?
Comment #5
dawehnerYou probably have to build some better ui, because with having two select-boxes different texts doesn't actually make sense.
Comment #6
halloffame commented@dereine I'm looking into removing the 'order' select list instead for the meantime while looking for better solution. Can you please point me to the right themeable function where I could do this? Thanks.
Comment #7
dawehnerYou could use the views-exposed-form.tpl.php
Comment #8
ismail cherri commented@evilgenius
I used Better Exposed Filters.
With this module you can combine the sort criteria and the sort order text in a single dropdown list. But I still can't change the sort order text for each one :(
Comment #9
halloffame commentedI just got rid of the order select list and say if I have 'date' sort and wanted to offer both descending and ascending I would create two sort criteria and labeled them 'View from newest to oldest and 'View from oldest to newest'.
Comment #10
jarchowk commentedTo do this I used Better Exposed Filters then changed:
to
Line 346 in better_exposed_filters_exposed_form_plugin.inc
Then used String Overrides.
Comment #11
maxime_sbk commentedCan someone submit a patch for this?
Comment #12
couturier commentedThis issue is closed. If you really want a patch, re-open.
Comment #13
jaclayton commentedYes, this issue is closed. But in case someone comes along...
I ended up using jQuery to fix this, dropping a bit of code into the footer of the view to change the dropdown options we're using. I should add that we're using Better Exposed Filters to combine date, price, and title options.
Hopefully fairly self-explanatory - check to see what the selected value is and then alter the dropdown text appropriately. Obviously this isn't using any regionalisation of text, it's strictly a single-language solution.
The final call to
triger("change")simulates the selection of the current option so that when the page loads the user isn't presented with the default "Asc/Desc" values.If this has been superceded by something that is language-aware and simpler for the end-user to implement, I'd love to know.
Comment #14
mustanggb commentedClosing this as outdated to tidy up a bit around here. If you're still having problems with the latest release please create a new issue.