-
- 24,544 Posts
Quote from: drwagner13 at Dec 19, 2008, 04:05 PM
In my case I decided to simply sort on the menu order, and I did a very quick SQL insert to set the menu order field equal to the volume number. This workaround makes adding new content an extra step, so I will look to the coding idea for a future upgrade.
Glad you found a way to get what you want. I should have mentioned that you could also use a TV instead of the menu order field.
In the meantime, I stand by my assertion that Ditto is poorly documented, as I can find no reference to a customSort option anywhere.
I did find this at
http://ditto.modxcms.com/dev/documentation/files/snippet-ditto-php.html, but I agree that it could use some more explanation:
orderBy
An array that holds all criteria to sort the result set by. Note that using a custom sort will disable all other sorting.
$orderBy["parsed"][] = array("sortBy","sortDir");
$orderBy["custom"][] = array("sortBy","callback_function");
I actually have a similar issue to this. I have a TV of price and am sorting it via the &orderBy but as it is treated as text can not sort properly. I’ve been spending some time looking at options as the leading zeros isn’t the cleanest for the person entering in new pages. Does anyone have additional info on using the customSort function or ideas on how to change it? If the database field was an integer everything would be great but since all template variables seem to be stored as text I’m a little stumped.
-
- 244 Posts
Thanks for the leading zero tip.
I felt dumb for not thinking of it sooner.
-Noah