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) »
  • question about "public function computeAmount" in CiviContribute
Pages: [1]

Author Topic: question about "public function computeAmount" in CiviContribute  (Read 1318 times)

webguy2

  • Guest
question about "public function computeAmount" in CiviContribute
October 21, 2008, 08:32:56 am
I need to
- have the user be able to select the membership type (each has a different associated fee)
- donate an amount if he wants to
- (here's the kicker) automatically calculate another fee based on the number of apartment units he manages and store that as a separate field, if more than 100 units, they are charged for #units * $0.20
- be able to total them all at check out

And, this apt management fee is only applied to certain membership types, not all.

I am delving into CiviCRM/CRM/Contribute/Form/Contribution/Main.php, specifically the "public function computeAmount".

So far, I only have:
if ( $params['custom_6'] > 100 ) {
   $amount = $amount + ((((int)$params['custom_6']) - 100) * .20);
}

- How do determine the membership types?

- How do I save the apartment fee separately?

Many thanks for any help!

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: question about "public function computeAmount" in CiviContribute
October 21, 2008, 10:27:59 am

1. you might want to debug and see the params array, you can use print_r or CRM_Core_Error::debug. This will show you all the fields and POST values

2. You will need to figure out where/how you want to store the apartment fee. Maybe in a special custom field. You will need to add storage for that seperately in the code. Contact us on IRC if u need help on this

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

webguy2

  • Guest
Re: question about "public function computeAmount" in CiviContribute
October 21, 2008, 10:32:09 am
thanks.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • question about "public function computeAmount" in CiviContribute

This forum was archived on 2017-11-26.