We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16313
    • 71 Posts
    Hello guys,
    How can I sort results by order number in the Manager?
    I tried this way but no luck sad
    &sort=`[{"sortby":"idx","sortdir":"DESC"}]`
      • 4172
      • 5,888 Posts
      try
      &reverse=`1`
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 23819
        • 37 Posts
        Hey there,

        I'm having trouble getting &sort to function predictably on a site I'm putting together for a client.

        I'm sorting with 3 criteria, two "year" numbers, and an order index for entries that land in the same place with the other two (same creation year, same release year).

        My snippet call looks like this:

          [[!getImageList? 
                        &tvname=`Cinema`
                        &tpl=`ligneCV`
                    	&sort=`[{"sortby":"datecasting","sortdir":"DESC","sortmode":"numeric"},{"sortby":"datesortie","sortdir":"DESC","sortmode":"numeric"},{"sortby":"yearorder","sortdir":"DESC","sortmode":"numeric"}]`
                    	]]
        


        To be as clear as possible, "datecasting" and "datesortie" are both years, and is supposed to be used as an int for sorting movies casted and released on identical years.


        The issue I'm having is that on the page I ran my tests on this worked fine, but on some other pages it only takes the first two sort criteria into account and seems to be ignoring my third one.


        Here is an example of template variable content as it is stored in the database on which the sorting ignores the "yearorder" entries :
        [{"MIGX_id":"6","title":"WEST COAST","image":"462249.jpg-r_1920_1080-f_jpg-q_x-xxyxx.jpg","rea":"Benjamin Weil","prod":"Jéricho Films","datecasting":"2014","datesortie":"","precision":"","autres":"Assistante de Gigi Akoka","url":""},{"MIGX_id":"5","title":"UNE SEMAINE SUR DEUX","image":"19121971.jpg-r_1920_1080-f_jpg-q_x-xxyxx.jpg","rea":"Ivan Calberac","prod":"Mandarin Cinéma","datecasting":"2009","datesortie":"","precision":"","autres":"Assistante de Christel Baras","url":""},{"MIGX_id":"10","title":"JUVENTA","image":"./169h.jpeg","rea":"Emilie Lamoine","prod":"Aurora films","datecasting":"2007","datesortie":"","precision":"","autres":"Directrice de casting (court-métrage)","url":"","yearorder":"200702"},{"MIGX_id":"9","title":"LE PREMIER VENU","image":"18909891.jpg-r_1920_1080-f_jpg-q_x-xxyxx.jpg","rea":"Jacques Doillon","prod":"Liaison Cinématographique / Artémis productions","datecasting":"2007","datesortie":"","precision":"","autres":"Directrice de casting enfants et second rôles France","url":"","yearorder":"200701"},{"MIGX_id":"1","title":"LE BEL AGE","image":"19202257.jpg-r_1920_1080-f_jpg-q_x-xxyxx.jpg","rea":"Laurent Perreau","prod":"Galatée films","datecasting":"2008","datesortie":"","precision":"","autres":"Assistante de Christel Baras","url":"","yearorder":"1"},{"MIGX_id":"2","title":"L'AUTRE","image":"19039945.jpg-r_1920_1080-f_jpg-q_x-xxyxx.jpg","rea":"Pierre Trividic et Patrick Mario-Bernard","prod":"Ex Nihilo","datecasting":"2008","datesortie":"","precision":"","autres":"Assistante de Christel Baras","url":"","yearorder":"2"},{"MIGX_id":"3","title":"LA ROBE DU SOIR","image":"19241719.jpg-r_1920_1080-f_jpg-q_x-xxyxx.jpg","rea":"Myriam Aziza","prod":"Mille et une productions","datecasting":"2008","datesortie":"","precision":"","autres":"Assistante de Christel Baras","url":"","yearorder":"3"},{"MIGX_id":"4","title":"LA REGATE","image":"19226248.jpg-r_1920_1080-f_jpg-q_x-xxyxx.jpg","rea":"Bernard Bellefroid","prod":"Liaison Cinématographique / Artémis productions","datecasting":"2008","datesortie":"","precision":"","autres":"Assistante de Christel Baras","url":"","yearorder":"4"}]



        I'm trying to guess what could be causing this, and have tried multiple things to no avail.

        Do you have any ideas or suggestions as to what I should look for / try next?
          • 4172
          • 5,888 Posts
          if you need sorting like that, it might be better to have entries within a custom-db-table and use a MIGXdb-TV or a MIGXdb-CMP to manage them.

          It is a bit more work to set it up, but you can sort and filter much better.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 23819
            • 37 Posts
            Thank you for the suggestion (and for all your work creating Migx in the first place!)

            I already have a significant amount of data in MIGX format within this site, so I'm a little reluctant to move it all over to a db-table. I do understand why it would be better to, however. I might have to negotiate this feature with the client as it was not originally included in our agreement.

            Is it expected behavior for the &sort option might not take more than 2 criteria into account?

            Thanks again!

            Quote from: Bruno17 at Jan 12, 2018, 08:48 AM
            if you need sorting like that, it might be better to have entries within a custom-db-table and use a MIGXdb-TV or a MIGXdb-CMP to manage them.

            It is a bit more work to set it up, but you can sort and filter much better.
              • 23819
              • 37 Posts
              So in the end I found the solution to my problem. It was simple, in order for sorting to be effective with the format in which MODX stores date TV values by default, I had to use:

              "sortmode":"string"

              Now sorting works as expected!