We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19604 ☆ A M B ☆
    • 179 Posts
    Hi there,

    how can I sort the getResources output by the "resources"? In other words: How can I avoid any sorting at all? If I call "... &resources=’88,2,203,56’ ..." I want the output in exact the same order, i.e. "88,2,203,56".

    Using "... &sortby=’resourses’ ..." is NOT working at all. Also GitHub isn’t much of a help: https://github.com/opengeek/getResources/pull/23

    How can this be done? Is this possible at all?


    thanks
    Oliver

    P.S.: Is there a docu update for 1.3.0-pl?
      MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
      http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver
      • 30319
      • 406 Posts
      Assuming these are child resources under a parent resource, you could assign arbitrary menu IDs to each item, then add these parameters: &sortby=`menuindex` &sortdir=`asc`.

      HTH Tom
        • 4172
        • 5,888 Posts
        here is a modified version which does that:
        http://modxcms.com/forums/index.php?topic=52337.60
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 19604 ☆ A M B ☆
          • 179 Posts
          Quote from: TomMLS at Mar 29, 2011, 06:54 AM

          Assuming these are child resources under a parent resource, you could assign arbitrary menu IDs to each item, then add these parameters: &sortby=`menuindex` &sortdir=`asc`.

          Thanks for your hint. This was, in fact, my "poor guys work around". ;-) It got me as close as possible to what I wanted but does not solve my wish to realy have the EXACT order.
            MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
            http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver
            • 30319
            • 406 Posts
            Not everyone wants to change ’core’ code, and the menuid method permits changing the order at any time simply by changing the menu id.
            Also this method would not survive updates to getResources -- it could be released as a new addon??
            Resources can be excluded with &resources=`-21` where the - minus sign means exclude resource ID #21.
            HTH Tom
              • 30319
              • 406 Posts
              Why does modifying the menu ids not provide you the "EXACT" order you want??

              The menu id is a separate data field from the resource id, which is immutable, the MODx developers do not recommend changing it.

              End users never see either ID number, they only see the output.

              Puzzled, Tom
                • 19604 ☆ A M B ☆
                • 179 Posts
                Quote from: TomMLS at Mar 29, 2011, 07:07 AM

                Not everyone wants to change ’core’ code, and the menuid method permits changing the order at any time simply by changing the menu id.
                Also this method would not survive updates to getResources -- it could be released as a new addon??
                Resources can be excluded with &resources=`-21` where the - minus sign means exclude resource ID #21.

                Right. No CoreHacks!

                Thanks for your help, but I get the feeling that we are drifting apart a little.

                I am calling "getResources" to get me some "related resources", which are spread over the whole tree. These related resource MUST appear in a certain order, represented by the sequence I handle over to getResources. So, there are no parents - just resources. By setting parent=’-1’ I can surpress the parents and only get the resources I requested (but in the wrong order) (see my post: http://modxcms.com/forums/index.php/topic,55468.msg347891.html#msg347891)

                My problem with the "no sort att all" sounds like a very simple thing. Is there a simple solution?

                best
                Oliver
                  MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
                  http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver
                  • 19604 ☆ A M B ☆
                  • 179 Posts
                  Quote from: TomMLS at Mar 29, 2011, 07:09 AM

                  Why does modifying the menu ids not provide you the "EXACT" order you want??
                  The menu id is a separate data field from the resource id, which is immutable, the MODx developers do not recommend changing it.
                  End users never see either ID number, they only see the output.

                  Sorry, Tom, it’s not exact because the resources are located in different parts of the tree and are on no order at all. It’s just like "4,7,2,5,1".

                  And it’s a "backend" thing! I put those "related articles" in a TV as an comma separated list, like "4,7,2,5,1".
                    MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
                    http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver
                    • 30319
                    • 406 Posts
                    Ahhhh...perhaps minds greater than mine can illuminate your perplexity. smiley smiley

                    Thank you for explaining...

                    BTW new getResources 1.3.x-pl is out -- one of its new features may do what you want???
                    Find it in the Extras section.

                    HTH Tom
                      • 19604 ☆ A M B ☆
                      • 179 Posts
                      Quote from: TomMLS at Mar 29, 2011, 07:25 AM

                      BTW new getResources 1.3.x-pl is out -- one of its new features may do what you want???

                      I am already using 1.3.0-pl (see initial post #1) and it still is not working the way I want. Or are the new features somewhere documented telling how one can use them? Maybe I am just missing a thing here (which I realy hope ;-).

                      best
                      Oliver
                        MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
                        http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver