We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26192
    • 91 Posts
    Hi! I would like to order records that ditto shows not for "createdon" but using other fields:

    or using "Publish Date" field, that I find in page settings (I’ve tryed with publishdaton but doesn’t works)

    or using a custom fields (for example a counter or a date)

    Can you help me?

    Thanks
      • 28215
      • 4,149 Posts
      Try ’publishedon’.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 26192
        • 91 Posts
        it’s what I’ve inserted but I still show records in the same order!!!

        I’ve seen that in page settings, if I insert a value for "Publish Date", the values isn’t saved!!

        Can you help me?
          • 3749
          • 24,544 Posts
          Publish Date is used to set future publication dates, so it probably won’t save for a published document.

          publishedon relates to the Published On field.

          I think the correct parameter would be:

          &orderBy=`publishedon ASC`
            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
            • 26192
            • 91 Posts
            Quote from: BobRay at Feb 16, 2010, 11:08 PM

            &orderBy=`publishedon ASC`


            I’ve tried with

            [[Ditto? &parents=`12` &tpl=`tplNews` &sortby=`publishedon` ]]

            and I show records with the same order

            and with


            [[Ditto? &parents=`12` &tpl=`tplNews` &orderBy=`publishedon` ]]

            and I show "no documents found"
              • 3749
              • 24,544 Posts
              Quote from: sarah_77 at Feb 17, 2010, 02:23 AM

              Quote from: BobRay at Feb 16, 2010, 11:08 PM

              &orderBy=`publishedon ASC`


              I’ve tried with

              [[Ditto? &parents=`12` &tpl=`tplNews` &sortby=`publishedon` ]]

              and I show records with the same order

              and with


              [[Ditto? &parents=`12` &tpl=`tplNews` &orderBy=`publishedon` ]]

              and I show "no documents found"

              You need to specify the direction (ASC or DESC) for the &orderBy parameter.

              Try my actual suggestion. wink
                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
                • 26192
                • 91 Posts
                using

                [[Ditto? &parents=`12` &tpl=`tplNews` &orderBy=`publishedon ASC` ]]

                I show:

                No documents found.



                using

                [[Ditto? &parents=`12` &tpl=`tplNews` ]]

                I show records



                :-(((((((((
                  • 3749
                  • 24,544 Posts
                  My humble apologies sarah_77. I can’t get it to work either. embarrassed

                  I also tried it with &sortBy + &sortDir and with the default template.

                  It looks like a bug in Ditto that makes it find no documents when the &sortBy field is a date field and there are records with empty values for that field. It only seems to happen for the date fields.

                  I’ve filed a bug report on it. http://svn.modxcms.com/jira/browse/DITTO-28

                  In the meantime, if you unpublish and republish all your documents, that should (in theory) make it work.

                  Sorry about the confusion,

                  Bob


                    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
                    • 26192
                    • 91 Posts
                    Quote from: BobRay at Feb 18, 2010, 01:40 PM


                    I also tried it with &sortBy + &sortDir and with the default template.


                    "Default template"??? I’m using Revo.... I don’t have default template.... what does that mean?


                    Can I use another solution for order items????

                    I’ve read post where someone use TV, but I don’t know what I’ve to do:

                    - I create a TV in templatea area??
                    - How Can I set a value for each document??
                    - How Can I order items using this value??

                    Thanks
                      • 3749
                      • 24,544 Posts

                      The template you’re using should be fine. If you leave out the &tpl parameter, Ditto will use its own internal default template (getResources will not -- it dumps all the fields without a &tpl parameter).

                      The publishedon field should hold the last time the document changed from unpublished to published. It should be set automatically for every published document.

                      I suggested that you unpublish and then publish every document, but Ditto seems to have trouble even if the docs are unpublished.

                      I’d suggest switching to getResources with the same tag and tpl:

                      [[!getResources? &parents=`12` &tpl=`tplNews` &orderBy=`publishedon ASC` ]]



                      or

                      [[!getResources? &parents=`12` &tpl=`tplNews` &sortBy=`publishedon` &sortDir=`ASC` ]]


                      Both of these work fine for me using your tplNews chunk. Be careful of the spelling of the snippet, the chunk and the parameters. They’re case-sensitive.




                        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