The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [sorting]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
13 views

Default sorting in Assets view

Is there a way to change default sorting order on asset view pages? At the moment the default one is Upload Date and selecting sorting by Title only affects view in the folder you're currently in. In ...
1
vote
1answer
59 views

Filter entries by tags

Still very new to Craft but just can't figure this problem out, it's a level above me at the moment. I have an FAQ page as a 'single' that I would like to display all entries from a channel by ...
1
vote
0answers
147 views

Fixed order query

Experiencing a weird issue trying to do a fixed order display of entries. I have a bunch (array) of ids for entries I want to show as fixed order then want to append the remainder of relevant entries ...
1
vote
1answer
77 views

Advanced sorting of events with database expressions (Solspace Calendar)

I want to do some complicated sorting of events coming back from the Solspace Calendar plugin. I'm not certain whether this issue is specific to this plugin or whether it's a general Craft thing. In ...
1
vote
1answer
58 views

SQL error when trying to use sortOrder on Matrix related block (Craft 2)

I'm getting the following SQL error when trying to simply order related entries in a Matrix block. Anyway around this? CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity ...
1
vote
0answers
42 views

Showing entries in CP only for specific category

I need to sort structure section entries belonging to specific category (entries have category field). With default structure list displayed in CP, i see all entries for this structure type section ...
3
votes
2answers
451 views

How can I sort entries by a custom field in the CP, Craft 3?

I have an events section with a custom field of eventDate and it would be very helpful to editors to have them listed in event date order. In Craft 2 I used the plugin CP Sortable Custom Columns by ...
3
votes
1answer
175 views

Related Entries not sorting correctly

