Can a fetch be sorted by price?

Author Message

Alex Jones

Monday 16 February 2004 2:36:14 pm

I have the following code which is set up to sort the items of the fetch by an attribute (id: 162) which happens to be a price. But the results are not sorted by price. When I switch the attribute ID to another one within the same class such as the item number (Text Field), it is sorted properly. Am I missing something, or is sorting by Price not an option?

{let name=Child children=fetch('content','tree',
                                hash(parent_node_id,$parent_node,
                                     sort_by,array(array('attribute',false(),162)),
                                     limit,$page_limit,
                                     offset,$view_parameters.offset,
                                     depth_operator,eq,
                                     class_filter_type, "include",
                                     class_filter_array, array(14)))}

Thanks,

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Balazs Halasy

Tuesday 17 February 2004 12:04:50 am

Hi,

Copy & paste from the docs:

A collection of nodes can be sorted on the attribute level. This means that it is possible to sort a bunch of nodes (of the same type) by one of the attributes; for example sort nodes that contain information about people on the attribute that contains the nickname. The following datatypes support sorting on attribute level:

-ezboolean
-ezdate
-ezdatetime
-ezemail
-ezinteger
-ezselection (will not work when used as multiple selector)
-ezstring
-eztime

..don't see the price datatype there.. so, I guess it is not possible at the moment. However, shouldn't be to hard to hack that in.

Balazs

PS: The docpage is: http://ez.no/ez_publish/documentation/reference/data_fetching/content/list

Alex Jones

Tuesday 17 February 2004 7:51:31 am

Ahhh... I can't believe I missed that documentation page. Thanks!

Guess I need to find a way to hack it.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Eirik Alfstad Johansen

Wednesday 03 August 2005 12:47:59 am

Hi Alex,

Were you able to hack this, and if so, would you be so kind as to give me a hint regarding how you did it?

Thanks in advance !

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Eirik Alfstad Johansen

Wednesday 03 August 2005 2:51:56 am

Hi again,

I've done some digging, and so far I've added the following two methods to kernel/classes/datatypes/ezprice/ezpricetype.php.

function &sortKey( &$contentObjectAttribute )
    {
        return $contentObjectAttribute->attribute( 'data_float' );
    }

    /*!
     \reimp
    */
    function &sortKeyType()
    {
        return 'int';
    }

However, this doesn't appear to be sufficient to get the sorting working.

Could someone please help me along, here?

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

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

eZ debug

Timing: Jan 18 2025 23:07:42
Script start
Timing: Jan 18 2025 23:07:42
Module start 'layout'
Timing: Jan 18 2025 23:07:42
Module start 'content'
Timing: Jan 18 2025 23:07:43
Module end 'content'
Timing: Jan 18 2025 23:07:43
Script end

Main resources:

Total runtime1.4200 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0088 587.9141152.6250
Module start 'layout' 0.00880.0060 740.539139.4609
Module start 'content' 0.01491.4037 780.0000607.9453
Module end 'content' 1.41860.0014 1,387.945316.1641
Script end 1.4200  1,404.1094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.3060160.0003
Check MTime0.00220.1557160.0001
Mysql Total
Database connection0.00120.083010.0012
Mysqli_queries1.350795.1231650.0208
Looping result0.00070.0481630.0000
Template Total1.355295.420.6776
Template load0.00220.153720.0011
Template processing1.353095.280020.6765
Template load and register function0.00010.006810.0001
states
state_id_array0.00300.210910.0030
state_identifier_array0.00190.134720.0010
Override
Cache load0.00190.1363420.0000
Sytem overhead
Fetch class attribute can translate value0.00050.035830.0002
Fetch class attribute name0.00110.079980.0001
XML
Image XML parsing0.00330.230830.0011
class_abstraction
Instantiating content class attribute0.00000.0018100.0000
General
dbfile0.00410.2862280.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs