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) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 3.1 Release Testing »
  • Where is Register.php function: static function processPriceSetAmount
Pages: [1]

Author Topic: Where is Register.php function: static function processPriceSetAmount  (Read 5834 times)

mariagwyn

  • I post frequently
  • ***
  • Posts: 149
  • Karma: 4
  • CiviCRM version: CiviCRM 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.2.14
  • PHP version: 5.0.91-50-log
Where is Register.php function: static function processPriceSetAmount
January 27, 2010, 11:58:03 am
I had someone override all of 'CRM/Event/Form/Registration/Register.php' in order to automatically add a 5% charge on CC payments.  We had it running until I had the bright idea of upgrading to 3.1.beta6.  It looks this this function, present in the 2.2.8 version, is moved in 3.1beta6:
static function processPriceSetAmount( &$fields, &$params, &$lineItem )
    {
        // using price set
        $totalPrice    = 0;
        $radioLevel    = $checkboxLevel = $selectLevel = $textLevel = array( );

Does someone know WHERE this has been moved?  I need to find it in order to redo our add-on.  And yes, I will upload all files once it is complete so that someone else can override the core.

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Where is Register.php function: static function processPriceSetAmount
January 27, 2010, 12:12:36 pm
I would suggest you should use hooks for this instead of modifying core code. ( http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification )

If you still want to modify code you should check:

CRM_Price_BAO_Set::processAmount( ) in CRM/Price/BAO/Set.php

Kurund
Found this reply helpful? Support CiviCRM

mariagwyn

  • I post frequently
  • ***
  • Posts: 149
  • Karma: 4
  • CiviCRM version: CiviCRM 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.2.14
  • PHP version: 5.0.91-50-log
Re: Where is Register.php function: static function processPriceSetAmount
January 27, 2010, 12:18:47 pm
thanks.  I would prefer to do it via hooks, but lobo didn't think that was possible, and the coder I work with didn't seem to think so either.  If you have suggestions regarding hooks rather than modifying core, I would welcome them.  I really would prefer not to modify core files b/c then upgrades are a huge pain.  We are working on this on Friday, planning to get it set then, so any ideas before then are welcome.

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: Where is Register.php function: static function processPriceSetAmount
January 27, 2010, 12:21:08 pm

hmm, yes. but the preferred approach, IMO would have been to write a patch to core to add a "priceset hook" and then use the hook to add a 5% surcharge

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

mariagwyn

  • I post frequently
  • ***
  • Posts: 149
  • Karma: 4
  • CiviCRM version: CiviCRM 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.2.14
  • PHP version: 5.0.91-50-log
Re: Where is Register.php function: static function processPriceSetAmount
January 27, 2010, 12:26:57 pm
okay....so to shortcut the process for my developer, can you take a moment to indicate

1.  where in core said hook needs to be added (civi has LOTS of tpl files to do this stuff...and my developer is not a civi person).
2.  and then I assume (correct if wrong) that said hook would be in a sample module, along the lines of the module available on Hooks Document page?

mariagwyn

  • I post frequently
  • ***
  • Posts: 149
  • Karma: 4
  • CiviCRM version: CiviCRM 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.2.14
  • PHP version: 5.0.91-50-log
Re: Where is Register.php function: static function processPriceSetAmount
January 27, 2010, 01:41:41 pm
I just spoke to Brad, the developer who solves all problems I can't.  He will be working on this tomorrow and friday.  He is going to try to add a hook, perhaps utilizing the already existing "payment processor" hook.  I directed him to the forum.  Here is what we are trying to do:

1.  Add an automatic 5% charge onto all CC payments.  This is not too hard...
2.  Add a line item in the receipt and in the DB record that specifies this amount.  This has proven to be quite difficult.

Any insight you have will be appreciated, he is MUCH faster and better at code than I am so he will actually understand what you say. 

If he creates a new hook, I will post it to be added to the core.  I will also post a 'how-to' example on utilizing the hook in a module.

-maria

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: Where is Register.php function: static function processPriceSetAmount
January 27, 2010, 02:49:05 pm

brad can ping us on IRC if he needs help. he can grep for:

CRM_Utils_Hook::buildAmount

and add a priceSet hook in similar places. the key would to be to find the right place to add the hook which will modify future processing

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) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 3.1 Release Testing »
  • Where is Register.php function: static function processPriceSetAmount

This forum was archived on 2017-11-26.