We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13730
    • 149 Posts
    First excuse my English, my first language is French. I am currently using Modx Evolution 1.04

    I created a data-sheet (document) to keep track of several products. I use several TV in this document, including a TV for the price. I have about a dozen products.

    I used Ditto to present these products in tabular form. Product Name | Description | Price. This work very well.

    I want to make the sum of all prices, and put the result in the document generated by Ditto, how do I do this?

    Thank for you help
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      Mmm.... Ditto is.... mmm.... meh.... abandoned.

      If I were you I would write a Snippet to calculate the sum. It’s simple in MySQL. Do you know much MySQL? Can you use phpMyAdmin?
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Everett, Ditto is far from deprecated in Evo, which the poster says he’s using.

        That said, Ditto does not generate a "document". Like Wayfinder, it only generates a list of specified resources, using the tpl to format each list item. If you need something else on your document besides this list, Ditto is not your solution. You’ll need a custom snippet.
          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
          • 7455
          • 2,204 Posts
          you could use javascript to summ all values in a serten element.
            follow me on twitter: @dimmy01
            • 9207 ☆ A M B ☆
            • 2,475 Posts
            $10 Amazon gift certificate to who-ever can contact the author of the Ditto Snippet and get a code update.

            I know it’s very popular, and very useful, but I don’t think it’s well-architected, and in my experience, over-reliance on it causes sites to train-wreck in bad ways. Personally I think it’d be a better approach to use a MySQL Snippet to solve this, especially because it deals with a fairly trivial MySQL function.