We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12584
    • 208 Posts
    I am trying to work out the best way to create a list of products as per screenshot below which is easily updateable, if I use template variables then I think I would need a TV for every product but I have no idea how many products on each page as these will change.

    Can someone point me in the right direction on what to use to do this bearing in mind I am not a developer or in fact remotely clever (-:



    Many thanks

    Ian
      • 10226
      • 412 Posts
      Ditto is the answer... read up on the ditto basics.

      create a chunk with your per item template

      create a page using your regular template (this will be your parent node) and modify the content to work with that page of course, and somewhere on there you call the ditto template chunk

      create documents under your above parent node (create another template to show full details of the item and use that here)

      create tv’s for your item detail, price, desc, pic and such and assign those to the templates they will be called on.

      It is a bit to grasp at first, but it is totally awesome once you get it sorted.

      here is a link to a simple implementation without using a second details page - http://sweetskies.fruitwerks.us/sold_babies.php In this use, I have little point to expand the details. But as with most pics on the site it will pop up a lightbox.

      In your case clicking on an item might want to bring up more details, this is where another template and another ditto call comes in. There is also a tags feature that could be handy to suggest related items - hmm never thought of that before smiley

      - actually you just need a container for the item pages, ditto can be called to / from a different page, but what I mentioned above keeps it simple.

      Good Luck!
        • 7231
        • 4,205 Posts
        if I use template variables then I think I would need a TV for every product but I have no idea how many products on each page as these will change
        You use a document for each product, use the TVs for details.

        Fruitwerks’ method is right on. You could even use Ditto to alternate the rows as in your illustration.
          [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't know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 10226
          • 412 Posts
          You could even use Ditto to alternate the rows as in your illustration.

          How can this be done? That is something I wanted to do, but I didn’t think is was easily do-able. The only thing I could think of was adding a TV that would specify a background color for the <div>. I guess I was on the right track, but the whole idea distracted from the dynamic content schema for me.
            • Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 10226
              • 412 Posts
              Huh.. absolutely too simple. lol

              Thanks!
                • 12584
                • 208 Posts
                Well giving this a bash wonder if some can tell me where I am going wrong.

                I have created a parent page which is page number 48 and have added the following to it
                [[Ditto?parents=`48`&tpl=`vans_sold`&display=`all`&summarize=`5`&paginate=`1`&paginateAlwaysShowLinks=`1`]]

                ok the current vans_sold template is stored as a chunk and looks like this
                <div style="border:1px solid#744a00;">
                <table>
                <tr>
                <td">[+heading+]</td>
                </tr>
                <tr>
                <td>[+content+]</td>

                <tr/>

                </table>
                </div>

                Right now I dont get the output of this chunk in the template at all as can be seen here

                Because I have binded the 2 TV’s that are in the chunk called content and heading to this page I can now get the new text areas at the bottom of the page when editing. Should I not do this and if not how do you add information.

                Had a scan of the documentation but cant see anything simple that shows how to do what I am trying to achieve

                Cheers

                Cheers

                Ian
                  • 7231
                  • 4,205 Posts
                  Don’t think this makes a difference but is a good practice to get into. Add a &before the first parameter as well. So it would be:
                  [!Ditto? &parents=...
                    [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]
                    • 12584
                    • 208 Posts
                    Thanks for the help but I am still doing something wrong. My ditto call is now

                    [!Ditto?&parents=`48`&tpl=`vans_sold`&display=`all`&summarize=`5`&paginate=`1`&paginateAlwaysShowLinks=`1`!]

                    Yes the page was published it was called item 1 I have now renamed it to product 1 and it shows as a child to the parent page called parent page.

                    I checked the chunk name/spelling to make sure it ties up with the &tpl name call and it does. I have 2 template vars called content and heading which appear at the base of the pages under the main editor.

                    Before I set up the above was I meant to install anything else, I am presuming ditto is all part of the core on MODx and is ready to go.....

                    Anyone know what I’m missing and thanks for all help so far

                    Regards

                    Ian
                      • 12584
                      • 208 Posts
                      OK have changed the name from content to description and things are starting to work grin

                      ok this code
                      [!Ditto?&parents=`48`&tpl=`vans_sold`&display=`all`&summarize=`5`&paginate=`1`&paginateAlwaysShowLinks=`1`!]

                      outputs this
                      product number 3
                      by Default admin account on 22-Dec-07 13:58

                      But it does not output the chunk called vans_sold or this chucks TV so at a total loss why this does not happen.

                      Can anyone give me any more pointers

                      Cheers

                      Ian