We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4172
    • 5,888 Posts
    I'm not sure, if
    &parents=`X`
    would work together with &resources to filter only resources which are in the given parents and in the resources-list.
    May be, getResources will show all resources, which are in the given parents and all which are in the resources-list.

    perhaps you can try
    &where=`{"parent":"X"}`
    or for more parents:

    &where=`{"parent:IN":"X,Y,Z"}`
    [ed. note: Bruno17 last edited this post 14 years, 10 months ago.]
      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 22673
      • 72 Posts
      Thanks Bruno. One last question, is it possible to make the snippet only execute when the form is submitted? Instead of the snippet executing when the page loads?
        • 36112
        • 24 Posts
        Hi, I was trying to achieve the same thing, could you summarize how you did this?
          • 54139
          • 3 Posts
          I would like to create a search using select inputs rather than typing a search word into a text input.
          If there were 3 select (dropdown) inputs, the search would only bring back results that contained ALL 3 selected inputs.

          Simplesearch using select inputs would't work as this would bring back results with ANY of the 3 selected inputs.

          Is there a way of doing this with getResources?
            • 3749
            • 24,544 Posts
            getResources could do such a search, but it wouldn't know which input options were selected. You'd want to put these in the &where property of getResources.

            I'd suggest writing a custom search snippet that gets the selected inputs from the $_POST array. If you need the bells and whistles of getResources, you can call it in your snippet with $modx->runSnippet('getResources', $fields), where $fields is an associative array containing the properties you'd normally put in the getResources tag.

            Another way to go would be to create the where array in a snippet called getWhere and do this:

            [[!getResources? &where=`[[!getWhere]]` (etc.)]]


              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