To do what you are trying to do you need a working knowledge of PHP and OOP, there’s a lot of problems with the code you’ve posted.
It looks like you are trying to access values within the transaction object in a similar way to accessing keys in an array which won’t work and also the transaction object doesn’t store a lot of the details your trying to output.
For example $args["Event"] = $transaction->"Event";
->"Event"; doesn’t mean anything here.
->event; or ->event(); could if the Transaction object had an event property or an event method, but again it has neither.
In the above your attempting to pull ‘Event’, ‘Registration’, ‘Attendee’, ‘Contact’ and ‘Question/Answer’ values all from the transaction object, most of those aren’t available like that.
You can use our model system to pull the information from the transaction:
Thanks for your help with this. I know PHP pretty well but not OOP. I took a look at the link you sent and it looks like get_one_by_ID() will do the trick.
So now the question is, how do I get the current registration ID from
$transaction = $registration->transaction() ?
I’m new to EE, so is there a better hook I should use?
I want to add the row to the Airtable base after the registration has been processed. It would be helpful to know if the payment was successful or not.
I took a look at the link you sent and it looks like get_one_by_ID() will do the trick.
For which? You can pull some of the details from the transaction object, for example:
how do I get the current registration ID from
$registrations = $transaction->registrations();
Gives you an array of registration objects, then loop over the array and do whatever you wish with each registration object.
Try using kint debugger, wrap the transaction object in d(); and then view all of the available methods on that object, it’ll give you a better idea of how you can pull the details.
Then do the same with the registration object when you have it and so on.
I want to add the row to the Airtable base after the registration has been processed.
I want to send the table to Airtable. I need to get all the fields mentioned in the first post and send to Airtable via their API. This part is working. I just need to get data from all the fields from Event Espresso.
May I ask what are the determining factors that would potentially make one hook be better than another?
Viewing 6 reply threads
The support post ‘Adding a row to an Airtable base with EE registration info’ 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.