Posted: March 7, 2019 at 10:47 am
For my event, the user can pay by credit card or get invoiced and pay by check. If they pay by CC I want to display some optional information. If they pay by check then they should not see the information. I have the optional information showing on the page as desired….just need to determine how to get payment status into a variable I can use that in the if statement. Using this function
So this line needs to be something like: Just don’t know how to get that PAYMENT_COMPLETED info…. |
|
For my event, the user can pay by credit card or get invoiced and pay by check. If they pay by CC I want to display some optional information. If they pay by check then they should not see the information. I have the optional information showing on the page as desired….just need to determine how to get payment status into a variable I can use that in the if statement. Using this function So this line needs to be something like: Just don’t know how to get that PAYMENT_COMPLETED info…. |
|
Hi there, Pulling the information from our model system is easy enough, however, there’s a little more to this than it seems. Before going into details, which payment method are users selecting when they want to pay via check, Invoice? Is it specifically the payment you want to check, or if a registration has been Approved? What do you want to happen if say a user that selected Check, pays via check, you apply it to the transaction and then the user manages to revisit the thank you page for their registration, should it show the details then? Registrations are automatically Approved with an Online payment method (Card payments) once the user has paid in full, or if you have the ‘Default Registration Status set to Approved and they finalize a registration. Note that it IS possible for a user to return to the thank you pag at a later date. With our models, you can pull the last payment method selected (meaning you would know if they selected a specific offline payment method), you can pull the payment object(s) from the transaction to check the status of specific payment, the transaction and its satatus (which is based off the payments made) and/or the registration status. It all depends on the amount of control you want and the exact conditions you want to show the details. For the majority of users, the last payment method, transaction status and/or Registration status gives you enough details for this type of condition. |
|
Users who pay by check will choose Invoice. The thank you page shows a REG Status of “Pending Payment”. If a user sends a check and it’s applied, and then later returns to the Thank You page they should indeed see the information. Admittedly I don’t yet understand how to use the models very well. How would I go about getting the last payment method, as well as the payment object….since that seems like it would give me the status so once the check is applied and the status changes from Pending Payment to Approved they could come back to the page and get the hotel registration link (which provides a deal….which is why they client does not want them to see the link until they have paid in full) |
|
To be honest, it sounds like you just need the Registration Status rather than anything concerning payments, but I’ll show you a few different methods. Using the models makes a lot of this easy and I’d advise looking over the documentation for them HERE. So anything to do with the registration, you already have in The check I would use is simply:
Which checks if the current registrations status is ‘Approved’. You posted this:
Which means you are using the default value for the ‘Default Registration Status’, which is Pending Payment. So registrations become Approved either way payment is made in full using an online payment method, or the admin, manually changes it to Approved. So the registration status can be used to do what you need, although again, the option for finer control is available as you have the registration object, you can pull the
Check the status of a transaction:
To pull the last payment method used on a transaction:
Now you have a payment method object, you can check if it’s a specific payment method (like invoice) An array of payment objects from the transaction:
Throw I recommend using Kint Debugger, wrapping the object you have in |
|
Thanks Tony. I very much appreciate the thoughtful explanation beyond just providing the answer of adding && $registration->status_ID() === EEM_Registration::status_id_approved. Which worked great for my use case. The extra details will help build my understanding of EE, since this is our first project using EE it’s been a bit uphill. |
|
You’re most welcome. If you do have any questions just let us know, we can’t write code for you but we can at least help point you in the right direction 🙂 |
|
The support post ‘Optional Thank You Page Message’ 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.