Posted: March 19, 2014 at 11:41 am
|
Word press version 3.8.1 I’m not sure if this should be here or in ticketing, but I’m putting it here, since it seems more to do with customization of the checkout process. I want to insert another summary page after the Thankyou page that contains the number of registrations/tickets that were purchased or signed up for. I am attempting to figure out how this information gets passed between the pages? So I need to find the transaction Id and look it up in the db? or can I simply pass the one item I need (number of tickets) as I’m progrssing through the process? If I can pass it, what is it’s name (what is the variable that I need to refer to) and if I need to look up in the DB, what is the Transaction Id that I need called? Thanks |
Hi Annette, I wrote a post on our soon to be launched Developer Portal website that addresses your issue. You can view the post here: http://developer.eventespresso.com/tutorial/customizing-the-event-espresso-thank-you-page/ Hope this helps. |
|
|
Ok, this is Jeff, the actual Developer. maybe I’m not understanding the page you pointed us to, but I don’t think I can accomplish what I’m trying to in that manner. What I want is to simply take the number of tickets/registrations and pass them to another, non-WP/EE page (php script) on the same server. In attempting to implement the manner described in the post you linked to, I get the error: “No direct script access allowed” I can see that at some point, the solution pointed to will work, but it seems to me to be the long way around to be changing the functions.php file and adding callback hooks, etc… But then, it could simply be my inexperience in programming EE or very deeply into WP. |
|
Ok, Jeff again. So I’ve plugges away at it a bit further, and actually am getting a bit further. However. In teh example, you have a statement of: [code language=”php”]$registrations = $transaction->registrations();[/code] but when I try to loop through the $registrations object, I get the error: “Fatal error: Call to a member function reg_url_link() on a non-object” It apparently doesn’t think that the $registrations variable is an object. Am I missing a declaration of the $registration object? Thanks for the help |
“What I want is to simply take the number of tickets/registrations and pass them to another, non-WP/EE page (php script) on the same server.” So by non-WP/EE page you mean that your script is going to run outside of WordPress ? Event Espresso functions exclusively as a WordPress plugin and for security reasons does not allow outside scripts to just access any files or functions, hence the error you experienced. I unfortunately can not help you to circumvent security measures and tap into our system via outside scripts. If you do not want to hook into Event Espresso correctly, then you are more than welcome to pull data directly from the database from your own scripts, but I would think that if you are an experienced enough programmer to do that entirely from your own script, then integrating with EE and WordPress would not be that difficult. When Event Espresso data, such as the number of tickets/registrations, is retrieved from the database, it is immediately used to generate objects, because EE4 is now built using PHP’s OOP capabilities. These objects are of no use outside of the framework they were generated in, and you would only experience errors because your script would not recognize what they are. Even if I showed you how to pass an EE_Transaction object to a “non-WP/EE script”, that script wouldn’t know what that object was, and would not be able to do anything with it. So with no way to use EE4’s automatically generated objects, you will have to pull the data from the database directly yourself, and I can not help you with this, as it obviously goes way beyond the realm of simply helping you with Event Espresso. |
|
OOPS, |
|
$registrations = $transaction->registrations(); should return an array of EE_Registration objects. In the Dev Portal document I had previously linked to, I stated that it is always wise to verify you have the correct object you are expecting, so you should similarly do something like that here while looping through the $registrations array, such as: if ( $registration instanceof EE_Registration ) { // code here } if you use Kint to dump the $registrations array, what do you get? d( $registrations );
|
|
|
OK, solved the issue. And then read your updates… 😉 What I basically needed was sizeof($registrations); … that’s it. I created a plugin that will create a hidden field on the page that holds the number of tickets (the size of the registrations array), and then have some JavaScript that fires off a call to the other php after having extracted that information from the hidden input field. Works like a charm. Now I’m thinking that I might need the event ID. But I need to be able to also have it at the creation of the event as well. That might be a bit more interesting to extract. Thanks for your help! |
The support post ‘Passing registration info to another page’ 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.