We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29635
    • 361 Posts
    Hi all,

    Can anybody provide guidance for how to modify Ditto so if I call [!Ditto? &startID=`2,4,6` !] it will return 2, 4, and 6 and not the children of 2, 4, and 6?

    I think the trick lies in the line
    $this->APImode = ’GetAllSubDocs_method’;
    but am not sure.

    Any advice, or perhaps there’s a way to do this already? I know you could use @DOCUMENT with a TV, or the getdoc snippet, but neither of those allow the power or flexibility of Ditto.

    Also, sorry if this is brought up somewhere else. I thought it was, but I couldn’t find it.
      Need MODx Ecommerce? Try FoxyCart!
      • 18397
      • 3,250 Posts
      What you need to do is remove the following lines:

      		$kids = array();
      		foreach ($seedArray AS $seed) {
      			$kids = $this->getChildIds($seed, $descendentDepth, $kids);
      		}
      		$kids = array_values($kids);
      


      and replace them with:

      $kids = $seedArray;
      


      This will make Ditto do what you wish.

      Could you please file a feature request asking to have both an option to get all children documents and an option to get all documents listed? Thanks!

      On another note, please utilize the new Ditto subforum under Repository Items and Support. This thread has now been moved there.
        • 29635
        • 361 Posts
        Thanks Mark, that’s perfect.

        In case anybody else needs to do this, be advised: You’ll need to create a new ditto.class.inc.php and a new Ditto snippet (obviously), but you’ll also need to rename the ditto class in the php file, and replace a bunch of ditto calls in the snippet, otherwise having both the hacked Ditto and the normal Ditto will error out.

        Also, I posted this in the bugtracker/feature request, as you requested.
        http://modxcms.com/bugs/task/468

        Thanks again.
        -Brett
          Need MODx Ecommerce? Try FoxyCart!
          • 18397
          • 3,250 Posts
          There is now an option in the next release for this. Coming to a MODx install near you soon! smiley
            • 29635
            • 361 Posts
            Thanks Mark. Looking forward to it.
              Need MODx Ecommerce? Try FoxyCart!