Forums / Developer / Fetch - sort and filter by attribute in mixed folder

Fetch - sort and filter by attribute in mixed folder

Author Message

Lisa Pini

Thursday 19 June 2008 8:36:52 am

Hi,

I've been using EZ for a few weeks, and I've been experiencing many problems with <b>heterogeneous folder</b> (folder with miscellaneus content types like articles, folders and forms together) when I try to <b>sort</b> or <b>filter</b> by attribute.
I added in every class that can be in my folder these attributes:
- <b>publish_date</b> (of type date and time)
- <b>unpublish_date</b> (of type date and time)
- <b>show_folder</b> (of type date)
- <b>view_data</b> (of type checkbox)

1) <b>Order</b>
I need to order by view_data. Can I use '<b>sort_by</b>'?
I read in the manual that I should add to the 'sort_by' rule the class name to order by attribute (ex: 'sort_by', array( 'attribute', true(),'article/data')), but I don't know how to use it with article, folder and form together...

2) <b>Filter role</b>
- view_data must be = 1
- if publish_date is not empty, publish_date <= now
- if unpublish_date is not empty, unpublish_date => now
How can I do it?
I read this post, but they did not help me:
http://ez.no/developer/forum/general/template_fetch_avoid_the_extended_attribute_filter
http://ez.no/developer/forum/setup_design/complex_attribute_filter_in_fetch/re_complex_attribute_filter_in_fetch
I think that I should use <b>extended_attribute_filter</b>, I tried it but my filter worked as expected when only one filter role was set.
Can anyone post a code example for my case?

Thanks,
Lisa

eZ debug

Timing: Jan 18 2025 11:25:03
Script start
Timing: Jan 18 2025 11:25:03
Module start 'content'
Timing: Jan 18 2025 11:25:03
Module end 'content'
Timing: Jan 18 2025 11:25:03
Script end

Main resources:

Total runtime0.2116 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 588.9766180.8125
Module start 'content' 0.00770.0057 769.789193.8203
Module end 'content' 0.01340.1981 863.6094525.3750
Script end 0.2115  1,388.9844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00391.8498200.0002
Check MTime0.00180.8514200.0001
Mysql Total
Database connection0.00080.356710.0008
Mysqli_queries0.160875.99381410.0011
Looping result0.00140.67991390.0000
Template Total0.197793.510.1977
Template load0.00090.405410.0009
Template processing0.196993.050110.1969
Override
Cache load0.00060.277910.0006
Sytem overhead
Fetch class attribute can translate value0.00080.387110.0008
XML
Image XML parsing0.00030.127110.0003
General
dbfile0.00341.6287200.0002
String conversion0.00000.003730.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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