We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15871
    • 105 Posts
    OK, so I’ve made several posts to try and figure this out, but I think my thinking has gotten convoluted. Instead of an automated process, what I just need to do is have a Ditto call spit out the children of the parent it is on AND add in a string of children from another parent. I tried using &parents and &documents at the same time, but the &documents parameter overrides the &parents one.

    I’ve racked my brain with filters, but since the clauses render as OR, I can do an inclusionary filter.

    Any help will be much appreciated smiley

    Tnx
      • 4172
      • 5,888 Posts
      Can you show your call what you did try with &parents and &documents?

      You want to list all children of the own parent and some childrens of another parent?

      How do you choose the childs of the other parent(s)? Is there a TV at the documents you want to show or do you have a TV which lists the documents you want to show? Or is it a manually created commaseperated list in the call?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 4172
        • 5,888 Posts
        perhaps you can try something like that?
        snippet getmydocuments:
        <?php
        $documents = (isset($documents))?explode(',',$documents):array();
        $children = (isset($parent))?$modx->getChildIds($parent,$depth):array();	
        $documents=array_merge($children,$documents);
        return implode(',',$documents);    
        ?>


        &documents=`[[getmydocuments? &parent=`[*parent*]`&documents=`45,56,78,90`]]`
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 15871
          • 105 Posts
          I’m going to give this a try. I’ll let you know.

          One of the things I tried to do was create a TV on the secondary parents children called "Display in Other" that reads the parents and generates a pull down. That way I can choose a secondary category to display the product in as well. The TV rendered fine, but I couldn’t get Ditto to read the first parent, then read the second parent and filter it by that TV.
            • 15871
            • 105 Posts
            OK I popped it in and it is working when I hard code the &parent setting, but if you take a look here:

            http://villency.com/sofassectionals

            and View Source, you will see that the list generated for the display is not the same as the list generated in the comments (it should be). For the display list, I used a rather convoluted filter string to filter OUT certain documents in the second category but it does the same effect. Here’s the call (62 is the secondary parent and the exclude-docs TV is a filter parameter list {id,103,2|id,106,2|id,108,2|id,104,2|id,115,2|id,105,2lid,109,2}):
              [[Ditto? &parents=`[*id*],62` &filter=`[*exclude-docs*]` &id=`catlist` &tpl=`tpl.category` &paginate=`1` &display=`8` &paginateAlwaysShowLinks=`1` &extenders=`request` &phx=`0` &sortDir=`ASC` &sortBy=`menuindex`]]


            Also, it doesn’t appear to work with pagination? but that doesn’t make sense. The second page displays the same list.

            Here’s my call:
            [[Ditto? &documents=`[[getmydocuments? &parent=`[*id*]` &documents=`[*includePure*]`]]` &id=`catlist2` &tpl=`tpl.category` &paginate=`1` &display=`8` &paginateAlwaysShowLinks=`1` &extenders=`request` &phx=`0` &sortDir=`ASC` &sortBy=`menuindex`]]


            in the "includePure" TV generates a comma separated list of IDs.

            When I view the list without pagination, it functions, but the sorting is different.

            Thoughts?
              • 4172
              • 5,888 Posts
              Call nested snippets like this [[...............[!........!].....]] or like this [!...............[[........]].....!]
              =
              [[Ditto? &documents=`[!getmydocuments? &parent=`[*id*]` &documents=`[*includePure*]`!]` &id=`catlist2` &tpl=`tpl.category` &paginate=`1` &display=`8` &paginateAlwaysShowLinks=`1` &extenders=`request` &phx=`0` &sortDir=`ASC` &sortBy=`menuindex`]]

              or
              [!Ditto? &documents=`[[getmydocuments? &parent=`[*id*]` &documents=`[*includePure*]`]]` &id=`catlist2` &tpl=`tpl.category` &paginate=`1` &display=`8` &paginateAlwaysShowLinks=`1` &extenders=`request` &phx=`0` &sortDir=`ASC` &sortBy=`menuindex`!]
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 15871
                • 105 Posts
                Hmmm, OK that changed it up, but now it is only grabbing the documents. Doesn’t look like it is rendering the children of the parent?
                  • 4172
                  • 5,888 Posts
                  Of course, when you need the children of your parent you have to call it like that:
                  [!Ditto? &documents=`[[getmydocuments? &parent=`[*parent*]` &documents=`[*includePure*]`]]` &id=`catlist2` &tpl=`tpl.category` &paginate=`1` &display=`8` &paginateAlwaysShowLinks=`1` &extenders=`request` &phx=`0` &sortDir=`ASC` &sortBy=`menuindex`!]
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 4172
                    • 5,888 Posts
                    Ok, something seems not to work with this nested snippet-call:
                    Here is another way to do the same:
                    snippet getmydocuments:
                    <?php
                    $children = (isset($parent))?$modx->getChildIds($parent,$depth=0):array();	
                    $documents = (isset($documents))?explode(',',$documents):array();
                    $documents=array_merge($children,$documents);
                    $params=array();
                    $params['documents']=implode(',',$documents);
                    $params['id']='catlist2';
                    $params['tpl']='tpl.category';
                    $params['paginate']='1';
                    $params['display']='8';
                    $params['paginateAlwaysShowLinks']='1';
                    $params['extenders']='request';
                    $params['phx']='0';
                    $params['sortDir']='ASC';
                    $params['sortBy']='menuindex';
                    $output=$modx->runSnippet('Ditto',$params);
                    return $output;
                    ?>

                    call it with:
                    [!getmydocuments? &parent=`[*id*]` &documents=`[*includePure*]`!]
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 15871
                      • 105 Posts
                      Hey, I’m back sorry for the delay. Your solution seems to be working (http://villency.gwsol.com.ua/sofassectionals). One issue though is that the pagination is not displaying. You will see the "SEE ALL" link, but that is hardcoded. I tried removing the ID, but that didn’t work. I think it may be because the Ditto call is not happening at the same time as the page render for the pagination?

                      Thoughts?