Questions tagged [ordering]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4
votes
1answer
87 views

How to order or filter entries by their author's custom field?

Is it possible to order and/or filter all entries from a section whose author has a custom field value that is set to "X"? Below is the starting code. in Twig: {% set elementQuery = craft.entries()...
1
vote
1answer
28 views

How to order Sites

We have 38 sites running, divided over 6 groups. But for some weird reason on showing the sites list, 10 sites are showing up random. How can we fix this, or how can we order the sites on 'name' or '...
1
vote
1answer
46 views

Sortable Categories on per Entry basis

I've been searching all over for this and have been coming up short unfortunately. Does anyone know if it's possible with in Craft CMS 3 to allow custom sorting of categories on a per entry basis? ...
1
vote
1answer
77 views

Order entries by a category field alphabetically then paginate

I've tried so many different things and can't get this to work... {% set makeCat = craft.categories() .group('make') .orderBy('title') .limit(21) %} {% paginate makeCat as pageInfo, ...
1
vote
1answer
51 views

Ignoring “The ” and “A ” when sorting entries

I have this code which used to work with 2.x versions: {% set foobars = craft.entries({ section: "foobars"}).order("(CASE WHEN title LIKE 'The %' THEN SUBSTRING(title, 5) WHEN title LIKE 'A %' THEN ...
1
vote
1answer
24 views

Grouping entries and ordering by section

Im grabbing entries from two sections and displaying them using the group filter. {% set entries = craft.entries().section('extendedEvents, festivalEvents')%} {% set allEvents = entries %} {% set ...
1
vote
1answer
118 views

Order entries by custom date and time fields

I have an events channel where each entry has three custom date/time fields: startDate (Date Only) startTime (Time Only) endTime (Time Only) I was originally using this code to set my entries, but ...
1
vote
1answer
40 views

How to create ordered list of categories from multiple category groups

I have got multiple category groups and I need to concatenate them into one list for a filter UI element. At the moment I have the following: {% set categories = craft.categories.group('colour').all(...
2
votes
1answer
35 views

Set OrderBy on Grouped Query Involving Smart Map Field

I'm working with a Structure of resort locations. Each resort has a field address which is a SmartMap field. I'm trying to create an initial display page that groups the resorts based on their state (...
2
votes
0answers
86 views

Order entries by custom date field

I want to modify this query so that the dated entries are sorted in descending order on a custom field called 'startDate'. Have tried adding .order('startDate') to the end of the craft.entries(query)....
1
vote
1answer
61 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
0answers
58 views

How to sort entries of a timeline?

I am building a timeline which I want to paginate. For this to be efficient, the timeline entries should be in a linear order. The challenge is that entries before present (BP) have to be in ...
0
votes
0answers
120 views

Ordering search by score and a custom field

I've got a product search results page which works great and orders results by searchScore. However, I need to also allow for "priority" results based on a custom lightswitch field. I'm setting a '...
1
vote
1answer
48 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 ...
0
votes
1answer
70 views

How do I send PayPal the Craft Commerce Order Number?

The client is using PayPal Express for the payment gateway. When orders are placed, Paypal shows the ID for the order, not the Order Number. Is there somewhere I can change that?
1
vote
0answers
95 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
307 views

Placing a Test Order (Craft Commerce)

This is a really basic question but I have had trouble finding an answer, or documentation on it. What is the best way to place a test order with a default Craft Commerce installation? I'm unable to ...
1
vote
2answers
159 views

Craft CMS - Dynamic Order Field Layout In Sections

I'm wanting to have the order of my elements within a template dynamic so that the user whilst in a template of page can reorder the modules as they please. See screenshot for example Within the ...
2
votes
3answers
64 views

Show time ordered entries from midnight at end of loop

I'm creating a line up listing page for a festival, across 4 nights. Acts are listed, per day, sorted by a date field in order of a start time field. The issue I'm having is that midnight until 3am ...
1
vote
1answer
212 views

Sort matrix blocks by date and limit to 10 entries

I'm loading multiple matrix blocks from multiple entries to the homepage if the date is today or in the future. So far this works but now I'm trying to sort the blocks by date and limit the output to ...
1
vote
1answer
91 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
232 views

Order a paginated entry by postDate

I'm stumped trying to order paginated entries for a channel. The end goal is to have listings with the most recent postDate at the top. The code below has the most recent item third instead of first. ...
1
vote
1answer
658 views

Entries order postDate not working

I'm trying to get prev/next entry using positionedAfter and positionedBefore filters but getting weird order on results because order('postDate desc') seems to be ignored. {% set prevSibling = craft....
1
vote
0answers
140 views

Craft Commerce: Sort products by Sale price

Trying to sort products by price. {% set products = craft.commerce.products({ type: 'footwear', limit: shopSettings.productsPerPage, order: 'defaultPrice asc', }) %} It works fine. Please ...
3
votes
1answer
85 views

Ordering entries based on an eager-loaded element's custom field

I have a query that loads a set of movies, and eager-loads corresponding shows, which are related elements. For now, the movies are sorted by startingDate, which is a custom field in the movie entry: ...
1
vote
1answer
183 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 ...
1
vote
1answer
285 views

Sort products by category field value

All of my products have a category field called stateCat. These state categories have a field called stateImportance. This is because some states are more important than others and I want to sort the ...
1
vote
1answer
31 views

Disable ordering

I'm attempting to output a list of entries using slug names. When I do the following, the entries are automatically reordered in alphabetical (title) order. Same thing happens if I target the ID's ...
0
votes
1answer
103 views

How to get latest entries by particular field?

I have 4 fields in my section: -Images -Videos -GIFs -PNGs On my homepage, I have a section where I have to show 5 latest entries of Images, Videos, GIFs & PNGs. How can I do that ? I tried: ...
3
votes
1answer
169 views

Ordering Structure Sections with Structure Handles

I am using the code below to output a group of sections that have entries along with their section handle. How would I order the sections (ideally by structureId)? I'm not opposed to using supersort ...
2
votes
2answers
76 views

Another gallery question

I have looked around but cant find an answer to this. I have a structure for my gallery page, in-which there are three separate entries called A, B and C. There are different images within these ...
1
vote
2answers
131 views

Order entries, exclude 'the' from order criteria

I know this is partly a Twig question, but I've poked around quite a bit here, in Twig docs, Craft docs, and cannot find the right syntax. I have a bunch of entries with titles like: Hotel A Grand ...
1
vote
1answer
170 views

Ordering/sorting products by their variant stock level

I'm trying to implement a sort order in my product listings so that all of the out of stock products are last. I'm unsure how or if this is possible because the stock is set on the variants of a ...
2
votes
1answer
531 views

Order/sort a structure section by date too?

Is it possible to have a Structure section ordered by date (desc) as a default and then take the custom ordering in the CP into account?
1
vote
1answer
56 views

How can I do nested ordering?

I want to put the index of section in order by two fields: featured and startDate. Basically, I want the featured entries to rise to the top of the index, and then within the featured posts I want ...
2
votes
2answers
396 views

Order entries based on date field in the Control Panel

I have some entries and I want to order them in the Control Panel based on a date field of those entries. Is that possible ?
2
votes
0answers
165 views

Sort entries by related entry title

I’m trying to sort entries from a section called exhibitions by startDate and then by the title field of a related gallery entry. So exhibition entries with the same entry.startDate are ordered ...
1
vote
1answer
209 views

Yearly/Monthy archive listing sorted by month

I've got a list of entries grouped by year which is working correctly except that the months are being output in the the reverse order. This code outputs the years in the correct order but the months ...
1
vote
0answers
80 views

Different order per locale for Structures

I know this is a long shot, but is there a way to order a Structure differently per locale? As in the standard drag and drop ordering that comes with a structure but with the ordering saved for each ...
2
votes
2answers
130 views

How can I order a sections entries by their children entry postDate?

Is it possible to order a section of entries by their child entries post date? {% for article in craft.entries({ section: 'articles', type: 'videoArticle', limit: 6 }).getChildren().order(...
1
vote
1answer
155 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
287 views

Ordering relatedTo entries

There are a few tickets touching on this, but the solutions proposed aren't working and I'd like to share the use case: I have a Table of Contents page that is outputting a set of entries based on an ...
2
votes
1answer
50 views

Hide users without profile pics

I'm working on a site that has logins for members, but I'd like to have a page that shows all members with a name and picture. To do this, we had to import an existing database that doesn't have a lot ...
1
vote
1answer
288 views

Order by related entries count

I have a channel with a related users field. I want to output all channel entries ordered by the number of related users, this is what i have so far: {% set entries = craft.entries.find({ ...
1
vote
1answer
97 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)....
3
votes
1answer
419 views

Output entries sorted by category title and paginate

I'm stuck on an issue where I have to paginate a list of entries that would be sorted by category title. So basically, I need to: fetch entries in the 'project' section sort those entries by the '...
1
vote
1answer
117 views

Set Parameters from User Input

Is there a way to set parameters from front-end user input? Let's say I have a page that displays a list of entries. On that page, I have a form select called paidStatus with options notReceived, ...
1
vote
1answer
499 views

Loop through entries with custom ordering, showing one from each category then start loop again

I have a channel with entries that may or may not have a custom date field populated. I'd like the display a list of entries, looping through each category, showing one entry from each category. Then ...
1
vote
1answer
80 views

Unable to sort large number of blocks in Matrix field in CP and template

I have about 145 blocks in a single Matrix. If I try and re-arrange (drag&drop) the first few blocks, and then hit save, all is well. However, trying to re-arrange the last few blocks doesn't save ...
0
votes
1answer
186 views

Order merged query by shared field

I’m trying to merge two query sources (some entries and some categories) but have them ordered by a shared field that is a date field. Here’s what I have so far: set classesLocations = craft.entries....