We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22448
    • 241 Posts
    Thanks to Bruno17 pointer the previous problem with Ditto was solved by applying Unixtime widget to the date tv.

    Unfortunately the related Reflect call is now showing a single item of January 1970.

    Here’s the Reflect Call:
    [!Reflect?config=`wordpress` &id=`archive` &dateSource=`timeStamp` &dateFormat=`%c` &targetID=`85` &showItems=`0` &dittoSnippetParameters=`startID:58|dateSource:timeStamp` groupByYears=`1` groupByMonth=`0` &getDocuments=`1`!]


    Here’s the target Ditto call in document 85:
    <h2>Archive [+archive_month+] [+archive_year+]</h2>

    [!Ditto?id=`archive` &parents=`58` &depth=`2` &hideFolders=`1` &extenders=`dateFilter` &dateSource=`timeStamp` &dateFormat=`%c` &tpl=`inprint_tpl` &sortBy=`timeStamp` &paginate=`1` &display=`6` !]

    <p>Showing <strong>[+archive_start+]</strong> - <strong>[+archive_stop+]</strong> of <strong>[+archive_total+]</strong> Articles


    <div id="ditto_pages">Pages: [+archive_previous+] [+archive_pages+] [+archive_next+] </div>

    So it seems that the date in the db is stored correctly but Ditto and Reflect are having difficulties reading it.

    I’m using MODx version 0.9.6.2

    Many thanks in advance.

      • 22448
      • 241 Posts
      Anybody???

      i’m really trying to avoid throwing away Reflect and hacking something myself, as it won’t be as good for sure.
        • 20413
        • 2,877 Posts
        What is the setup of timeStamp TV?
        Try switch that (for testing purpose) with pub_date
        in both Ditto and Reflect calls to see what that output.
          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
          • 36592
          • 970 Posts
          Change this
          &dittoSnippetParameters=`startID:58|dateSource:timeStamp` 

          to
          &dittoSnippetParameters=`startID:58|sortBy:timeStamp` 

            • 22448
            • 241 Posts
            Thanks guys for the suggestions.

            tkfm
            changing to sortBy did not have any effect. still showing a single January 1970 archive

            mrhaw
            changing to pub_date did not change anything even though every article had a published date specified. But changing to createdon showed August 2009 as it should since all of the articles were created in August.

            The timeStamp template variable is of type Date and uses Unixtime widget. Adding Unixtime widget was suggested in a different thread to solve the same problem with Ditto. Without it Ditto was showing January 1970 for every article regardless of the actual variable value.

            It’s beginning to smell like a bug with Reflect.
            Calling all Reflect gurus... There’s got to be an easier way to use a custom tv as the date source.

              • 28042 ☆ A M B ☆
              • 24,524 Posts
              The date source has to be a valid Unix timestamp; it uses the PHP getdate function.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 20413
                • 2,877 Posts
                Try
                [!Reflect? &targetID=`55` &getDocuments=`1` &monthSortDir=`DESC` &dittoSnippetParameters=`parents:2` &dateSource=`yourTV` &id=`myReflect`!]
                

                and on document/resource 55 (or whatever ID):
                <h1>[+wp_month+]</h1>
                [!Ditto? &id=`myReflect` &extenders=`dateFilter` &orderBy=`yourTV DESC` &dateSource=`yourTV` &parents=`2`!]
                


                Try re-name the TV, maybe it’s a conflict.
                  @hawproductions | http://mrhaw.com/

                  Infograph: MODX Advanced Install in 7 steps:
                  http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                  Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                  http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                  • 36592
                  • 970 Posts
                  I don’t know your document structure, but try this ...
                  &dittoSnippetParameters=`startID:58|sortBy:timeStamp|depth:2`
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    startID is deprecated; parents should be used instead.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 244
                      • 4 Posts
                      I’ve been dealing with the same problem for a while. But I guess I just fixed it.
                      The solution doesn’t make much sense to me but it works like a charm.

                      I placed the dateSource parameter on two places in the Reflect call, like this:
                      &dateSource=`myTvDate`
                      &dittoSnippetParameters=`parents:7|dateSource:myTvDate|sortBy:myTvDate DESC`

                      So this is what my Reflect-call looks like:
                      [!Reflect? &dateFormat=`%A %e %B %Y` &dateSource=`myTvDate` &getDocuments=`1` &extenders=`dateFilter` &tplContainer=`refAgendaContainer` &tplMonth=`refAgendaMonth` &tplMonthInner=`refAgendaMonthInner` &tplYear=`refAgendaYear` &tplYearInner=`refAgendaYearInner` &tplItem=`refAgendaItem` &dittoSnippetParameters=`parents:7|dateSource:myTvDate|sortBy:myTvDate DESC|myTvDate:agendaDate,@EVAL return strtotime('-1 day');,6` &id=`ag`!]


                      I guess the bare minimum should be:
                      [!Reflect? &dateSource=`myTvDate` &dittoSnippetParameters=`parents:7|dateSource:myTvDate`!]


                      Hope this does the trick for you too!