Support

Home Forums Event Espresso Premium Displaying surcharge on email template and PDF invoice

Displaying surcharge on email template and PDF invoice

Posted: August 11, 2014 at 3:46 am


SWTA

August 11, 2014 at 3:46 am

Hi Support

The company is about to become VAT registered and therefore we now need to display VAT for all events as well as detailing on the email and PDF invoices.

I found i can add the VAT easily as a default surcharge which i’ve also renamed to VAT via the General settings page.

My questions are:

1. How can i display the VAT breakdown and the VAT total cost on the confirm event registration page?

2. How can i display the VAT breakdown and the VAT total cost on the email template?

3. How can i display the VAT breakdown and the VAT total cost on the PDF invoice?

We are currently running Event Espresso – 3.1.36.4.P

Many thanks
Michael


SWTA

August 12, 2014 at 12:40 pm

Hi Support

Please can i get an update on this ticket.

Thanks
Michael


Tony

  • Support Staff

August 13, 2014 at 5:41 am

Hi Michael,

With EE3 to display VAT in each of those locations would require modifications to each of the sections mentioned.

1. How can i display the VAT breakdown and the VAT total cost on the confirm event registration page?

This would require modification to the template used for this page – event-espresso/templates/confirmation_display.php

2. How can i display the VAT breakdown and the VAT total cost on the email template?

This would require modifications to both the Emails and a custom email shortcode to display the surcharge amount within the email.

3. How can i display the VAT breakdown and the VAT total cost on the PDF invoice?

By default the PDF Invoice template does not display a full VAT breakdown but can be modified to do so. We have a gist available that provides a function to display GST/VAT within the invoice on EE3.

EE4 handles VAT much better is included within the Invoices by default, have you considered updating to EE4 previously?


SWTA

August 18, 2014 at 1:14 pm

Hi Support

Thanks for your responses, they are helpful but I do have a few more questions…

1. Displaying VAT (surcharge) breakdown on the confirm event registration page?

Is there an existing variable i can use within the ‘confirmation_display.php’ template to display the ticket price before the surcharge is applied as well as the actual surcharge amount?

2. Displaying VAT (surcharge) breakdown on the email template?

Is there any documentation that would help me create the custom email shortcode to display the ticket price before the surcharge is applied as well as the actual surcharge amount?

3. Displaying VAT (surcharge) breakdown on the invoice template?

I’ve got this to work perfectly with the gist (https://gist.github.com/joshfeck/52ac749150322a2e4221).

Many thanks
Michael


SWTA

August 18, 2014 at 3:17 pm

Hi Support

I’ve managed to partially solve some of my questions 🙂

The first question, about displaying the surcharge breakdown on the confirm event registration page, is in part solved by using a custom shortcode defined in a previous ticket (http://eventespresso.com/topic/event-list-show-price-before-surcharge/).

This shortcode displays the price without the surcharge perfectly but is it possible to provide another example that will show the actual surcharge amount?

The second question i still can’t figure out. How can i include these shortcodes within an email?


Dean

August 19, 2014 at 5:18 am

Hi,

The emails don’t have shortcodes, but instead they have tags (confusingly thy both use square brackets).

As Tony mentioned, the only way to achieve this would be to modify the email.php (/wp-content/plugins/event-espresso_31365/includes/functions/email.php) which contains these tags.

This is a core file and we don’t recommend nor support modifications like that.

The function is question is not pluggable nor does it have any action or filter hooks that can be used. As such changes to the file would be over written on plugin update.


SWTA

August 20, 2014 at 2:43 am

Hi Dean / Tony

Please could you supply the code modification required to email.php?

As a previous example, the code supplied in this request (http://eventespresso.com/topic/event-list-show-price-before-surcharge/) was incredibly useful!

Many thanks
Michael


Dean

August 21, 2014 at 5:47 am

Hi Michael,

Well, if you have the shortcode ready to display the charge, then in the email.php you would need to add another tag to the $SearchValues array (example http://take.ms/w7cGn) and then add the shortcode to the $ReplaceValues array (example http://take.ms/emZRJ).

What should happen is when the tag is parsed, the do_shortcode processes the shortcode and displays the output.

As always, test on a development server first.


SWTA

August 21, 2014 at 6:34 am

Hi Dean

Thanks for your reply…

I’ve added the new tag to the $SearchValues array and then the shortcode to the $ReplaceValues array. The tag is showing in the email but it’s not pulling through the value calculated in my custom_shortcodes.php

The function i have in custom_shortcodes.php is:

function get_espresso_price_sans_surcharge_sc($atts) {
  extract(shortcode_atts(array('event_id' => '0', 'number' => '0'), $atts));
  $event_id = "{$event_id}";
  $number = "{$number}";
  ob_start();
  echo espresso_return_single_price_sans_surcharge($event_id, $number);
  $buffer = ob_get_contents();
  ob_end_clean();
  return $buffer;
}
add_shortcode('EVENT_PRICE_SANS_SURCHARGE', 'get_espresso_price_sans_surcharge_sc');

This function works fine on confirmation_display.php

Is there something i’ve missed?
Does the function need to be in one of the core function files?

Many thanks
Michael


Josh

  • Support Staff

August 21, 2014 at 3:30 pm

The function itself doesn’t, but you’ll basically need to replicate it into an email shortcode. This can be tricky in 3.1.36.5 because the email shortcodes are all contained in a core function.

I can recommend downloading a copy of the Event Espresso 3.1.37 pre-release and working off of it. You can download this from your account page *after* you click the box to opt in to the pre-release channel.

One of the nice additions to Event Espresso 3.1.37 is the function that handles the email shortcodes is pluggable, so you can override it with your own function elsewhere. One place Event Espresso will check first for functions is /wp-content/uploads/espresso/custom_functions.php.

The support post ‘Displaying surcharge on email template and PDF invoice’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 5 years, 3 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!