Forums / Setup & design / Need help to fetch many classes and sort them

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