Need help to fetch many classes and sort them

Author Message

Sébastien Antoniotti

Tuesday 13 March 2007 7:57:08 am

Hi,

In my eZ publish site I have 3 classes (artist, album and song) and wich of them have an attribute named "name".

So I would like to fetch all objects (nodes) of these 3 classes and order them on their "name" attribute first, and not on the class ID.

Example : Considering that under the node 59 we have this :

- Toto (instance of class artist)
- Tata (instance of classe song)
- Tutu (instance of classe album)

I would like to make a fetch that give me this order :

1) Tata
2) Toto
3) Tutu

Thanks in advance !

eZ Publish Freelance
web : http://www.webaxis.fr

Sébastien Antoniotti

Friday 16 March 2007 9:10:12 am

Help please !

eZ Publish Freelance
web : http://www.webaxis.fr

Sébastien Antoniotti

Monday 26 March 2007 8:23:49 am

please help !

eZ Publish Freelance
web : http://www.webaxis.fr

Felix Woldt

Monday 26 March 2007 11:01:10 am

Hi Sebastian,

have a look here

http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/list

you can sort your fetch after 'name'

{fetch( 'content', 'list',   hash( 'parent_node_id', 42,
                                          'sort_by',  array( array( 'name',      false() ),  array( 'published', false() ) ,
                                          'class_filter_type',  'include',
                                          'class_filter_array', array(  'class_identifier_1',  'class_identifier_2' , 'class_identifier_3' ) ) ) }

This code should be work.

Felix

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

Sébastien Antoniotti

Tuesday 27 March 2007 12:40:07 am

Hi Felix,

Thanks a lot, all is ok now !

I'm sorry that it was in th documentation =(

good dev !

eZ Publish Freelance
web : http://www.webaxis.fr

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 31 2025 00:16:32
Script start
Timing: Jan 31 2025 00:16:32
Module start 'layout'
Timing: Jan 31 2025 00:16:32
Module start 'content'
Timing: Jan 31 2025 00:16:32
Module end 'content'
Timing: Jan 31 2025 00:16:32
Script end

Main resources:

Total runtime0.0214 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 588.2656151.2266
Module start 'layout' 0.00460.0040 739.4922220.7188
Module start 'content' 0.00860.0113 960.21091,001.9609
Module end 'content' 0.01990.0015 1,962.171937.9922
Script end 0.0214  2,000.1641 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002612.0179140.0002
Check MTime0.00125.4356140.0001
Mysql Total
Database connection0.00083.832710.0008
Mysqli_queries0.002511.475730.0008
Looping result0.00000.051210.0000
Template Total0.00115.310.0011
Template load0.00094.243410.0009
Template processing0.00020.985210.0002
Override
Cache load0.00073.094610.0007
General
dbfile0.00021.013080.0000
String conversion0.00000.051240.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