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) »
  • where to start with customizing fields displayed for contact/member/contribute?
Pages: [1]

Author Topic: where to start with customizing fields displayed for contact/member/contribute?  (Read 2615 times)

webguy2

  • Guest
where to start with customizing fields displayed for contact/member/contribute?
November 17, 2008, 01:34:01 pm
I'd like to change which fields are displayed for view and edit modes for:
- Contact
- Member
- Contribution

Please advise on where to start - which files to begin with.

Many thanks in advance!

JoeMurray

  • Administrator
  • Ask me questions
  • *****
  • Posts: 578
  • Karma: 24
    • JMA Consulting
  • CiviCRM version: 4.4 and 4.5 (as of Nov 2014)
  • CMS version: Drupal, WordPress, Joomla
  • MySQL version: MySQL 5.5, 5.6, MariaDB 10.0 (as of Nov 2014)
Re: where to start with customizing fields displayed for contact/member/contribute?
November 18, 2008, 04:41:58 am
Look in the wiki documentation for stuff on custom fields and profiles. That should take you a long way. You can add one or two profiles to CiviContribute pages (also used by CiviMember). Next you can look at customizing the templates in the wiki. We find we have to do this since CiviContribute uses Billing Name and Address, but for 99% of people this is the same as their regular contact info, and we give them an easy way to copy from the Billing fields to the Contact Info fields.

Hope that helps you to get started.
Co-author of Using CiviCRM https://www.packtpub.com/using-civicrm/book

webguy2

  • Guest
Re: where to start with customizing fields displayed for contact/member/contribute?
November 18, 2008, 06:03:49 am
Many thanks Joe.  Are you saying you can use profiles in the View/Edit of CiviContibute and CiviMember?  The reason I ask is that David Greenberg indicated in a forum post you could not.
http://forum.civicrm.org/index.php/topic,5515.msg24203.html#msg24203

Also, from:
http://wiki.civicrm.org/confluence/display/CRMDOC/Custom+Data+and+Existing+Fields

"Custom data groups show up in a separate tab or inline, so you will not be able to put your custom field near the lastname field without hacking the template (tpl) file."

So how do I find out which .tpl file I need to customize for member and contribute?

Thanks.
« Last Edit: November 18, 2008, 06:12:11 am by webguy2 »

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: where to start with customizing fields displayed for contact/member/contribute?
November 18, 2008, 11:55:05 am
Hi,

Look at the source of the pages, you have a comment with the name of the tpl.

You don't have to modify the tpl from the distrib, you can create you own folder (see the civicrm admin) and put your overrided tpl in it, that's going to be easier for the upgrades.


X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

webguy2

  • Guest
Re: where to start with customizing fields displayed for contact/member/contribute?
November 18, 2008, 12:13:26 pm
Thanks Xavier.

NatHolder

  • Guest
Re: where to start with customizing fields displayed for contact/member/contribu
March 06, 2009, 01:47:46 pm
After much searching, I finally found where that is in the civicrm admin: http://wiki.civicrm.org/confluence/display/CRMDOC/Directories

Posting it here in case anyone else was looking for custom template (tpl) folder .
~nat

Quote from: xavier on November 18, 2008, 11:55:05 am
Hi,

Look at the source of the pages, you have a comment with the name of the tpl.

You don't have to modify the tpl from the distrib, you can create you own folder (see the civicrm admin) and put your overrided tpl in it, that's going to be easier for the upgrades.


X+

NatHolder

  • Guest
Re: where to start with customizing fields displayed for contact/member/contribu
March 06, 2009, 09:05:04 pm
I'm struggling with the templates to include just a single custom data field (or even group of fields) into the midst of pre-defined fields.

What I'm trying to do is include a custom data group called "NAFY Demographics" in the Demographics sections of the Individuals form.   This custom data group is defined as being used for "Individual".

I tried to achieve this by creating a custom template for CRM/Contact/Form/Edit.tpl, and added this to it:

Code: [Select]
...
<div id="id_demographics">
 <fieldset><legend>{$demographics.hide}{ts}Demographics{/ts}</legend>

{* insert specific inline custom data field *}
<div id="customData10"></div>
{include file="CRM/common/customDataField.tpl"}
{literal}
<script type="text/javascript">
alert('here too');
cj(document).ready(function() {
var contact_type = {/literal}"{$contact_type}"{literal};
buildCustomDataField( contact_type, '5', '10');
});
</script>
{/literal}

    <div class="form-item">
        <span class="labels">
        {$form.gender_id.label}
...

My assumption was that arguments to the javascript function buildCustomDataField could pull a single custom group field, as in '5' was the id of the custom group, and '10' was the id of the field, but buildCustomDataField doesn't seem to work like that.  Is there another way to include a specific custom data field, or even a specific custom data group, into the template?  If there isn't a way using core code (ajax calls) to pull it out, is there an API call that can be made?

Thanks for any tips!

~nat

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: where to start with customizing fields displayed for contact/member/contribute?
March 06, 2009, 11:57:15 pm
Hi,

Found is useful to enable the debug and call your page with &smartyDebug=1 so you can see what are the variables at your disposal

http://wiki.civicrm.org/confluence/pages/viewpage.action?pageId=12681485

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

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 to start with customizing fields displayed for contact/member/contribute?
March 07, 2009, 08:54:40 pm

In 2.2 we moved the custom data stuff to be ajax driven and hence dynamically loaded. Also on processing the form, you need to ensure that those form items are added to QuickForm. In 2.3 i suspect we'll add more "ajax" driven hooks to allow form elements to be injected dynamically etc (similar to AHAH hooks in drupal, or so i think :)

For now, i would do the following:

1. implement the buildForm hook and add the custom data fields you need added

2. customize the tpl to display these new fields

3. implement the postProcess hook to store the custom data fields.

if all the fields you want injected are part of a custom group, you can potentially reuse a lot of the core CiviCRM code

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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • where to start with customizing fields displayed for contact/member/contribute?

This forum was archived on 2017-11-26.