Support

Home Forums Event Espresso Premium Adding custom registration questions to Invoice PDF

Adding custom registration questions to Invoice PDF

Posted: March 7, 2017 at 8:11 am


zubricks

March 7, 2017 at 8:11 am

Hi there,

I have had some success copying the invoice_body_template.php file to the uploads/espresso/templates/modules/gateways/Invoice/lib/templates folder, so that EE uses a customized PDF template instead of its default version.

I have a custom question configured that requires the user to submit their ‘Company’ to register. I need to show this Company information on the invoice PDF for accounting reasons, and am having difficulty pulling this information out of the PHP objects provided to the page.

How should I go about editing invoice_body_template.php in order to extract this custom question’s answer? Oh, I guess another note would be that it’s fine to do this only for the primary registrant.

Thank you!


Lorenzo Orlando Caum

  • Support Staff

March 7, 2017 at 9:57 am

Hello,

Manually creating a template for the invoice is no longer needed as the invoice system is now handled through the messages system.

You can deactivate the template by renaming it and then remove the content that you do not want to appear through the default template in Event Espresso –> Messages –> Default Templates –> Invoice –> Purchaser and save changes.

Then scroll to the main content area and you can use this shortcode to show answers to questions:

[PRIMARY_REGISTRANT_ANSWER_*]

If your question name was “Is this your first event?” — then this would be the updated shortcode:

[PRIMARY_REGISTRANT_ANSWER_*Is this your first event?]

Note that it needs an exact match.


Lorenzo


zubricks

March 7, 2017 at 10:30 am

Hi Lorenzo, thanks for the quick response.

I need to also pull in custom fields, via Advanced Custom Fields – to this template. That means I need to access specific information such as the ID of the event that was registered to, and use PHP to call ACF’s ‘get_field’.

This is what made me prefer to edit the PHP file instead of deal with your new messages system.

Any advice?


Tony

  • Support Staff

March 7, 2017 at 12:21 pm

I have had some success copying the invoice_body_template.php file to the uploads/espresso/templates/modules/gateways/Invoice/lib/templates folder, so that EE uses a customized PDF template instead of its default version.

When you do this you basically tell EE to use its ‘older’ system for invoices which we no longer support/update. It is currently still included within EE to prevent users already using this system from seemingly randomly losing all of their customizations.

Moving forward you would be much better off learning how the new messages system works and creating your own shortcodes to pull in the information you need.

I have previously posted some examples of doing this, take a look here:

https://gist.github.com/Pebblo/e87cc8e30c4848dcdfe2

If you also take a look within the comments section you’ll also find a couple of links to threads with more details.

The support post ‘Adding custom registration questions to Invoice PDF’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso