Aller directement à la fin des métadonnées
Aller au début des métadonnées

One of the most frequent customizations required is that of the Contribution pages, used for everything from Donations to Memberships to Pledges. Modifications are done to the .tpl Smarty templates, mostly in <<civicrm>>CRM/Contribute/Form/Contribution.  If you can't find the file you are looking for, look at the includes in the Main.tpl for clues or use AstroGREP on Windows to search the code for the text you want to change.

Before you continue, read and understand everything on this page, most importantly how to create custom tpl and php directories so you don't overwrite your changes each time you upgrade CiviCRM, and how to create changes for specific numbered pages only, not every Contribution page.

Below you'll find a working list of all my changes, mostly in <<civicrm>>CRM/Contribute/Form/Contribution, that I've made to this pages, and how I did them:

To change the recurring donation frequency/duration selector to a simplified unlimited monthly recurring

<<civicrm_custom_tpl>>CRM/Contribute/Form/Contribution/Main.tpl
Replace line 80 with this:

Add a "same as billing" option to your form, if you use the Name and Address profile on the page as well.

Add this after

in <<civicrm_custom_tpl>>CRM/Contribute/Form/Contribution/Main.tpl

Change the wording on the Billing Block "Billing First Name" etc.

Rather than edit the PHP code, edit this file: CRM/Core/BillingBlock.tpl to something more appealing.

Show and hide different contribution amounts based on $_GET parameters

This is kind of an advanced hack you do to a .tpl file to show or hide certain contribution options. Let's say, in this example, that you want certain contribution amounts to be hidden for a Personal Contribution Page, but shown on a normal view of a Contribution Page

First of all this javascript will get the "label" <label for="ID#here"> for a contribution amount. It's notoriously hard to get modify labels using CSS alone, so this is a way around that.

Then using that code, you can select a label and use standard javascript to hide it. This is not jQuery, this is just reqular javascript. jQuery's method isn't entirely cross browser compatible, and chokes on certain browsers. This gets around that. The problem is that IDs of these contribution amounts CHANGE whenever you edit the amount OR the label. This is a really annoying thing about CiviCRM, but means people shouldn't be editing the contribution amounts after you make the pages.

Étiquette
  • Aucun