Support

Home Forums Event Espresso Premium Adding Event date and name to invoices via infusionsoft

Adding Event date and name to invoices via infusionsoft

Posted: October 22, 2020 at 4:46 am


Shaun

October 22, 2020 at 4:46 am

Good day

I have been trying to achieve my subject line for sometime. I have created a site plugin and placed the below code into that file.
<?php
/*
Plugin Name: Site plugin for redcherryevents.co.za
Description: Site specific code for redcherryevents.co.za
*/
/* Begin Adding Functions Below This Line;

function ee_infusionsoft_pass_event_start_and_name( $is_contact_data, $ee_attendee ) {
if( $ee_attendee instanceof EE_Attendee ) {
$startdate = ”;
$eventname = ”;
$checkout = EE_Registry::instance()->SSN->checkout();
if ( $checkout instanceof EE_Checkout ) {
$transaction = $checkout->transaction;
if ( $transaction instanceof EE_Transaction ) {
foreach ( $transaction->registrations() as $registration ) {
if ( $registration instanceof EE_Registration ) {
$event = $registration->event();
if ( $event instanceof EE_Event ) {
//get the event start date
$startdate = date( EED_Infusionsoft::IS_datetime_format, $event->primary_datetime()->get_raw( ‘DTT_EVT_start’ ) );
//get the event name
$eventname = $event->name();
$is_contact_data[ ‘_yourISfieldfordate’ ] = $startdate;
$is_contact_data[ ‘_yourISfieldforeventname’ ] = $eventname;
}
}
}
}
}
} else {
EE_Error::add_error(sprintf( __( ‘ee_infusionsoft_save_my_custom_questions was not called with an EE_Attendee but a %s’, ‘event_espresso’ ), gettype( $ee_attendee )), __FILE__, __FUNCTION__, __LINE__ );
}
return $is_contact_data;
}
add_filter( ‘FHEE__EED_Infusionsoft__save_infusionsoft_attendee__extra_attendee_data’, ‘ee_infusionsoft_pass_event_start_and_name’, 10, 2 );
/* Stop Adding Functions */

When doing this and going to infusion soft, it doesnt bring up any extra fields. Please advise what steps i should take.

Many thanks


Tony

  • Support Staff

October 22, 2020 at 5:31 am

Hi Shaun,

The snippet Josh created above adds the values to the IS contact, a contact could have multiple orders and therefor multiple Invoices.

So is adding this info to the contact itself the correct method for your situation?

When doing this and going to infusion soft, it doesnt bring up any extra fields. Please advise what steps i should take.

Where are you checking for these values?

Can you include a screenshot?

https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots


Shaun

October 22, 2020 at 5:44 am

Hi Tony

I am checking for these values when trying to link Zapier to my Infusion soft contacts. My end goal is to automatically create invoices from all entries that are coming in. Please see my screen shot here https://documentcloud.adobe.com/link/track?uri=urn:aaid:scds:US:9b220c3a-080d-4319-ae67-c961b7d8c71c

The fields i would like to come through are
1) Event Date
2) Registartion ID generated by EE (xxx-x-xx-xxx)
3) Event name
4)Ticket type

Thanks again Tony!


Shaun

October 22, 2020 at 11:17 am

Please note that im trying to make invoices and payemnts flow from
Event Espresso –> Infusion soft –> Xero(Accounting).

Thanks again for your guys’ guidance!


Shaun

October 23, 2020 at 8:24 am

Please get back to me about this, i would like to get it sorted as soon as possible.


Tony

  • Support Staff

October 26, 2020 at 10:15 am

Right now you have the example code provided by Josh, but you need to create the custom fields on the contact and then update the code to actually link with those fields.

So, starting from the beginning have you created the custom fields within IS contacts that your code should be syncing with?

If no log into your IS account and go to Admin -> Settings.

You’ll see a ‘Custom Fields’ section and it should show ‘Set up custom fields for:’

Select Contacts and click Go. Add the custom fields you want to store data in and note the names of the fields.

Next, update the above snippet to sync with those fields.

