0

I have two footers in a view page with the sum results from View Aggregate Plus (VAP). The last row is the sum result.

footer A:
var A
10
20
30 (sum result from VAP)

footer B:
var B
25
30
55 (sum result from VAP)

I would like to sum the results of footer A and footer B (Total =20 + 30), using global php (module view php).

The available variables below: enter image description here

What is the output code to get the total summation result ?

4
  • I would like to strongly urge you not to use the PHP module, but find alternative solutions. See What are the downsides of using 'custom' PHP code in blocks, nodes, views-args, etc
    – Letharion
    Dec 12, 2014 at 10:51
  • What would be the possible alternative solution to get the total sum? I could not find one. I can find the sum of the column. Dec 12, 2014 at 10:59
  • 3
    That sounds like an excellent question to ask.
    – Letharion
    Dec 12, 2014 at 11:06
  • I wonder why people insist on using modules in alpha version (bad practice) that keeps PHP code in database (very, very bad practice) for task that can be accomplished by modules without these flaws, like Views Aggregator Plus.
    – Mołot
    Dec 12, 2014 at 14:52

1 Answer 1

3

What you are trying to do is to use module in alpha version (bad practice) that keeps PHP code in database (very, very bad practice) for task that can be accomplished by modules without these flaws, like Views Calc, Views Aggregator Plus or even built-in aggregation.

My current favourite is Views Aggregator Plus:

In addition to what Views and Views Calc do, this module:

  • enumerates group members

  • produces tallies, i.e. textual histograms

  • aggregates on Views PHP code-snippet evalutations

  • can filter out result rows on regexp patterns

  • gives you sorting on Views' Math expressions

  • can process Webform submissions

  • lets you add your own custom aggregation functions

And example on it's page is quite similar to what you want to accomplish here.

For a whole table sum, just add Global: mathematical expression column to sum values in row, and then Views Aggregator Plus to sum that column. Column may be hidden, for example with CSS.

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.