<![CDATA[ Sorting getImageList ?? - My Forums]]> https://forums.modx.com/thread/?thread=87507 <![CDATA[Sorting getImageList ??]]> https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-482034
  							[[!getImageList? 
    							&tvname=`recommendations`
								&sortBy=`date`
								&sortDir=`desc`
		  						&tpl=`@CODE:<li><h3>[[+name]]</h3>
								<p class="datefacebook">[[+date]], <a href="[[+facebook]]" target="_blank">[[+facebooktext]]</a></p>
								<p>[[+recommendation]]</p></li>
  							`]]


Thanks for your help!]]>
Emily Nov 06, 2013, 08:23 PM https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-482034
<![CDATA[Re: Sorting getImageList ??]]> https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-556700
"sortmode":"string"

Now sorting works as expected!]]>
pranawebdesign Feb 03, 2018, 10:37 AM https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-556700
<![CDATA[Re: Sorting getImageList ??]]> https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-556316
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.
]]>
pranawebdesign Jan 13, 2018, 07:13 AM https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-556316
<![CDATA[Re: Sorting getImageList ??]]> https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-556288
It is a bit more work to set it up, but you can sort and filter much better.]]>
Bruno17 Jan 12, 2018, 08:48 AM https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-556288
<![CDATA[Re: Sorting getImageList ??]]> https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-556280
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?]]>
pranawebdesign Jan 11, 2018, 07:02 PM https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-556280
<![CDATA[Re: Sorting getImageList ??]]> https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-550258
&reverse=`1`
]]>
Bruno17 Apr 25, 2017, 05:11 AM https://forums.modx.com/thread/87507/sorting-getimagelist?page=3#dis-post-550258
<![CDATA[Re: Sorting getImageList ??]]> https://forums.modx.com/thread/87507/sorting-getimagelist?page=2#dis-post-550237 How can I sort results by order number in the Manager?
I tried this way but no luck sad
&sort=`[{"sortby":"idx","sortdir":"DESC"}]`
]]>
krava Apr 24, 2017, 07:24 PM https://forums.modx.com/thread/87507/sorting-getimagelist?page=2#dis-post-550237
<![CDATA[Re: Sorting getImageList ??]]> https://forums.modx.com/thread/87507/sorting-getimagelist?page=2#dis-post-484390
It still seems to be outputting a date though from the dateTV
....
if i don't convert to date it displays the date in the format: '2013-11-05 20:09:40'
....
Why would it still be outputting the dateTV as a date, if the output type is set to 'default' and the input type 'Date'

this is ok.
This is the unchanged format, how it is stored to the db.
MIGX should now sort by that date-field correctly.


If i use the syntax
[[+date:strtotime:date=`%d.%m.%Y`]] 

in my chunk it is blank

this is not ok and strange.

This output-filter should convert your date:
2013-11-05 20:09:40 

now to
05.11.2013 

this is our date-format in Germany


]]>
Bruno17 Dec 02, 2013, 01:15 PM https://forums.modx.com/thread/87507/sorting-getimagelist?page=2#dis-post-484390
<![CDATA[Re: Sorting getImageList ??]]> https://forums.modx.com/thread/87507/sorting-getimagelist?page=2#dis-post-484381
Thanks for the above. I have tried what you suggested and it still makes no difference. It still seems to be outputting a date though from the dateTV. If i use the syntax [[+date:strtotime:date=`%d.%m.%Y`]] in my chunk it is blank, if i don't convert to date it displays the date in the format: '2013-11-05 20:09:40'. Why would it still be outputting the dateTV as a date, if the output type is set to 'default' and the input type 'Date' ?

Many thanks
Emily]]>
Emily Dec 02, 2013, 11:54 AM https://forums.modx.com/thread/87507/sorting-getimagelist?page=2#dis-post-484381
<![CDATA[Re: Sorting getImageList ??]]> https://forums.modx.com/thread/87507/sorting-getimagelist?page=2#dis-post-484199
[[getImageList?
  &tvname=`recommendations`
  &sort=`[{"sortby":"date","sortdir":"ASC"}]`                                
  &tpl=`tplRecommendation`
]]


and create a chunk 'tplRecommendation' with:

<li>
  <h3>[[+name]]</h3>
  <p class="datefacebook">[[+date:strtotime:date=`%d.%m.%Y`]], <a href="[[+facebook]]" target="_blank">[[+facebooktext]]</a></p>
  <p>[[+recommendation]]</p>
</li>


change the date-format (%d.%m.%Y) to your needs.
]]>
Bruno17 Nov 28, 2013, 07:11 AM https://forums.modx.com/thread/87507/sorting-getimagelist?page=2#dis-post-484199