Forums / Developer / fetch content list with attribute filter

fetch content list with attribute filter

Author Message

David Santiso

Thursday 07 April 2011 12:00:36 pm

Hi,

I want fetch content list with attribute filter, But the attribute I want to filter is an object relationship.

How can I do it?

Thanks,

David

Carlos Revillo

Friday 08 April 2011 12:09:56 am

Hi David.

If it is a object relation and no a object relation list, you can filter by the contentobject_id of the related object.

Example

attribute_filter( array( array( 'class/attr', '=', 60 ) )

beign 60 the object_id of the related object.

David Santiso

Friday 08 April 2011 9:55:57 am

'class/attr'? Is 'attr' the attribute name and is 'class' the class name?

I've put this:

{def $content=fetch( 'content', 'list',
                     hash( 'parent_node_id', $filter,
                           'sort_by', array( 'published', false() ),
                           'attribute_filter', array( array( 'class_name/attribute_name', '=', 143 ) ) ) )}

Carlos Revillo

Friday 08 April 2011 10:08:44 am

"

'class/attr'? Is 'attr' the attribute name and is 'class' the class name?

"

yes. that's it. you can use the id of the contentclassattribute_id instead if you prefer.

David Santiso

Friday 08 April 2011 10:52:24 am

Sorry, but I don't understand. When I put 'class_name/attribute_name':

'class_name' -> The class name containing the attribute.

'attribute_name' -> The class attribute (Object Relation).

'143' -> contentobject_id of referenced object.

Yes?

If so, doesn't work.

Carlos Revillo

Friday 08 April 2011 11:00:27 am

yes. that's what i say. it should work like that. class_name/attribute_name is a object relation and no object_relation_list, right? if second then that won't work, but if it's the first, then it should...

Carlos Revillo

Friday 08 April 2011 11:02:25 am

it could help if you enable your debug and sqloutput. after clearing caches and requesting your page, you should see all the queries needed for generating the page. one of them should be using that '143' somewhere...

maybe you can check that and see if debug says something about...

David Santiso

Saturday 09 April 2011 4:36:02 am

Yes, attribute_name is object_relation datatype and no object_relation_list.

How do I enable the sqloutput debug?

David Santiso

Monday 11 April 2011 11:33:47 am

I've activated debug sqloutput. Shows message: Attribute filter returns false

The identifier I'm using is one of the possible identifier objects that can be referenced by the attribute.

David Santiso

Tuesday 12 April 2011 11:03:44 am

My object_relation datatype is a selection list with the children of a folder class.

Can the problem be out there?

Denitsa M.

Friday 15 April 2011 5:23:15 am

-

Iguana IT - http://www.iguanait.com

eZ debug

Timing: Jan 18 2025 03:09:42
Script start
Timing: Jan 18 2025 03:09:42
Module start 'content'
Timing: Jan 18 2025 03:09:43
Module end 'content'
Timing: Jan 18 2025 03:09:43
Script end

Main resources:

Total runtime0.9606 sec
Peak memory usage4,096.0000 KB
Database Queries220

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 587.8438180.8203
Module start 'content' 0.00680.8173 768.6641620.4219
Module end 'content' 0.82410.1365 1,389.0859341.1563
Script end 0.9606  1,730.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00450.4665210.0002
Check MTime0.00160.1675210.0001
Mysql Total
Database connection0.00070.070710.0007
Mysqli_queries0.873290.89542200.0040
Looping result0.00230.23562180.0000
Template Total0.930696.920.4653
Template load0.00220.227220.0011
Template processing0.928496.643120.4642
Template load and register function0.00020.020810.0002
states
state_id_array0.00110.119310.0011
state_identifier_array0.00170.182020.0009
Override
Cache load0.00190.2024490.0000
Sytem overhead
Fetch class attribute can translate value0.00150.151440.0004
Fetch class attribute name0.00110.1135110.0001
XML
Image XML parsing0.00080.079340.0002
class_abstraction
Instantiating content class attribute0.00000.0021110.0000
General
dbfile0.00620.6460210.0003
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
11content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
2content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
2content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 31
 Number of unique templates used: 8

Time used to render debug report: 0.0002 secs