6

I need to create a custom system workflow message for

Contributions - Receipt (on-line)

that will be used instead of the default template when a particular contribution page is used.

I already know about the Receipt tab of the contribution page wizard. There I can prepend text to the receipt that is unique to that contribution page.

But I need to fuss with the template itself. I know about the System Workflow Messages at: civicrm/admin/messageTemplates. The problem there is that the change applies to all contribution receipts. I'm looking to change the template only for a particular contribution page.

I'm using CiviCRM 4.5.8 on Drupal 7.36.

Thanks.

1 Answer 1

7

As I learned from @Nicholai in a previous (unrelated) thread, you can override these templates with some pretty easy logic to add something custom to a single page. For example:

{if $contributionPageID == 20}

{* whatever you need to do on this page *}

{/if}

I assume this would work in this case, too. If you try it and it works, let us know!

6
  • 1
    don't you need an {else} eg {if $contributionPageID == 20} DO THIS {else} DO THAT {/if} - i guess you don't if what you are saying for PageID==20 is in addition ;-)
    – petednz - fuzion
    Commented Jun 29, 2016 at 5:16
  • Sounds about right!
    – Laryn
    Commented Jun 29, 2016 at 12:14
  • Can I use this for the message template subject line, so I could have unique subject lines for each contribution form I have? Like this: {if $contributionPageID == 20} {ts 1=$title}Event Registration Receipt: %1{/ts} {elseif $contributionPageID == 21} {ts 1=$title}Membership Receipt: %1{/ts} {elseif $contributionPageID == 2} {ts 1=$title}Receipt for item purchase: %1{/ts} {else} {ts 1=$title}Generic: %1{/ts} {/if}
    – A. Block
    Commented Jan 21, 2019 at 18:04
  • @A.Block yes. However, you're likely better off using CiviRules to manage your receipts instead. Commented Jan 22, 2019 at 3:50
  • 1
    Wondering if anyone has an example of how to use civiRules to customize the subject line of the receipt (on/offline) system message?
    – A. Block
    Commented Aug 28, 2020 at 19:26

Your Answer

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

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