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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Retrieve State/Province from code for payment processor
Pages: [1]

Author Topic: Retrieve State/Province from code for payment processor  (Read 730 times)

angelog

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 3.4
  • CMS version: Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Retrieve State/Province from code for payment processor
October 27, 2011, 06:41:43 am
I am relatively new to Civi development and have been developing a payment processor for a direct debit collection of donations. I have a profile that collects some information before sending on to the processor. The individual_prefix and state_province-Primary paramerters passed from the form are codes and I have prepared the following code to access the name from the database:

      // Fetch County Name from Database
      $query =   "SELECT name
               FROM civicrm_state_province
               WHERE id = ".$params['state_province-Primary'];
      # run the query
      $dao = CRM_Core_DAO::executeQuery( $query );
      while ( $dao->fetch() ) {
         $RapidataParams['county'] = $dao->name;
      }

I would appreciate any comments on whether there is better or more appropriate way to get at this data.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Retrieve State/Province from code for payment processor
October 27, 2011, 05:36:35 pm
It looks to me like the constant_get api would access a cached instance of this variable

http://api.civicrm.org/v3/
http://svn.civicrm.org/civicrm/trunk/api/v3/examples/ConstantGet.php
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Retrieve State/Province from code for payment processor

This forum was archived on 2017-11-26.