We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33273
    • 60 Posts
    Hi
    I use extenders=`request` with milti-filter (ditto_filter_1, ditto_filter_2, ....)

    My Ditto call:

    [!Ditto? &parents=`57` &depth=`1` &tagDelimiter=`,` &tagData=`placeType,cookery,disposition,checksum` &hiddenFields=`placeType,cookery,disposition,checksum` &tagMode=`onlyAllTags` &extenders=`request` &debug=`1`!]

    It works when I set ditto_filter_1="placeType,text,7" ditto_filter_2="cookery,test,7" ..... variables in URL
    Ditto displays all documents that contains ’test’ in search field (tv).
    But I need Ditto to display all documents where ’test’ == tvvalue. Following the documentation, I have to set ’1’ in filter mode. But it doesn’t work....... No documents found....
    Help me, please.

    EDIT:
    After few tests...
    If I set ’1’ in filter mode Ditto displays only documents that have ’test’ as THE ONLY tv value. And if document tv has values ’test’ AND ’test2’ Ditto ignores that document...
    I can’t use filter mode ’7’ because in that case Ditto display documents that have tv value==’somethingtest’ and this is not what I want...
    Sorry for my English.
      • 18397
      • 3,250 Posts
      1. What type of tv are each of your template variables?
      2. Mode 2 or 8 are what you want since filter will REMOVE all documents that match the criteria. so if joe != foo it will REMOVE it
        • 33273
        • 60 Posts
        Variables have checkbox type (comma delimited list).
        I make some changes, and now it works as I wish!  laugh
        in filter.class.inc.php i add:

        case 9  :
            $unset = 0;
        $availabletags = explode(",", $value[$this->array_key]);
        foreach ($availabletags as $availabletag) {
            if (($this->filterValue) == $availadletag)
          $unset =1;
        }
        break;

        with this addition my template variables may have several values. For example, (tv)placeType = "bar,restaurant" ...
        whithout this addition if we want to show only documents that have ’bar’ (ditto_filter_1=’placeType,bar,1’) Ditto shows the only ’bar’ but no ’bar,restaurant’
        if we use filter mode ’7’ to display documents that contains ’bar’ Ditto shows ’bar’, ’bar,restaurant’, but also ’sushi-bar’, ’blablabarblabla’....

          • 18397
          • 3,250 Posts
          What you are describing is exactly what tagging is.

          You would use &tagData=`foo` &tagDelimiter=`,` &tagMode=`onlyAllTags` to accomplish what you describe. Then you would pass the tags to the snippet via the tags url parameter. You can filter by more than one tag by saying ?tags=tag1,tag2 in the url (since you tags are comma separated).
            • 33273
            • 60 Posts
            Yes, tagging works, but I have form with several dropdowns to select filter values.. If it would be possible to use ditto_tags_1="tag1" ditto_tags_2="tag2" ....
            So, that solution works for me and maybe for somebody else.

            Great snippet, Mark!
              • 18397
              • 3,250 Posts
              Maybe something along the lines of tag_1 , tag_2 , tag_3 ...
              Please file a feature request for this in the bugtracker. Thanks!