We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44165
    • 20 Posts
    Hi!

    Is there any way to filter out results based on a TV's value? I am using getRelated to show similar classes (the teacher/student kind of classes) and I would like to exclude all past classes from the results. I want to keep the past classes published, so they move to an archive page when the date of the class is over. It getResources, this is achieved with a simple snippet and TV filter:
    &tvFilters=`classDate>>[[!todaysDate]]%`

    But it doesn't seem like getRelated supports tv filters. Would it be possible to do something like this in getRelated? Show related classes as long as the date is in the future, and or hide related classes who's date has passed?

    This is my first time using getRelated, and I'm loving it!

    Thanks!
    • Glad you're loving getRelated smiley

      Filtering by TV values indeed isn't possible. If you also mark them as hidden from menus when they expire, you could set
      &includeHidden=`0`


      Alternatively, you could use a snippet like getResources/pdoResources to get a comma separated list of IDs to ignore, and pass that into
      &exclude
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 53928
        • 4 Posts
        Thanks for the info
          • 53928
          • 4 Posts
          Thanks for the info!