We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37261 ☆ A M B ☆
    • 113 Posts
    I have the following getImageList snippet call that is not working:
    [[!getImageList?
    &tvname=`operatingHours`
    &tpl=`hoursTpl`
    &docid=`1`
    &where=`{"day:=":"[[today]]"}`
    &limit=`1`
    ]]


    It returns an empty result.

    "today" is a single line snippet containing return strftime('%A');

    I also tried &where=`{"day:=":"@CODE:return strftime('%A');"}` which returns the same empty result.

    Any ideas? The only thing I found online was a github bug report for this but no follow up.

    Thanks!
      • 4172
      • 5,888 Posts
      did you try
      [[!getImageList?
      &tvname=`operatingHours`
      &tpl=`hoursTpl`
      &docid=`1`
      &where=`{"day:=":"[[!today]]"}`
      &limit=`1`
      ]]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 37261 ☆ A M B ☆
        • 113 Posts
        Just did, uncached does not work either. I also tried changing it to

        [[!getImageList?
        &tvname=`operatingHours`
        &tpl=`hoursTpl`
        &docid=`1`
        &where=`{"day:=":"1"}`
        &limit=`1`
        ]]


        and adding a record with 1 in the day field and it still returned the default result (empty).

        Just discovered and started using MIGx and LOVE it by the way! Great job!
          • 37261 ☆ A M B ☆
          • 113 Posts
          Found this in the logs:

          [2012-02-22 12:45:48] (ERROR @ /home/public_html/core/components/migx/model/migx/migx.class.php : 288) PHP warning: Invalid argument supplied for foreach()
          
          [2012-02-22 12:45:48] (ERROR @ /home/public_html/core/cache/includes/elements/modsnippet/28.include.cache.php : 171) PHP warning: Invalid argument supplied for foreach()
          [ed. note: pyrographics last edited this post 14 years, 7 months ago.]
            • 37261 ☆ A M B ☆
            • 113 Posts
            FYI to anyone else who may be dealing with this, I used the "If" package in the tpl chunk to get around this issue. http://rtfm.modx.com/display/ADDON/If
              • 3866 ☆ A M B ☆
              • 350 Posts
              Could you post your solution with the If snippet - thanks
                Helen Warner
                Number one pixel!
                Proud to be linked with MODX at Crimson Pixel
                • 37261 ☆ A M B ☆
                • 113 Posts
                [[!If?
                   &subject=`[[+day]]`
                   &operator=`==` 
                   &operand=`[[date? &input=`%A`]]`
                   &then=`[[+from:notempty=`[[+from]]-[[+until]]`:default=`<a href="[[~18]]">Check Hours</a>`]]`
                ]]
                


                This if snippet call in the getImageList tpl shows store hours if a date matches the current date as determined by snippet. It also makes sure the hours are not empty using a :notempty modifier. [ed. note: pyrographics last edited this post 14 years, 6 months ago.]
                  • 16313
                  • 71 Posts
                  I had the same issue and I amended the file core/components/migx/model/migx/migx.class.phpcore/components/migx/model/migx/migx.class.php

                  replace row 282
                  function filterItems($items)

                  to
                  function filterItems($where, $items)

                  it should work
                    • 3866 ☆ A M B ☆
                    • 350 Posts
                    I found the &where for date here:

                    https://forums.modx.com/thread/41006/migx---multiitemsgridtv-for-modx---revolution?page=19#dis-post-396438

                    This worked for me, also there was a post about &where filtering parameter being missed out in last update (version 2.0.0) but I can't find the thread now!

                    UPDATE: Thanks for posting the link with commit Bruno17 [ed. note: boomerang last edited this post 14 years, 6 months ago.]
                      Helen Warner
                      Number one pixel!
                      Proud to be linked with MODX at Crimson Pixel
                      • 4172
                      • 5,888 Posts
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!