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

    I’m trying to convert a site into modx and I’m running into some problems..

    The document structure is:

    Category1 -> Subcategory1 -> Product 1
    -> Product 2
    -> Subcategory2 -> Product 3
    Category2 -> Subcategory 3 -> Product 5

    So I have a list of parents with children and childrens children..

    I need to create an index when clicking on a category, where the user will see the underlying subcategories as headers to lists with the products in the subcategories.

    Ex when clicking on link to Category 1 document:
    CATEGORY 1

    Subcategory1
    <li>Product 1</li>
    <li>Product 2</li>

    Subcategory2
    <li>Product 3</li>

    I’ve tried using depth which lets me show poth subcat and product but I only seem to be able to assign one ditto-template and it then shows both subcat and product as list-button.

    I’ve also tried using ditto on the subcategory, retrieving the list of products and then calling the content of the subcategory in another ditto-template on the Category but when I run it, the Category fetches the Ditto-call and not the output in the content of the subcategory so I end up calling the same child in both header and list..

    Can anyone help me to nail this? There is probably an obvious solution to this but I can’t seem to figure it out..
      • 7231
      • 4,205 Posts
      Embed a second ditto call or a wayfinder call inside the original ditto template chunk to generate the inner list. Remember to alternate snippet cached [[ ]] and uncached [! !] in order to get both calls to work.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 13331
        • 67 Posts
        I’m not sure I understand..

        I have a chunk called sublist:

        <h3>[+title+]</h3>
        <ul>
         
        </ul>
        


        Which fetches the title of the subcategories.. inside the <ul> you want me to generate the list.. how should my call look?

        And then in the content of my category I paste the Ditto call referring to &tpl=`sublist`.. but how do i generate the <li> tags?
          • 7231
          • 4,205 Posts
          And then in the content of my category I paste the Ditto call referring to &tpl=`sublist`.. but how do i generate the <li> tags?

          That is where the second call come in like this:

          Change the sublist chunk to:
          <h3>[+pagetitle+]</h3>
          [[Wayfinder? &startId=`[+id+]`]]


          Note: remember the alternating cache settings for the snippet calls, if the outside call is uncached [!Ditto...!] then the inside one will need to be cached [[Wayfinder...]] or vise versa.

          Subnote: Wayfinder by default generates the <ul> and <li> tags.

          SubSubNote: [+title+] is not a document variable, use either [+pagetitle+] or [+longtitle+]. See the default document varialbes here: http://www.modxcms.com/document-tvs.html
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 13331
            • 67 Posts
            Thank you very much.. smiley