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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.