We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29197
    • 13 Posts
    I tried these two methods and it doesn’t work smiley

    Maybe is there something special I should to type in template to show the filtered results?

    I.e. to type snippet with GET action to pass variables before ditto call?

      • 16278
      • 928 Posts
      It should work without any extra actions. Can you post your Ditto call and tag TV details?
      smiley KP
        • 29197
        • 13 Posts
        Sure.

        Select list:

        <script language="JavaScript">
        function nav()
           {
           var w = document.change.goto.selectedIndex;
           var url_add = document.change.goto.options[w].value;
           window.location.href = url_add;
           }
        function nav2()
           {
           var w2 = document.change.goto2.selectedIndex;
           var url_add2 = document.change.goto2.options[w2].value;
           window.location.href = url_add2;
           }
        </script>
        <form action="[~[*id*]~]" method="get" name="change" id="change">
        Show <select name="goto" onChange="nav();" style="width:110px;">
        <option selected>sort 1</option>
        <option value="[~[*id*]~]&tags=tag1 name">tag1 name</option>
        <option value="[~[*id*]~]&tags=tag2">tag2</option>
        <option value="[~[*id*]~]&tags=tag3">tag3</option>
        <option value="[~[*id*]~]&tags=tag4 name">tag4 name</option>
        </select>
        <select name="goto2" onChange="nav2();" style="width:110px;">
        <option selected>sort 2</option>
        <option value="[~[*id*]~]&tags=tag1/name">tag1/name</option>
        <option value="[~[*id*]~]&tags=tag2/name">tag2/name</option>
        <option value="[~[*id*]~]&tags=tag3/name">tag3/name</option>
        <option value="[~[*id*]~]&tags=tag4/name">tag4/name</option>
        <option value="[~[*id*]~]&tags=tag5">tag5</option>
        </select>
        </form>


        Ditto call:
        [[Ditto? &id=`catal` &startID=`[*id*]` &orderBy=`menuindex ASC` &display=`[[how_many]]` &tpl=`ditto_tpl` &tplAlt=`ditto_alttpl` &paginate=`1` &paginateAlwaysShowLinks=`0` &tagData=`tvname1,tvname2` &tagDelimiter=`,` &tagDisplayMode=`1` &tagSort=`0` &tagMode=`onlyTags` &tags=`[!get.tvname!]` &depth=`10`]]


        Snippet [!get.tvname!]:
        return $_GET['tvname1'];
        return $_GET['tvname2'];


        TV details:

        [*tvname1*]

        tag1 name||tag2||tag3||tag4 name

        [*tvname2*]

        tag1/name||tag2/name||tag3/name||tag4/name||tag5
          • 29197
          • 13 Posts
          Hi, it seems to be solved by myself, when I removed accidentally &id parameter of Ditto call.

          So it works only if &id parameter is omitted smiley

          Now, I have another problem with filtering results from dropdown when in TV are different values for example: Blue==1||Red==2||Green==3 as in wiki http://wiki.modxcms.com/index.php/Template_Variable_Drop_Down_Menu.

          How to filter listing by Display Value==Rendered Value parameters?
            • 16278
            • 928 Posts
            Re the &id parameter, if you have one in your Ditto call, you have to prefix the tag names in the URL with it plus underscore. So
            <option value="[~[*id*]~]&tags=tag2">tag2</option>
            becomes
            <option value="[~[*id*]~]&tags=catal_tag2">tag2</option>

            smiley KP
              • 29197
              • 13 Posts
              Yeah! This solution should be working smiley Thanks, I try it.

              But what about the next question when I want to filter by tags with different values for each one i.e. &tags=tag1==0, &tags=tag2==1, &tags=tag3==2? Filtering doesn’t working for me properly.

              So, how can I solve this problem? wink
                • 29197
                • 13 Posts
                Anyone knows how to solve this problem? tongue
                  • 36624
                  • 535 Posts
                  Quote from: taigher at Feb 04, 2010, 06:08 PM

                  But what about the next question when I want to filter by tags with different values for each one i.e. &tags=tag1==0, &tags=tag2==1, &tags=tag3==2? Filtering doesn’t working for me properly.

                  So, how can I solve this problem? wink

                  i dont know if it’s a good ditto practice but... you can do a snippet who call many ditto calls with different filters then make a ditto call with the all the ids you get and a &document parameter. this solution work but is not very elegant.
                    CTRL+SHIFT+U - Clear Cache
                    CTRL+SHIFT+H - Hiding Heft Panel
                    CTRL+SHIFT+N - Fast Create Resource
                    CTRL+ALT+P - Preview Recource (in edit resorce window)
                    CTRL+ALT+S - Save
                    • 26931
                    • 2,314 Posts
                    But what about the next question when I want to filter by tags with different values for each one i.e. &tags=tag1==0, &tags=tag2==1, &tags=tag3==2? Filtering doesn’t working for me properly.
                    maybe have a look at tvExplorer too http://modxcms.com/forums/index.php/topic,16456.0.html
                      • 29197
                      • 13 Posts
                      Yeah, but I can’t realize how to use tvexplorer in such thing huh