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.

Sorting two channels by a single (or two) fields

October 09, 2013 8:17am

Subscribe [1]
  • #1 / Oct 09, 2013 8:17am

    intunet

    46 posts

    Hi,
      What I’d like to do is pretty simple.

    {exp:channel:entries channel="products|manuals" paginate="bottom" limit="10" dynamic="no" orderby="title" sort="asc"}

    Pulls in the content of two channels and displays them ordered by title. Pretty simple and works nicely.

    Now what I would like to do is instead be able to do a manual ordering on the items in this field, from both channels.

    The problem is of course, that two channel-fields can’t have the same short-name so I can’t reference the same shortname for both of them.

    So now the manual channel has a field ‘order-by-manual’ and the products channel has a field ‘order-by-product’, both of which are interger field.

    Using orderby=“order-by-manual|order-by-product” puts all of the manuals first, then all of the products. They order correctly within their own sections.

    What I want to do however is have it so they work off both.

    So if i have ‘Manual A’ with an orderby value of 1
    Manual B has an orderby value of 4
    Product A has an orderby value of 2
    Product B has an orderby value of 3

    Then it would display:

    Manual A
    Product A
    Product B
    Manual B

    Where as currently what it does is:

    Manual A
    Manual B
    Product A
    Product B

    If there is a way round this, or a way to add the same field to both channel fields, that would be lovely as I can’t see how this isn’t a standard feature. The only way I can see how to do this at the moment is to use MSN and create a 2nd site just to pull in the 2nd set of channels with the same variable name. Clearly this isn’t a feasible alternative.

    Unfortunately both channels can’t use the same channel-field as they need vastly different admin options, which would be very confusing if they both had lots of unused (and misleading) fields depending on which option they are.

    Thanks

    Steven Lockey

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

ExpressionEngine News!

#eecms, #events, #releases