4

I’m having some issues with the fixed_order parameter.

I’m running a query to order by a matrix col

{embed="_includes/_ajax_results" 
    entry_ids="{exp:query sql="SELECT entry_id FROM exp_channel_titles 
        INNER JOIN exp_matrix_data using(entry_id) 
        WHERE channel_id ='4' 
        AND field_id ='13'
        AND status ='open'
        ORDER BY col_id_21 DESC "}{entry_id}|{/exp:query}"} 

If I head to my embed template… and print {embed:entry_ids} I get my list of entry_ids in the correct order I need them

90|94|89|91|95|93|86|92|87|88|79| 

However as soon as I use this in a channel tag, it gets ignored and the order reverts to the default date order.

{exp:channel:entries 
 channel="strand" 
 dynamic="no" 
 disable="member_data|pagination" 
 cache="no" 
 fixed_order="{embed:entry_ids}"}

   {strand-overview}

{/exp:channel:entries} 

If i hard code my entry_id embed into the param, the order works…

{exp:channel:entries 
 channel="strand" 
 dynamic="no" 
 disable="member_data|pagination" 
 cache="no" 
 fixed_order="90|94|89|91|95|93|86|92|87|88|79|"}
   {strand-overview}
{/exp:channel:entries} 

so for some reason my {embed:entry_ids} isn’t working… Any ideas?

EE 2.5.3

| improve this question | | | | |
2

I suspect it has something to do with the parse order of the tags. Could you try adding parse='inward' to your {exp:channel:entries} tag.

You can check if it is embedding the values or the entire {exp:query} tag if you turn on template debugging and look at how the entries tag is parsed.

– Wouter

| improve this answer | | | | |
  • Thanks Wouter - Parse Inward didn't do anything in this instance. However, turns out my @hellomountee wasn't working and my templates weren't updating... so, no mistake to fix, just needed a remount of my templates. Doh! – Jamie Taylor Dec 13 '12 at 11:27
  • Go figure.. it's always something as simple as that. – Wouter Vervloet Dec 14 '12 at 12:34
1

First check to make sure your query is printing correctly outside of the embed code.

If it is returning results correctly, next look at your quotes. Try removing the quotes for the entry_ids parameter, so entry_ids="QUERY" becomes entry_ids=QUERY.

| improve this answer | | | | |
  • Wouter is probably right with his parse answer... try parse="inward" before my suggestions. – Anna_MediaGirl Dec 12 '12 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.