2

When completing a contribution, an email can be sent out with an attached PDF called "receipt.pdf". Is it possible to have this PDF printable on the Thank You page? I currently have a sloppy Print Button on my ThankYou.extra.tpl file, but it is not clean because I am using: $('#crm-main-content-wrapper').before('<div id="print-button"><p><a href="javascript:window.print()" class="btn btn-primary">Print</a></p></div>'); , which is basically printing the entire webpage. I also tried the &snippet=2 approach in the URL, but that is also too sloppy for the client.

Does anyone know of how to hook into that PDF generation code and spit it out into the ThankYou template?

1 Answer 1

2

Not tested yet, but can you try calling /civicrm/contribute/invoice?reset=1&id=<contribution_id>&cid=<contact_id> in the href instead of javascript:window.print()?

Note that the token <contribution_id> is the payment id that was created after you submitted the contribution form. <contact_id> is the id of the contact to which contribution belongs. Check if you can already get this in the thankyou template variables. More info - https://docs.civicrm.org/dev/en/latest/tools/debugging/#in-smarty-template-files

Also, make sure you've permission to download the invoice. I think civi requires either access CiviContribute or view my invoices.

UPDATE - For Joomla - The url is - /index.php?option=com_civicrm&task=civicrm/contribute/invoice&reset=1&id=< contribution_id>&cid=<contact_id>

4
  • Unfortunately, using the exact contribution Id and contact ID with that path only brings me to a front end page of a contribution summary for the user, along with the options to view, edit or delete any contributions. Commented Nov 12, 2020 at 15:20
  • 1
    I inspected the print button and found it was /index.php?option=com_civicrm&task=civicrm/contribute/invoice&reset=1&id=152&cid=3 You basically had it, but the ? was a & after invoice. Commented Nov 12, 2020 at 15:28
  • thanks Kurt - i edited the answer to correct that.
    – petednz - fuzion
    Commented Nov 12, 2020 at 19:55
  • looks like you're on joomla. In that case, yes, the URL format is different. For drupal users - pls use the original /civicrm/contribute/invoice?reset=1&id=<contribution_id>&cid=<contact_id>. Commented Nov 13, 2020 at 2:38

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.