Sorting by multiple attributes

Author Message

Albert Calmus

Wednesday 24 August 2011 7:27:51 am

Hello,

I use tree fetch function and I would sort by multiples attributes.
This means I have a syntax like this :

'sort_by', array(

array('attribute', false(), 'new_item/creation_date'),
array('attribute', false(), 'old_item/creation_date'),

)

It doesn't work and I don't find the solution in the doc :
http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/list

The fact that we cannot use the same sort method many times is written anywhere.

Thanks in advance !

Håvard Bergersen

Wednesday 24 August 2011 7:42:54 am

Is is the sorting that doesn't work, or does the whole fetch break?

Looks like you have a comma to much: 'old_item/creation_date'), <-

(Don't know if this i enough to break it but, worth a shot?)

 

 

EDIT:

I don't think you can sort on two different classes....?

Edi Modrić

Wednesday 24 August 2011 7:57:00 am

Havard is right, you cannot use attribute sorting if your fetch returns objects of multiple classes.

eZ Publish certified developer

http://ez.no/certification/verify/350658

Tyler Harms

Wednesday 24 August 2011 9:59:35 am

Instead have you tried using the .sortarray?

'sort_by', $your_node_parent.sort_array

That way the admin can control how items are sorted.

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

eZ debug

Timing: Jan 29 2025 13:36:03
Script start
Timing: Jan 29 2025 13:36:03
Module start 'layout'
Timing: Jan 29 2025 13:36:03
Module start 'content'
Timing: Jan 29 2025 13:36:03
Module end 'content'
Timing: Jan 29 2025 13:36:03
Script end

Main resources:

Total runtime0.0167 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 588.1328151.2109
Module start 'layout' 0.00540.0040 739.343836.6563
Module start 'content' 0.00940.0059 776.000094.2500
Module end 'content' 0.01530.0013 870.250033.9766
Script end 0.0166  904.2266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002213.4953140.0002
Check MTime0.00106.0969140.0001
Mysql Total
Database connection0.00095.627210.0009
Mysqli_queries0.004024.293030.0013
Looping result0.00000.090210.0000
Template Total0.00105.910.0010
Template load0.00084.743810.0008
Template processing0.00021.169810.0002
Override
Cache load0.00063.333410.0006
General
dbfile0.00127.033380.0001
String conversion0.00000.041540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs