CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Modifying Contribution Totals in Contact Display
Pages: [1]

Author Topic: Modifying Contribution Totals in Contact Display  (Read 881 times)

mheadd

  • Guest
Modifying Contribution Totals in Contact Display
October 19, 2009, 12:08:13 pm
I spent some time looking through the CiviCRM documentation and around the forums for help with a very specific objective - I wasn't able to find anything that answered my question, so I thought I'd create a new topic.

I'm trying to modify the contribution totals display in CiviCRM when viewing the details of a specific contact record.  Currently, the default template (ContributionTotals.tpl I think) displays aggregate amounts for the current year and for the lifetime of the contact. I would like to be able to add a new row that displays totals for a specific time period - i.e., a contribution cycle conforming to a specific date range.

The default template seems to use a $contributionSummary object, and displays properties of this object in a table row.  I'd like to add a custom object - something like $cycleSummary - and be able to reference properties of this custom object in a similar way (e.g., {$cycleSummary.total.amount|crmMoney}).

Where in the template hierarchy is $contributionSummary created?  I'm assuming that this would be the place to add my new custom object, but if there is a more appropriate place where would it be?

Anyone ever tried to customize the ContributionTotals.tpl for display of specific information?  Any help would be greatly appreciated.

Thanks!

mheadd

  • Guest
Re: Modifying Contribution Totals in Contact Display
October 19, 2009, 01:03:14 pm
On closer inspection of the Smarty docs, I guess $contributionSummary is an associative array, not an object. 

I think I need to locate where this array is being populated with the results of the SQL query looking up contribution totals.  Anyone know where this is located?  Thanks!

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Modifying Contribution Totals in Contact Display
October 19, 2009, 02:17:44 pm

CRM/Contact/BAO/Query.php, function summaryContribution (line 3287)

a better approach might be to use a hook and compute your totals on your hook function, customize the template to add your specific cycleSummary totals.

ping us on IRC if u need help getting started

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Modifying Contribution Totals in Contact Display

This forum was archived on 2017-11-26.