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

    Is it possible for getResources to work like Ditto did for filtering results?

    e.g. I want to only display items that match a TV’s setting - the TV (called "clientQuoteExcluder") has a bolean option of true or false, the Ditto code I would use would be &filter=`clientQuoteExcluder,true,2`

    How could one achieve this using getResources?



    Cheers,

    dubbs
      • 5811
      • 1,717 Posts

      From snippet.getresources.php file:
       * tvFilters - (Opt) Delimited-list of TemplateVar values to filter resources by. Supports two
       * delimiters and two value search formats. THe first delimeter || represents a logical OR and the
       * primary grouping mechanism.  Within each group you can provide a comma-delimited list of values.
       * These values can be either tied to a specific TemplateVar by name, e.g. myTV==value, or just the
       * value, indicating you are searching for the value in any TemplateVar tied to the Resource. An
       * example would be &tvFilters=`filter2==one,filter1==bar%||filter1==foo`
       * [NOTE: filtering by values uses a LIKE query and % is considered a wildcard.]
       * [NOTE: this only looks at the raw value set for specific Resource, i. e. there must be a value
       * specifically set for the Resource and it is not evaluated.]


      so &tvFilters=`clientQuoteExcluder==true` should do the trick
        • 8168
        • 1,118 Posts
        Thanks coroico, worked a treat!

        coroico = leg end!
          • 25141
          • 49 Posts
          Maybe somewhat stupid question: how do I make a TV with a boolean option? I’m trying to filter items for a calender that are marked as current, would I be able to use a checkbox-TV for that?

          Thanks, R
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: rixe at Nov 09, 2010, 07:51 AM

            Maybe somewhat stupid question: how do I make a TV with a boolean option? I’m trying to filter items for a calender that are marked as current, would I be able to use a checkbox-TV for that?
            I think radio options are better as it forces one or the other value to be set, while checkboxes, when not checked, do not set a value.
              • 25141
              • 49 Posts
              that of course is correct ...
              So I would set the two possibilities current or non-current as radio buttons -- and then I would put: &tvFilters=`myCurrentTV==true` for which option?
                • 25141
                • 49 Posts
                Ok now i got it:

                I used a TV with dropdown menu and input value: Featured==1||Not featured==0
                  • 10927
                  • 15 Posts
                  [[Ditto? &startID=`18` &depth=`3` &tpl=`product_list` &display=`all` &hideFolders=`2` &filter=`product_price,10.00,6|product_price,19.99,5` &sortBy=`product_price` &sortDir=`ASC`&noResults=`product_empty` &summarize=`15` &paginate=`1` &paginateAlwaysShowLinks=`1` ]]

                  I have the above ditto call in evolution and want to use getResources in Revolution to do the same but can’t get it to work to filter my results for products priced between price a & price b.

                  Can I include an if statement within the getResource call??

                  Or if anyone has another way of doing it please let me know.
                    • 5904
                    • 58 Posts
                    @glenwith1n Did you find a way filter the results with getResources?
                      • 3749
                      • 24,544 Posts
                      The post is well over two years old, so you may not hear back. wink

                      You should definitely start a new thread with more details about your problem and post your getResources tag.
                        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