The getResourceField snippet will get the values of the TVs, but I think you’ll have to add them in a custom snippet of your own. It would go something like this (to add the scores from resource 12 and resource 15) -- assumes that the TV is names "score":
<p>Total: [[!AddScores? &score1=`[[!getResourceField? &id=`12` &field=`score` isTV=`1` ]]` &score2=`[[!getResourceField? &id=`15` &field=`score` isTV=`1` ]]`]]</p>
<?php
/* AddScores snippet */
return $score1 + $score2;
If you need to add the scores from a bunch of different resources, you’d probably want to send their IDs in a comma-delimited list to the snippet:
[[!AddScores? &ids=`12,15,33,45`]]
The snippet would then look like this:
<?php
/* AddScores snippet */
$tvId = 1; // put the id of the TV here
$docs = explode(',', $ids);
$score = 0;
foreach ($docs as $doc) {
$tv = $modx->getObject('modTemplateVar', $tvId);
$score += $tv->getValue($doc);
}
return $score;