We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40122
    • 330 Posts
    I am combining a form and PHP to create a kind of search.

    I am using getResources' tvFilters to show the results of the search, eg:

    echo '[[!getResources? &parents=`[[42]]` &tpl=`NewProdTpl` &includeTVs=`1` &includeContent=`1` &limit=`99` &tvFilters=`' . $filters .'`]]';


    This works somewhat. But I need to figure out a way to use combined AND and OR conditions, like in SQL, eg:

    SELECT supplier_id
    FROM suppliers
    WHERE (name = 'IBM')
    OR (name = 'Hewlett Packard' AND city = 'Atlantic City')
    OR (name = 'Gateway' AND status = 'Active' AND city = 'Burma');


    Obviously I have tried using brackets like:

    $filters = '(Type==Forklift),(Brand==Iseki||Brand==Kubota)';


    But I have had no luck.

    Would anyone know if there is a way to achieve this?

    Many thanks

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      Have you tried this?

      $filters = 'Type==Forklift,Brand==Iseki||Brand==Kubota';
        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