Forums / Setup & design / Sort fetch by multiple attributes

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Sort fetch by multiple attributes

Author Message

Eivind Marienborg

Monday 13 November 2006 12:31:42 am

Hi!

I would like to do a fetch, and sort it first by priority, then by date. So if that I have a node with priority 10, and the rest is 0, the one with 10 is prioritized even though its published date is older then the ones with 0.

I have tried this:

{let page_limit=16
    children=fetch('content','list',hash( parent_node_id, $node.node_id,
                                          sort_by, array(array('priority','published'),true()),
                                          limit, $page_limit,
                                          offset, $view_parameters.offset
))}

But this makes it not sort at all. I have checked the debug output, but there doesn't seem to be any output of any error.

Is this kind of sorting mechainsm possible at all, and if so, how?

Jacobo Quiles

Monday 13 November 2006 1:04:51 am

Hi,

Try this:

children=fetch('content','list',hash( parent_node_id, $node.node_id,
sort_by, array(array( 'priority', true() ), array( 'published', true() )),
limit, $page_limit,
offset, $view_parameters.offset))}

Microblau SL
http://www.microblau.net