Can a fetch be sorted by price?

Can a fetch be sorted by price?

Monday 16 February 2004 2:36:14 pm - 4 replies

Modified on Monday 16 February 2004 2:37:36 pm by Alex Jones

Author Message

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/

You must be logged in to post messages in this topic!

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