Craft 3.0.16.1 I have a relationship that is outputting entries, but the entries are not in the order as selected. {# not sorting correctly - **fieldName** is a variable passed via include #} {% ...
0
votes
1answer
1k views

Order twig array by date and time

I have a section called "events" in which I have a table field that contains dates and times of these events. So I want to order my events by date and within each day by time. I thought of mergin ...
0
votes
1answer
124 views

Sorting Matrix Field

I realize this is a very general question but is there a way to sort a matrix field? So not alphabetically but a very certain order.
2
votes
1answer
495 views

Group and Sort Alphabetically

I have a list of categories that I am listing out, grouping by alphabet. The issue is the list goes A H B C D E...and so on. Why would it go in that order? {% set categories = craft.categories....
1
vote
0answers
113 views

Order Entries by Category Fields (with fallback)

This is almost a duplicate of this question I have a section which I want to sort by category field. But the categories are not mandatory. When I apply |group('refSorter.first().title') it will ...
1
vote
1answer
104 views

Select query question

I am trying to do the following with craft.entries but I think it may not be possible without a plugin. I have 9 categories with related entries on all of them. I would like to get the latest ...
1
vote
1answer
138 views

Sort entries per category

I have a collection of entries in a structure, and each entry can be in multiple categories. Is it possible to sort the entries seperately for each category? So it would look something like this: ...
1
vote
1answer
212 views

Sort entry titles alphabetically excluding 'The'?

I need to list the names of all of my entries in alphabetical order excluding 'the' (which could only be at the beginning). I've looked around online, but I was only able to find a code segment (which ...
2
votes
0answers
187 views

How do I sort and paginate a JSON feed by a key from a transformer?

I need to sort the entries for an Element API endpoint by a value calculated in a custom transformer. Is this possible? The use case is this: We're dealing with Events/Courses that have multiple ...
1
vote
1answer
614 views

Sort entries in a category via entry field

I have a section for Businesses. I also have categories that these businesses can belong to. On each category page I want to list all the businesses that belong to that category. So far so good, but ...
0
votes
0answers
41 views

Manually Sorting Sub-Group of Users?

I just built a membership site and created a Member Directory template which includes all users and then a Board Members Directory template which only lists users who have a "Board Member Title" ...
1
vote
1answer
206 views

Simple category-entry search filter

I'm trying to figure what would be the simplest way to do such filtering: I would like to make it in that way that selecting one of "Specialities" category would limit results from the selected "...
1
vote
1answer
349 views

Make sort dropdown keep property

I've got a working sort dropdown on my front end, but I'm after the dropdown keeping the chosen sort method option instead of resetting to the default top of the dropdown option. e.g. User clicks ...
2
votes
1answer
99 views

How to list/filter by the entry type column in the entries listing

I've got a 'media' channel that has two entry types: Film and Report. I have set the listing of entries to have the entry type column, but it doesn't seem to have any options for making it clickable ...
1
vote
0answers
112 views

Query category by price

My client has requested to be able to filter the results page by price via a dropdown, which you can see in the attached screenshot. Basically the results page shows a list of around 15 property ...
2
votes
1answer
65 views

“Natural” sorting for ElementCriteria

I want something sorted like this: MyString8 MyString9 MyString10 MyString11 $criteria->order = 'myField asc doesn't get things quite right, as MySQL has not native "natural sorting".
1
vote
1answer
88 views

How do I sort and display event entries when each event can have multiple start times?

I have two different event types in my Events channel. The first one is events and it is very straightforward: Title, Description, Date. The other one is films and it is a little more complex: Title, ...
1
vote
1answer
545 views

Sort entries in a category or entries field?

I have a Products Section and a Product Category Structure Section In Products there is an Entries Field where the Category is selected from the Product Category section. Is it possible to sort the ...
1
vote
1answer
163 views

Sorting across blocks (to get prev/next links)

issue is an entry that has a matrix field named contents, whose blocks have an entries field named works, and the related works channel has an entries field named authorPeople. Issue 1's contents ...
1
vote
1answer
98 views

Changing the order of an 'archive' page

I'm creating a monthly archive page (for a specified year) for a section. Standard code to output the months and entries as follows: {% set entriesInYear = craft.entries.section('blog').limit(null)....
1
vote
1answer
197 views

If merging two sections from different locales how do I then sort them by a shared criteria?

I've got a site with multiple locales and I want to merge together content from across these locales, eg News. The two sections share the same fields so should theoretically be able to be sorted by a ...
2
votes
1answer
302 views

How to sort entries by their descendant count?

I want to sort (and paginate) entries from a structure section based on the number of descendants. This is the effective criteria I want to query: craft.entries.section('myStructure').level(1).order('...
1
vote
1answer
343 views

How to make a sortable table in frontend?

I need to display a sortable table of organization member records in frontend, preferably with pagination. Before I start coding this from scratch, I want to ask: Does anyone have some ideas on how to ...
7
votes
1answer
1k views

In Craft 2.5, how can you sort the entry index page by a custom field?

I recently updated a very large site to Craft 2.5. One of the great new features is the ability to view custom fields as columns on the entry index page. Previously, I used the DashCols plugin to ...
1
vote
2answers
451 views

Sorting multi-dimensional grouped arrays

My problem is that I don't know/understand how to sort complex arrays. I have a multi dimensional array of users from an external API. So it's not an array that I fetch from the Craft database. Let's ...
1
vote
1answer
212 views

Multisort with supersort plugin

I have entries that I would like to sort by 2 fields. First I would like to sort (or group) all of the entries in alphabetical order by a category field (brand), and then within each grouped brand I ...
3
votes
1answer
962 views

How do I sort a collection of entries from multiple sections by date?

I want to create a featured story slider on my website and gather the latest entries from multiple channels to populate it. Here is what is working: # fetch the entries {% set featuredBlog = craft....
3
votes
1answer
210 views

Using Supersort with date field

I'm fetching entries from several different locales and merging them together into a single object. I then want to sort these to be most recent entry shown first. Using Supersort and the custom ...
1
vote
0answers
100 views

Grouping entries by days in matrix field

So this is proving a lot harder than I thought. I have a 'tours' section containing tours, which all have several departure dates. Those dates are in a matrix field, entry.data. So there's only one ...
0
votes
0answers
96 views

Performance problems filtering lists

I have a site where I need to paginate and filter a list of businesses by different criteria. In the business entry, I’m using the Reasons plugin tied to about 8 different lightswitches which, when ...
2
votes
1answer
253 views

How can I use Garnish to sort?

I am working on a field type that is similar to the table field type. Is it possible to tap into Garnish for the sorting. I’ve tried a few things and have had no luck. Can anyone help me out?
2
votes
1answer
1k views

Sort / Order Entries on select or button click

I have a page on my website were I display alot of entries. Now I want those entries to be sorted by Date, Title etc. I know how to change that hard coded but I want to make it dynamic with a <...
2
votes
1answer
128 views

Changing the frontend sorting according to different fields

I am creating a site that has a list of events that I need to be able to sort by different fields. I know how to do it statically in my templates but I want to enable it in the front end. For the ...
4
votes
2answers
287 views

Is it possible to order related entries by relevance of tags?

I have a set of entries which each have 0 or more tags (no limit). For each entry, I am aiming to display 3 'related entries', related by the tags field. e.g. If entry 1 is tagged with 'apples', '...
4
votes
1answer
276 views

Sorting an array of entries according to a fixed list/array of items

I want to sort an array of entries in a specific order. Every entry has a 'shoptype' and I want to show all entries for type A, than type B, than type C. A partial solution would be to iterate over ...
1
vote
1answer
219 views

Sorting matrixblocks by earliest date from child table

I have a matrix field (events), each of this blocks (event) contains a table (dates) with individual rows (date), those have a start date and a start time. I would like to sort the events (matrix ...
1
vote
1answer
289 views

Sort entries by global variable category

I'm picking a season category (spring, summer, fall, winter) in a global variable that should dictate what entries come to the top of non-season category pages. These entries are already on a ...
2
votes
1answer
133 views

Ordering homepage posts by date, but give customized ordering option in CP

I'm looking to combine three different channels on the homepage, ordered by date, unless the client rearranges the hierarchy in the CP. Low Reorder for EE had this customization, where entries would ...
3
votes
2answers
83 views

How do I insert a special entry into a sections list?

I want to apologize if I'm not asking the question correctly, but basically this is what I want to do: I have this craft.entries: {% paginate craft.entries.section('example').limit(10) as ...
4
votes
1answer
2k views

Want to sort a table field from Twig

Guess this is a stupid question, but I'm trying to sort a table based on which column the user wants to sort. Tried: {% for row in entry.tablefield|sort %} (No effect) {% for row in entry....
1
vote
2answers
338 views

Organize filtered entries by a specific category

I have an array of products that has already been filtered by a brand category. I want to display them in a list ordered by a size category. This is working, but I think there must be a better way: {%...
3
votes
2answers
543 views

Using `getPrev` and `getNext` with entries sorted by SuperSort plugin?

I applied the superSort plugin function to a list of entries and it works perfectly: {% set entries = craft.entries.section('sectionName').type('entryType').order('entryTitle')|supersort('natsort') %}...
10
votes
1answer
4k views

How do I sort entries by two variables?

Currently I am sorting the entries by an ID: {% for gallery in craft.entries.section('Gallery').order('available desc').limit(none) %} but I would like to show the latest entries on top, currently ...