1

I have an ee entries loop returning a bunch of entries. Each entry has a custom field holding a numerical value. I would like to add together the values of that field at the end and output the total.

PHP equivalent would be:

for ($i = 0; $i < $total; $i++){
$total += $value[$i];
}


Total = echo $total

Even better would be to just have this run a SQL like command and return the value for me:

SELECT SUM(column) FROM table

Are there any plugins that can help me with this? I'd like to avoid PHP if possible but if I have to how would I make the PHP work with EE tags, I can't seem to get the value for the custom field into my PHP.

Is there an operator for Stash to achieve this?

1 Answer 1

2

u can use a plugin to do this.

I think http://devot-ee.com/add-ons/tally will do the trick.

I hope this will help u.

Regard's.

3
  • This is exactly what I need but I can't get it to work. Will post the code below.
    – KoalaKid
    Commented Mar 13, 2014 at 23:30
  • I posted up to the official support forum if you are interested: devot-ee.com/add-ons/support/tally/viewthread/12825
    – KoalaKid
    Commented Mar 13, 2014 at 23:43
  • Hi, I see your post , You just need to put the second part in embed template. if this works with you please accept my answer here. Regard's.
    – Ahmad Saad
    Commented Mar 14, 2014 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.