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) »
  • Custom fields in Contribution creation
Pages: [1]

Author Topic: Custom fields in Contribution creation  (Read 1390 times)

alextronic

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 2
  • I do what I do
Custom fields in Contribution creation
April 13, 2009, 02:22:33 pm
Hi, I would like to know if it is possible to create Contribution Pages having a custom set of fields available in the moment of creation, not like inserting Profiles (those are to be filled in by contributors), but more like administrative attributes of each new Contribution Page, in order to handle them more freely.

I'm talking about fields that could be filled in by people creating new contribution pages: for example,

1-Organization related to that contribution (that would be a dynamic select-list of organizations available),
2-Type of contribution (for example a static select-list... Disaster relief, HIV, Human Rights, etc.)
3-etc.

I don't know if I expressed myself OK, sorry for my english. Anyway,  Thanks in advance
Alex
« Last Edit: April 13, 2009, 02:25:40 pm by alextronic »

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: Custom fields in Contribution creation
April 13, 2009, 02:39:39 pm

Unfortunately not :( Custom Data cannot extend contribution pages in v2.2 and prior. It is currently not on our list for 2.3 either. If interested in adding this functionality contact us on IRC and we'll get u started

Note that Contributions can be extended. Your examples below seem to be more contribution related and not contribution page

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

alextronic

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 2
  • I do what I do
Re: Custom fields in Contribution creation
April 24, 2009, 06:28:41 am
I don't think there is an API that pulls Personal Campaign Pages information, and I don't use CiviCRM with Joomla, but I guess you can make an SQL query, the information for PCPs is in table `civicrm_pcp`, and the fields are `id`, `contact_id`, `status_id`, `title`, `intro_text`, `page_text`, `donate_link_text`, `contribution_page_id`, `is_thermometer`, `is_honor_roll`, `goal_amount`, `referer`, `is_active`.

I guess you could use something like the following if you wanted to retrieve, let's say, the goal amount for a PCP called 'My PCP' (haven't checked the syntax):

Code: [Select]
SELECT goal_amount FROM civicrmdatabasename.civicrm_pcp WHERE title = 'My PCP'
In Drupal there's an API for database access, db_query, but in Joomla I think it is JFactory... I think this will help you out:

Joomla! 1.0.x (and Joomla! 1.5 in Legacy mode):
Code: [Select]
<?php
global $database;
$database->setQuery( "SELECT * FROM #__your_table" );
$result = $database->loadObjectList();
?>

Joomla! 1.5
Code: [Select]
<?php
$db 
= & JFactory::getDBO();
$db->setQuery( "SELECT * FROM #__your_table" );
$result = $db->loadObjectList();
?>

However, the total amount contributed through a given PCP is something that (in my opinion) is not retrievable since they are tracked as per Contribution Page (and not per PCP). Anyway, if you need to know the contributed totals for a Contribution Page, it's perfectly possible of course.

Anybody correct me if I'm wrong   :-[
« Last Edit: April 24, 2009, 06:39:06 am by alextronic »

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Custom fields in Contribution creation
April 24, 2009, 11:33:07 am
Quote from: alextronic on April 24, 2009, 06:28:41 am
However, the total amount contributed through a given PCP is something that (in my opinion) is not retrievable since they are tracked as per Contribution Page (and not per PCP). Anyway, if you need to know the contributed totals for a Contribution Page, it's perfectly possible of course.

Anybody correct me if I'm wrong   :-[

Contributions which come in via a Personal Campaign Page can be totaled (and totals are displayed in the Progress Thermometer for each PCP page). When a PCP contribution is recorded:
- civicrm_contribution record is inserted
- related civicrm_contribution_soft record is also inserted with the contribution record id  (contribution_id) AND the PCP Page id (pcp_id)

So you can query contribution_soft on pcp_id w/ join to contribution table for amounts.
Protect your investment in CiviCRM by  becoming a Member!

alextronic

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 2
  • I do what I do
Re: Custom fields in Contribution creation
April 24, 2009, 01:52:56 pm
That is so great to know, thanks!!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Custom fields in Contribution creation

This forum was archived on 2017-11-26.