I've run into some problems with the sorting of some reverse related entries. There's just some limitations with EE and I'm looking for a quick solution.
I have two channels: registrations and students. Students has a relationship field that links each entry to an entry in the registrations channel. (I need to continue to use the EE relationships field.)
The students channel has two category groups assigned to it: grades (group #1) and instrument (group #2). Category IDs #1-6 are in the grades category.
The following code achieves half of what I need it to do:
{exp:channel:entries channel="registrations" entry_id="{segment_4}" dynamic="no"}
<table>
{reverse_related_entries channel="students"}
{categories show="1|2"}
<tr>
<td><?php print $count; ?>.</td>
<td>{title}</td>
{embed="_includes/student_print" student_id="{entry_id}"}
</tr>
{/categories}
{/reverse_related_entries}
</table>
<table>
{reverse_related_entries channel="students"}
{categories show="3|4"}
<tr>
<td><?php print $count; ?>.</td>
<td>{title}</td>
{embed="_includes/student_print" student_id="{entry_id}"}
</tr>
{/categories}
{/reverse_related_entries}
</table>
<table>
{reverse_related_entries channel="students"}
{categories show="5|6"}
<tr>
<td><?php print $count; ?>.</td>
<td>{title}</td>
{embed="_includes/student_print" student_id="{entry_id}"}
</tr>
{/categories}
{/reverse_related_entries}
</table>
{/exp:channel:entries}
Here's the student_print embed:
{exp:channel:entries channel="students" entry_id="{embed:student_id}" dynamic="no"}
<td><font size="2">{categories show_group="2"}{category_name}{/categories}</font></td>
<td><font size="2">{categories show_group="1"}{category_name}{/categories}</font></td>
{/exp:channel:entries}
Now -- what I need it to do is order the reverse related entries by the CUSTOM ORDER of the categories in the instruments category group (group #2). I just didn't know how to go about doing what I'm currently doing (displaying the three tables -- each displaying entries from specific categories in group #1) and putting them in the custom order of the categories in group #2.
Again -- the categories in group #2 are in a custom order and I need to display the related entries in that custom order. This is important.
Can this be done with a custom query? This is stretching my EE and SQL chops.