You do that by changing this:

$is_contact_data[ '_yourISfieldfordate' ]

To be your field name with no spaces, the underscore at the beginning is required for custom fields, it is not required for standard IS fields.

So if you have a custom field called ‘Event Date’, the field will be:

$is_contact_data[ '_EventDate' ]

The example code you are currently using already gives you Event Date and Event Name, so start with those and add a registration to confirm those values work, I can then give you some details on how to pull the RegCode (The format you showed above is the RegCode not RegID) and ‘Ticket Type’ I assume is the name?


Shaun

October 29, 2020 at 5:29 am

Hi Tony

I can’t seem to get it right 🙁

1) I have added the custom fields into my infusion soft contact as discussed.
2) I have updated my plugin to reflect this, `$eventname = $event->name();
$is_contact_data[ ‘_EventDate’ ] = $startdate;
$is_contact_data[ ‘_EventName’ ] = $eventname;
3) I have disabled and then enabled the plugin.
4) Run a test entry
5) Don’t see this data get pulled through to infusion soft nor do i see it come through when trying to setup zappier.

Please advise as i have followed the above instructions to a T.

Thanks


Shaun

October 29, 2020 at 5:57 am

Please note that i see these fields in the infusion soft contact. I can only seem to place under “Outlook fields” i cant seem to get them to be under the general fieilds.

Please advise and thanks for the help.


Tony

  • Support Staff

October 29, 2020 at 6:34 am

I don’t have Outlook Fields on my IS account but sounds like those aren’t the correct custom fields.

Please include a screenshot of each step you are taking to add custom fields into your IS account, the above code works as I tested it when replying to confirm so it sounds like the above fields are in the wrong location. It may be something different on your IS account to mine.

You can mark your reply private so that only EE support can view the screenshots.

https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots


Shaun

October 29, 2020 at 6:59 am

Hi Tony

Thanks for the quick reply.
1) Here is my screenshot of how i navigate to the custom fields https://snipboard.io/uKXiH0.jpg and here are my custom fields https://snipboard.io/TlnKGB.jpg
2) Here is my contact record, i see that the fields show up here but not on orders. https://snipboard.io/zGSqMy.jpg, these fields also dont populate when someone enters.
3) Here is the the plugin on my site https://snipboard.io/nWw4RQ.jpg

Please advise what other steos in the process you need to see.

Appreciate the help.


Tony

  • Support Staff

October 29, 2020 at 7:14 am

Oh, ‘Outlook Fields’ is just the name of your tab, that’s custom set on your IS account.

1) Here is my screenshot of how i navigate to the custom fields https://snipboard.io/uKXiH0.jpg and here are my custom fields https://snipboard.io/TlnKGB.jpg

Those are correct.

2) Here is my contact record, i see that the fields show up here but not on orders. https://snipboard.io/zGSqMy.jpg, these fields also dont populate when someone enters.

Showing on orders? They are contact fields as mentioned in my first reply, unless you mean you’re pulling them from the contact into the order?

3) Here is the the plugin on my site https://snipboard.io/nWw4RQ.jpg

Ok, none of that code is running because of line 6.

Either remove that line completely or add */ to the end of it.

The /* at the beginning is the start of a multi-line comment which the is never closed, meaning all of your code is currently commented out (thats why it’s all green).


Shaun

October 29, 2020 at 7:40 am

Hi Tony

Okay i have fixed that code issue, please see it now. https://snipboard.io/rys1Q2.jpg

So i am trying to link these entries from Event espresso to go into Xero as invoices. I need to use Zappier for this integartion.

My trigger event is when a new ORDER gets raised in Infusion soft, it pulls this contact data and then you match the fields. I am not sure if the fact that i am using the order function, it might not be pulling the contact data.

I have tried again with a test entry but i still dont see any data coming through into the custom fields.

Thanks for your help, it would be amazing to get this right.


Shaun

October 29, 2020 at 7:48 am

Hi Tony

Here is my process with zappier where i need to see the desired custom fields https://snipboard.io/VfXRMu.jpg

These are the fields that i am trying to have the option to get the event date, name and registartion code in https://snipboard.io/gTNwvf.jpg

Thanks


Tony

  • Support Staff

October 29, 2020 at 8:00 am

So i am trying to link these entries from Event espresso to go into Xero as invoices. I need to use Zappier for this integration.

My trigger event is when a new ORDER gets raised in Infusion soft, it pulls this contact data and then you match the fields. I am not sure if the fact that i am using the order function, it might not be pulling the contact data.

Unfortunately, I don’t use either of those with IS so can’t comment on how it’s bringing those details over.

Either way, we won’t know until we get the custom fields working.

Sometimes some API’s struggle with date fields and need specific formats, as your using an actual date field in your contacts that may be an issue, for now, comment out line 22, just // at the beginning, so:

//$is_contact_data[ '_EventDate' ] = $startdate;

Also, at the bottom of your ‘Outlook fields’ you see see a link that has:

View the field database names (for the API)

Click that and you’ll get a table of Label, Type and Database Name for your fields. The field name we use is the Database Name (prefixed with an underscore) so make sure those match what you are using and don’t have a number or something else on the IS side (if they have, update your code to use the correct name).


Shaun

October 29, 2020 at 2:18 pm

Hi Tony

I have updated the code https://snipboard.io/fSHBn9.jpg

Here is the screenshot of my API contacts https://snipboard.io/4dxKhE.jpg

Please advise, where exactly i should be able to see this data getting pulled to. For example https://snipboard.io/E3DmRQ.jpg this person has entered an event recently. But no data gets pulled through about their event name. Nor does it go to any fields in their orders.

Thanks again


Tony

  • Support Staff

October 29, 2020 at 3:27 pm

Please advise, where exactly i should be able to see this data getting pulled to

The location in your screenshot is where those fields should be showing.

Is the ‘Site plugin for redcherryevents.co.za’ plugin definitely active on the site?


Shaun

October 29, 2020 at 11:15 pm

Hi Tony

Please see my site plugin, it’s activated and vsible on the site https://snipboard.io/jRMwFe.jpg

I would really like to get this sorted, thank you 🙂


Shaun

November 1, 2020 at 11:38 pm

Good day.

There must be an issue with the API from Event Espresso. Even my orders are coming through with product names that don’t match the sales.

Ie, someone enters and en event. The title comes up as correct, but then the line items per transaction come up with all different event names.

Please advise soonest as the main reason for getting infusionsoft was because of the integration with EE. This has been going on for almost two weeks now and I really need a solution.

Thanks


Tony

  • Support Staff

November 2, 2020 at 1:46 pm

There must be an issue with the API from Event Espresso. Even my orders are coming through with product names that don’t match the sales.

Whilst it’s certainly possible there is an issue with the API if there was an issue with how EE uses the InfusionSoft API we’d have reports from multiple users as it’s the same for all users.

I’ve tested all of the code I’ve given you above and the IS contacts are syncing with my custom values:

https://monosnap.com/file/L72bpTDV2Z766jRp73x7OmMTxYJAFd

I’m using _ClassType and _ClassDate in my snippet

An example of an order shown on my account:

https://monosnap.com/file/0P6fV1JgvoOgoN8tLjJuLR2ZtpLMG3

The event name is ‘Testing InfusionSoft’ and the Ticket is ‘Free Ticket’, shown correctly.

Ie, someone enters and en event. The title comes up as correct, but then the line items per transaction come up with all different event names.

I’ll need to see details for this as I can’t reproduce, can you add some screenshots of what you see?

We normally require a support token to view anything on the site but I’ll happily log in and confirm your the code I’ve sent above is correct on your site if preferred? If you need further troubleshooting and I can’t see an issue with the IS API usage you’ll need to purchase a support token for us to investigate this further on your server:

https://eventespresso.com/product/premium-support-token/

The support post ‘Adding Event date and name to invoices via infusionsoft’ 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.

Do NOT follow this link or you will be banned from the site!
[i]
[i]