2

We would like to add the contribution Financial Type to the Contribution (On-line) receipt template, so we communicate clearly to our donors where their money has gone. (Our Financial Types are named after certain funds: General Fund, Child Sponsorship Fund, Building Fund, etc.). We're not using Price Sets. We're on Civi 4.6 and Drupal 7.

In the Contribution (Off-line) template, there is this section of the template code:

  <tr>
  <td {$labelStyle}>
   {ts}Financial Type{/ts}
  </td>
  <td {$valueStyle}>
   {$formValues.contributionType_name}
  </td>
  </tr>

Because the "off-line" New Contribution screen specifically asks for which Financial Type the transaction is, the above code is pulling the Contribution Type into the receipt template from the input value in the form. I'm tracking with that.

But for the Online contribution template, the Financial Type isn't being selected from the form itself. Rather the Financial Type is set on the Manage Contribution screen for each contribution page. Financial Type isn't listed as a token in the template screen, so I tried the answer from Is there a token for contribution type?, {contribution.financial_type}. I'm afraid that didn't work. I checked debugging with &smartyDebug=1, but I couldn't find anything loaded in the contribution form that might work.

How is the Financial Type being transmitted to the Online Contribution page? Any ideas for a token or option I'm not seeing?

2
  • 1
    When you say you tried contribution.financial_type did you add in the hack suggested there (which isn't completely specified but I'm assuming means editing CRM_Core_SelectValues::contributionTokens())? Maybe that hack is needed to make it work.
    – Demerit
    Jul 9, 2016 at 23:31
  • Ah, Demerit, I'd hadn't yet. Thank you for saying something! I'll try it this week. Jul 10, 2016 at 1:14

1 Answer 1

1

In your question you state "We're not using Price Sets." In that case you must have multiple contribution pages, one for each financial type.

You can edit the online contribution receipt to include something like:

{if $contributionPageId eq "4"}
     <tr>
     <td colspan="2" {$valueStyle}>
      {ts}Donation to General Fund{/ts}
     </td> 
       </tr>
{elseif $contributionPageId eq "3"}
     <tr>
     <td colspan="2" {$valueStyle}>
      {ts}Donation to Child Sponsorship Fund{/ts}
     </td> 
       </tr>
...

{/if}

I would place it in the receipt table just under the "Payment Details" header.

I realise it is a somewhat rudimentary solution, but "quick and dirty" is effective if you are struggling with tokens.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.