3

I'm supposed to change the message template used when you wanna make a PDF receipt of a contribution. I found the template and started to modify its HTML code, unfortunately I'm not able to display the payment vehicle (cash, check,...). I tested a few tokens ({$payment_instrument} for instance) found on the internet but it didn't work. And I don't really know where I'm supposed to find all of the tokens (yes, I'm a bit of a beginner...).

Thanks !

5

I think you can use Smarty to retrieve the payment instrument in your template. You can play with API explorer to return this value -

enter image description here

Copy the contents in smarty section and add it to your template. Eg -

{crmAPI var='result' entity='Contribution' action='get' id=<contribution_id_variable>}
{foreach from=$result.values item=contribution}
  {$contribution.payment_instrument}
{/foreach}

In the above statement $contribution.payment_instrument should hold a value of the payment vehicle.

  • Thank you for your answer. Unfortunately, we weren't able to make your code works. So finally we decided to use the "Thank-you letters - print or email" functionality to be able to access easily to the tokens needed (by using the combobox in the template). – Davum Feb 28 at 8:50
1

you don't have a straight forward option at the moment (I guess)

Civicrm by default picks only contact Token

In-order to display payment method in the Invoice you need to create a new extension which can select the contribution payment method (as a token)

Ref Link:

https://docs.civicrm.org/dev/en/latest/hooks/

https://docs.civicrm.org/user/en/latest/common-workflows/tokens-and-mail-merge/

I guess this helps !!!

If you need more help - please let me know

Thanks

  • Not sure if this is the correct answer. The Invoice Template is a System Message and system messages are smarty templates. So one could use the API in the message template to retrieve additional data. It is quite complex but it is doable. – Jaap Jansma - CiviCooP Feb 21 at 16:08
  • @JaapJansma-CiviCooP - If you create a token_hook it will work - But That token will work only when you print/Email Invoice - This above solution is achievable – Ramesh - ARTECH Consultancy Feb 22 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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