Support

Home Forums Pre-Sales Customizing the invoice details

Customizing the invoice details

Posted: November 25, 2014 at 9:57 am


Nate Wright

November 25, 2014 at 9:57 am

It’s really nice to see Events Espresso has a free version out on the .org repo. I’ve been meaning to check it out for a while and now I’ve got a client that’s given me a good excuse.

I think EE4 will serve my client’s needs. But I’ve just got one issue to resolve. They run events in which it is very common for people to sign up but want the invoice directed at their employer.

The automatic invoice generator is fantastic. For my client, it would be best to collect the attendees information, but have separate fields where they can specify an invoice name/address details. I’ve dug into the code which generates them at /modules/gateways/Invoice/lib/Invoice.class.php. Unfortunately, it doesn’t look like the $template_args are ever filtered, so there isn’t a clean way for me to update the name and address in the invoice from other fields collected with the registration.

I can see the templates are set at /modules/gateways/Invoice/lib/templates/. Can these templates be overwritten in a theme or plugin, by any chance? And if so, can custom registration fields be used?

Do any of your developers have another idea for how to accomplish this? It seems so close. But as a plugin developer myself, I am very hesitant to edit the plugin files directly (and so create complications with every update).

(We’d be looking at the Personal License for, at least, the custom registration fields.)

Thanks for any help you can provide.


Lorenzo Orlando Caum

  • Support Staff

November 25, 2014 at 12:36 pm

Hi Nate,

The invoice templates can be copied from this location:

/wp-content/plugins/event-espresso-core-reg/modules/gateways/Invoice/lib/templates

…to this location:

/wp-content/uploads/espresso/templates/modules/gateways/Invoice/lib/templates

You will need to create part of the folder location above in your WP uploads folder and then move the files. Then you can make changes and Event Espresso 4 will begin to use those files.


Lorenzo


Nate Wright

November 25, 2014 at 4:31 pm

That’s fantastic Lorenzo. After you mentioned that, I was able to chase it down to the place where it calls the WP core function locate_template() in EEH_Template.helper.php. That’s great because it means I can also throw a template into /wp-content/themes/mytheme/modules/gateways/Invoice/lib/templates. I’ll have to think about which one is better for the client in the long-run.

I have not yet found anywhere in the code that passes in custom field values. I’m looking at the Decaf version now, but my client would use the paid version with support for custom fields. Are these added to the $template_args available in the template?


Dean

November 26, 2014 at 12:54 am

Hi,

Custom fields are saved as post meta, so you should be able to just use get_post_meta or similar function http://codex.wordpress.org/Function_Reference/get_post_meta


Nate Wright

November 26, 2014 at 3:32 am

Thanks Dean.


Dean

November 26, 2014 at 4:47 am

No problem!


Dean

November 26, 2014 at 4:55 am

One other thing. In 4.5 (which we are hoping to release soon) you will be able to edit the Invoice directly in the plugin (just like with the Messages), so you may want to hang fire until it’s released and see if you can achieve your goals without needing to custom code.


Nate Wright

November 26, 2014 at 5:54 am

Thanks Dean. My client needs a solution in place by end of year. Does “soon” mean a couple weeks or a couple months?


Lorenzo Orlando Caum

  • Support Staff

November 26, 2014 at 9:32 am

Hi Nate,

4.5 will be available before the year is up (sooner than that). We have a handful of bug tickets to finish up and then we’ll go through a testing checklist before releasing it.


Lorenzo


Nate Wright

December 4, 2014 at 9:50 am

Hi guys. I have another wrinkle. My client is ready to purchase EE4 (they’re just waiting on approval for their non-profit status). They want a set of custom fields for defining a separate Invoice contact, as described above. But they really want this to only be displayed AFTER the registering user selects the Invoice payment option.

I’ve been around and around with EED_Single_Page_Checkout.module.php and the associated gateways and models. But I’m really struggling to figure out how to accomplish this in a forward-compatible manner. I see three approaches:

