We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 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");
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
    • 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.
        Jason Bird
        Twitter: @jasonabird @threeeyedbird
        • 21671
        • 244 Posts
        Thanks for the leading zero tip.

        I felt dumb for not thinking of it sooner.

        -Noah