Hi, I have an events page where my events are showing in order of page id ascending, no matter what I try to use in Ditto. I tried orderby published date, and manipulated those, but it’s still just going by order of page id. (By page id, I mean the number shown in brackets after the page title, in the document tree - I think that’s ’id’?)
I had tried:
[[Ditto? &startID=`4` &summarize=`4` &total=`20` &tpl=`event` &sortBy=`pub_date` &sortDir=`DESC` &paginate=`1` &alwaysshow=`1`]]
Showing [+start+] to [+stop+] of [+total+] events
..and then I followed the MODx tutorial at
http://ditto.modxcms.com/tutorials/sort-by-a-date-tv.html
I created a tv called ’event_date’, set it up as per tutorial, checked I could see it in my template variables list, made sure it was applied to template ’events’ (ref’d in SQL below) but get’unknown column’ msg for event_date:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - Unknown column ’sc.event_date’ in ’order clause’ »
SQL: SELECT DISTINCT sc.* FROM `db196473060`.modx_site_content sc LEFT JOIN `db196473060`.modx_document_groups dg on dg.document = sc.id WHERE (sc.id IN (30,36,25,24,23,37,21,34,49,48,15,50,46,47) AND sc.published=1 AND sc.deleted=0 ) AND (sc.privateweb=0) GROUP BY sc.id ORDER BY sc.event_date DESC
I then tried sorting by id descending:
[[Ditto? &startID=`4` &summarize=`4` &total=`20` &tpl=`event` &sortBy=`id` &sortDir = `DESC` &paginate=`1` &alwaysshow=`1`]]
Showing [+start+] to [+stop+] of [+total+] events
..but it still lists them in ascending id.
Please help!
Thanks,
Tracy