1. Add a custom registration step by hooking into the FHEE__Single_Page_Checkout__setup_reg_steps_array__reg_steps filter. As far as I can tell, though, the process_func and display_func options have to reference methods within the EED_Single_Page_Checkout class. That limits my ability to extend them without tampering with the code itself.

2. If I have to, I can add a small hook into EE_Invoice::espresso_display_payment_gateways() to add the fields so that they appear when the user selects the Invoice option. However, I can’t for the life of me figure out where the form fields for payment options are actually processed and stored. The form (#spco-registration-payment_options-frm) has a setting which registers this payment type. Can you point me to where this occurs in the code? Ideally, I’d like to save the invoice information into the Billing Information section of the Transaction post.

3. Worst case scenario is that I just add the fields through the normal registration fields. Then I can hide them, reveal them and scroll to them when the user selects Invoice. This would do the trick, but I’d really prefer to keep the user’s focus in place.

I understand this is beyond a normal support request. I’m just hoping you might be able to point me to something I’ve missed in the code, particularly for #1 or #2. If you think one of your people could walk me through this in a 30-min chat, I’d happily buy a priority support ticket. I wouldn’t need everything spelled out, just some quick points on where to hook in and add these fields to the registration process.

Thanks.


Josh

  • Support Staff

December 4, 2014 at 2:26 pm

Hi Nate,

The only way to make these customizations future proof would be to base them on Event Espresso 4.6 (currently in alpha). This is because SPCO and the gateways have been completely re-written and are now more modular. You’ll likely find the more modular checkout and gateway code easier to build on top of.

I can recommend signing up for Github access and reviewing what’s in 4.6 and if you need a hook added anywhere, please feel free to open a pull request.


Nate Wright

December 4, 2014 at 2:37 pm

Hi Josh,

Thanks for the quick response. I’ll definitely sign up for GitHub access and look into 4.6 as soon as my client has made the purchase. (Do non-profit discount applications take very long?)

Do you know how stable Events Espresso 4.6 is at the moment? Normally I would jump on board without hesitation, but my client has a very tight deadline and this project needs to be implemented by December 22. So if EE 4.6 is still pretty rough, I unfortunately don’t have the time to hold off until it stabilizes.


Josh

  • Support Staff

December 4, 2014 at 3:50 pm

Hi Nate,

I can suggest rolling the site out with 4.5 with minimal customizations, then build your customizations on top of 4.6.


Nate Wright

December 10, 2014 at 7:46 am

How long does it take to get github access? I applied on Monday using my client’s username (qnis). I’d love to see what SPCO looks like in 4.6. My 4.4.6 hack is super ugly and fragile.


Lorenzo Orlando Caum

  • Support Staff

December 10, 2014 at 10:09 am

Hi, the development team manages our Github projects so I’ll follow up with them on access. It usually takes just a couple days.


Lorenzo


Nate Wright

December 10, 2014 at 10:12 am

Thanks!


Lorenzo Orlando Caum

  • Support Staff

December 10, 2014 at 1:13 pm

You should have received an invite to the project.

Thanks


Lorenzo


Lorenzo Orlando Caum

  • Support Staff

December 8, 2015 at 6:25 pm

Hi Nate,

When we shared feedback on your question last year, copying over the templates for editing was the recommended way to edit the templates for the Invoice or Receipt.

That has changed as Event Espresso 4 now has an editor to edit those templates through the WP dashboard.

It can be found in Event Espresso –> Messages. You’ll now be viewing the Messages Overview screen. Now look for Invoice or Receipt and click on Purchaser. Here is an example of how they appear on the Messages Overview Screen:

http://cl.ly/image/2O341M2z0H1q

If you do not see them, then you may be using an old version of Event Espresso 4 or they may be on page 2 so you can paginate (browse) to page 2 and they should be there.

Here is a change log for Event Espresso 4:

https://eventespresso.com/wiki/ee4-changelog/

If you have any new questions about the using the messages system, then please create a new support post in our support forums:

https://eventespresso.com/support/forums/


Lorenzo

The support post ‘Customizing the invoice details’ 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