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

    I am doing up a schoolbook store site and am using Ditto to generate the products on each page. My store is several levels deep and products are placed into containers in the site structure according to which category/sub-category etc. they belong to. When the user is in the top level (ie. highest-level category) I would like to show all products that come under this category. In my side bar, I am then using Wayfinder to allow the user to drill down to the next level if they wish. At this level I would then again like to show all products that are part of this sub-category. Then there is one more level after that.

    I know I can generate the ditto output by manually listing the parent containers it should draw it’s resources from. However, when I am at top-level, there could be 30+ sub-containers it needs to use (one for each subject in every year), so that’s quite a maintenance job to enter them all into the ditto call.

    Is there a way to use parameters in a standard ditto call that tells ditto to use all containers that are e.g. 2 levels deeper than the startId? I can’t see anything like it but perhaps I’m missing the point?

    All help appreciated as always!



    Levels example:

    1. Primary School
    1.1 First Class
    1.1.1 English
    1.1.2 Maths
    1.1.3 History
    1.1.4 Geography
    1.1.5 Religion
    1.1.6 etc.
    1.2 Second Class
    1.2.1 English
    1.2.2 Maths
    1.2.3 History etc.
    1.3 Third Class
    etc.
    2. Secondary School
    2.1 First Year
    etc.



      • 25132
      • 129 Posts
      Just found a solution myself (should have figured this out earlier really):

      Here’s my Ditto call:

      [!Ditto? &tpl=`productSummary` &depth=`3` &hideFolders=`1` &paginate=`1` &display=`20` &orderBy=`pagetitle ASC` &paginateAlwaysShowLinks=`1`!]

      The &depth parameter tells Ditto to look 3 levels deep, the &hideFolders parameter hides retrieved documents with children of their own.
        • 4971
        • 964 Posts
        What does &paginateAlwaysShowLinks=`1` do?

          Website: www.mercologia.com
          MODX Revo Tutorials:  www.modxperience.com

          MODX Professional Partner
          • 28042 ☆ A M B ☆
          • 24,524 Posts

          Pur: Determine whether or not to always show
          previous next links
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 4971
            • 964 Posts
            Thanks Susan
              Website: www.mercologia.com
              MODX Revo Tutorials:  www.modxperience.com

              MODX Professional Partner