reverse_related_objects multiple categories, IDs or some other solution

Author Message

Ivan Švogor

Thursday 04 November 2010 8:21:22 am

Hello,

I've added object relations to my Article class. Now, I can have categories (as is suggested in some manual). And now, I would like to list articles by this relatet object. So I use reverse_related_objects function in my template. And it's ok. It works, I get articles that are in category I want to see. This is controled by object_id parameter.

But now, I have articles that are related to two, or more classes (or categories). Now, I cannot use reverse_related_objects any more becouse object_id parameter is integer, not an array.

My question is how can I get this working. Article with related object class, a few custom classes representing categories, and now I want to list all articles that are related to multiple object, or categories. (I need them to be mixed, becouse list with first category A, than B, than C.. that would be messy)

I would appriciate any ideas or suggestions. Thanks!

Ilya Sazonov

Saturday 06 November 2010 6:09:02 am

The answer is quit using reverse_related_objects . You can use fetch('content','list' ... . But to make it serve your purpose you should use extended_attribute_filter 'ObjectRelation' which can be found in the following extension

http://projects.ez.no/objectrelationfilter

Maybe it's present out of the box now, i'm not sure, read this

http://projects.ez.no/objectrelationfilter/news/moving_objectrelationfilter_from_contribs

My eZpublish version is 4.0.1, so I had to install an extension, but it was worth it.

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