Attribute Filter - or changing to and in SQL

Author Message

Chris Lukenbill

Tuesday 07 November 2006 9:15:08 am

I'm trying to do an attribute filter for a menu that is showing two different classes which both have a "show in menu" attribute on them. However, when I look at the sql that is being generated, it is doing an 'and' when I am specifying 'or'.

The fetch in my template:

    $menuitems=fetch( content, list, hash( 
      parent_node_id, $root_node_id,
      class_filter_type, 'include',
      class_filter_array, ezini('MenuContentSettings','LeftIdentifierList', 'menu.ini'),
      sort_by, $menu_node.sort_array,
      'attribute_filter', array('or',array( 200, '=', '1' ), array( 264, '=', '1' ))))

The portion of SQL code that is generated:

                                       a1.contentobject_id = ezcontentobject.id AND
                                       a1.contentclassattribute_id = 200 AND
                                       a1.version = ezcontentobject_name.content_version AND 
 ( a1.language_id & ezcontentobject.language_mask > 0 AND
     ( (   ezcontentobject.language_mask - ( ezcontentobject.language_mask & a1.language_id ) ) & 1 )
   + ( ( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & a1.language_id ) ) & 2 ) )
   <
     ( a1.language_id & 1 )
   + ( ( a1.language_id & 2 ) )
 ) 
 AND 
                                       a2.contentobject_id = ezcontentobject.id AND
                                       a2.contentclassattribute_id = 264 AND
                                       a2.version = ezcontentobject_name.content_version AND 
 ( a2.language_id & ezcontentobject.language_mask > 0 AND
     ( (   ezcontentobject.language_mask - ( ezcontentobject.language_mask & a2.language_id ) ) & 1 )
   + ( ( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & a2.language_id ) ) & 2 ) )
   <
     ( a2.language_id & 1 )
   + ( ( a2.language_id & 2 ) )
 ) 

any ideas?

Claudia Kosny

Tuesday 07 November 2006 9:24:18 am

Hi Chris

According to the documentation for the content list fetch function this is not possible yet.

...
It is not possible to filter on attributes of different classes, for example it is not possible to filter on both "article/show_comments" and "folder/show_comments" in the same filter.
...

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

So for now the only way I see is to make two separate fetches, one for each class type.
Maybe an extended attribute filter could also help you, but I have never implemented one so I don't know.

Claudia

Chris Lukenbill

Tuesday 07 November 2006 9:36:32 am

Thank you very much for your help. I interpreted that to mean you can't do a filter on just "show_comments" but would instead have to use an or and specify each of them seperately.

I'll see how I can work around it.

Thanks,

Chris

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