Here is what I need to do : I need to be able to sort items by pub_date if the publication date is defined, and if no pub_date is defined, I need Ditto to fall back to createdon.
Is this doable and if so, how would you go about it ?
Thanks !
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
I wonder if it can be done with Ditto too... For now to be able to modify sortable date I made a hack, that adds an option to edit createdon date. Then I could sort docs by createdon only and can actually modify those dates.
Before this I was thinking about something like yours, davidm. And I guess Ditto can’t sort by multiple parmeters... at least for now.
In some cases u could maka date TV that if not defined, equals to createdon.
This should be the native behavior of Ditto. Just set &sortBy=`pub_date` and Ditto should take care of the rest.
@yetsun: Ditto version 2.1b3 actually supports basic multisort similar to MySQL using the &sort parameter.
That’s great Mark, you mean if there is not pub_date, it will fallback to createdon ?
Cool
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
Reflect should as well since it uses Ditto as the data source.
Ditto, which retrieves the data for Reflect, substitutes the createdon date when the pub_date value is 0. Thus, $resource[$i][$templatesDateSource] should contain the desired date if &dateSource is set to pub_date.