ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

order by custom field with reverse related entries

June 02, 2009 10:50pm

Subscribe [2]
  • #1 / Jun 02, 2009 10:50pm

    Paul Bland

    25 posts

    Hi,

    The documentation states: “Ordering by a Relationship type custom field will cause entries to appear in the order the relationships were made, not based on any content from the related entries.”

    Is there a way around this?

    I have an online news website, that uses related entries to link news articles to editions in which they appear. When viewing an edition, I would like to order the news articles by a “display_order” field.

    Thanks,
    Paul

  • #2 / Jun 02, 2009 10:51pm

    Paul Bland

    25 posts

  • #3 / Jun 02, 2009 11:16pm

    Paul Bland

    25 posts

    Actually, I may’ve misread that documentation page. I am ordering by a normal custom field, not a relationship field.

    But the orderby tag still doesn’t seem to work for me. Here is my code:

    {exp:weblog:entries weblog="editions" limit="1"}
        
        {reverse_related_entries orderby="display_order"}
            {display_order} - {title}
                
        {/reverse_related_entries}
    
    {/exp:weblog:entries}
  • #4 / Jun 03, 2009 5:21am

    Ingmar

    29245 posts

    What version and build of EE are you using? What does display_order contain? In what order are your entries displayed?

  • #5 / Jun 03, 2009 11:04pm

    Paul Bland

    25 posts

    EE Version is 1.6.7 Build:  20090211

    Display order (display_order) is a text input. Values have leading zeros (01-11), which has worked for ordering the articles on other pages (when not being accessed through reverse related entries).

    The results seem to be ordered by the rel_id from the exp_relationships table. (This is also the value of the “in_edition” relationship field, if printed out)

    (“in_edition” is a relationship field for articles, that is linked to the “editions” section, so the user can choose one of the editions the article appears in.)

    Hope that makes sense.
    Paul

  • #6 / Jun 04, 2009 12:08am

    Paul Bland

    25 posts

    I tried deleting and recreating the “display_order” and “in_newsletter” fields, and that has fixed the problem.

    (I changed the type of in_newsletter from drop-down to relationship during the development, so that may’ve caused problems)

    Thanks for your time
    Paul

  • #7 / Jun 04, 2009 6:27am

    Ingmar

    29245 posts

    Thanks for getting back to us and letting us know. Please post again if you need additional help.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases