Forums / General / Sort by attribute trouble

Sort by attribute trouble

Author Message

Denis Zatsarinny

Wednesday 25 October 2006 9:46:37 am

Hi,

On few our sites used sorting by attribute like next

$items=fetch_alias(children, hash(parent_node_id, <some_node_id>, sort_by, array('attribute',false,'<class_name>/<some_attribute>'), ...)

<some_attribute> has type ezdate - its work fine on our sites with ez 3.7.6/3.7.9/3.8.3 - but not working on site with ez 3.8.4 !

I'm tried use array('attribute',false(),<attribute_id>) - but has same result.

Anybody can help me ?

Bye.

Kristof Coomans

Thursday 26 October 2006 1:24:57 am

Hello Denis

Have you enabled debug output, disabled template compile and content view cache?
Did you see any template errors then?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Denis Zatsarinny

Thursday 26 October 2006 1:48:50 am

Hi,

Yes - I was enabled debug output - but not got any error

Sorting working - but working wrong

IMHO - this is may be bug in PHP code or in the SQL statement

Bye.

Claudia Kosny

Wednesday 01 November 2006 9:21:58 am

Hi Denis

Enable SQL output and check the query - does the sort parameter appear there? (It might be useful to surround the fetch with a {debug-timing-point id ="foo"} to find the relevant query easier).

If the sort parameter does not appear in the query try with another sort parameter (just by name or so). Also try without using an fetchalias. Any changes?

Greetings from Luxembourg

Claudia

Denis Zatsarinny

Wednesday 01 November 2006 12:03:31 pm

Hi

4 Claudia Kosny:

I gotta get first upgrade from 3.8.4 -> 3.8.6 - maybe its solve this problem

Bye.

Luc Chase

Sunday 30 September 2007 11:13:36 am

Same or similar prob in 3.9.3

Trying to use a sort array to display sticky news to top of list in fetch_alias. Seems that fetch_alias can't accept an array of arrays for the sort.

This does not work... Empty variable name error.

{set 
list_items=fetch_alias( children, hash( parent_node_id, $node.node_id,
           offset, $view_parameters.offset,
           sort_by, array ( array( attribute, false(), 'news/sticky' ), $node.sort_array),
           limit, $page_limit ) ) }

This also does not work...

{set 
list_items=fetch_alias( children, hash( parent_node_id, $node.node_id,
          offset, $view_parameters.offset,
          attribute_filter, $time_filter,
          sort_by, array ( array( attribute, false(), 'news/sticky' ),array( 'published', false() ) ),
          limit, $page_limit ) ) }

But, this works...

  {set list_items=fetch_alias( children,hash( 'parent_node_id', $node.node_id,
                                                             'offset', $view_parameters.offset,
                                                             'sort_by', array(array( attribute,false(),'news/sticky' ), array('attribute', false(), 'news/date')),  
                                                             'limit', $page_limit ) ) }

and this works...

{set 
list_items=fetch_alias( children, hash( parent_node_id, $node.node_id,
         offset, $view_parameters.offset,
         sort_by, array( attribute, false(), 'news/sticky' ) ,
         limit, $page_limit ) ) }

And this works...

{set 
list_items=fetch_alias( children, hash( parent_node_id, $node.node_id,
         offset, $view_parameters.offset,
         sort_by, $node.sort_array,
         limit, $page_limit ) ) }

The Web Application Service Provider

eZ debug

Timing: Jan 18 2025 16:01:49
Script start
Timing: Jan 18 2025 16:01:49
Module start 'content'
Timing: Jan 18 2025 16:01:49
Module end 'content'
Timing: Jan 18 2025 16:01:49
Script end

Main resources:

Total runtime0.1532 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.0078 587.7031180.8438
Module start 'content' 0.00780.0072 768.5469101.9609
Module end 'content' 0.01510.1381 870.5078530.2734
Script end 0.1531  1,400.7813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00422.7114200.0002
Check MTime0.00150.9647200.0001
Mysql Total
Database connection0.00090.603210.0009
Mysqli_queries0.106469.46841410.0008
Looping result0.00110.71311390.0000
Template Total0.137689.810.1376
Template load0.00100.626710.0010
Template processing0.136689.175910.1366
Override
Cache load0.00070.430110.0007
Sytem overhead
Fetch class attribute can translate value0.00090.604410.0009
XML
Image XML parsing0.00030.206410.0003
General
dbfile0.00442.8888200.0002
String conversion0.00000.006530.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