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) »
  • Displaying more than one custom group under the Contribution form
Pages: [1]

Author Topic: Displaying more than one custom group under the Contribution form  (Read 970 times)

torenware

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 4
Displaying more than one custom group under the Contribution form
August 10, 2009, 01:38:56 pm
I'm investigating how I might implement a Contribution form that has more than one custom field group.  I say "field group" instead of "custom profile" because I don't really care how CiviCRM wants to group its fields at the controller level;  if it's easiest to hack in a second profile (AFAICT you can only have one custom profile in 2.2), then I'd do that;  if it's easier to to change the way that the profile renders at the Smarty template level, I'd do that.  Mostly, I want a flexible solution that will require touching core as little as possible, and preferably not at all.

What's the best solution for this kind of job in 2.2?

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: Displaying more than one custom group under the Contribution form
August 10, 2009, 01:48:01 pm

i would say use the buildForm/postProcess hook and add whatever you want (profile/custom group/some other db fields) :)

you can also check this example:

http://svn.civicrm.org/sfschool/trunk/drupal/

where i'm doing a lot of hook work and not hitting core :)

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

torenware

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 4
Re: Displaying more than one custom group under the Contribution form
August 10, 2009, 02:10:35 pm
Lobo,

Much obliged.  Cool new hooks.  I'll look at the example code as well.

Rob

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: Displaying more than one custom group under the Contribution form
August 10, 2009, 02:34:53 pm

its not example code :) I'm developing  a module for my kids school that works with CiviCRM and uses hooks quite extensively to add a few more things that CiviCRM lacks by default. Its proving to be quite a fun and learning project :)

also amazed as to how much we can customize and extend the system without touching the core code. Hooks and custom templates are a great combination :)

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

torenware

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 4
Re: Displaying more than one custom group under the Contribution form
August 10, 2009, 06:19:58 pm
Hey, not bad activity for a dad.

I've looked through the code, trying to get the gestalt of it.  I can see pretty clearly how to get in to do the job of the controllers.  It's less clear what I need to do at the template level.

For now, I'm just moving the "pre" profile down the page to just before the "post" profile.  This is a one line change in Mail.tpl.

One thing I might want to do is to get Yes/No type fields to render as checkboxes.  I assume I'd have to write a custom implementation of the profile with the yes/no questions, and do some post processing so that the checkboxes would look right to the controllers.

Is this possible without too much insanity, and if it is, what's the best way to go about doing this?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Displaying more than one custom group under the Contribution form

This forum was archived on 2017-11-26.