Support

Home Forums Event Espresso Premium Check-In in HTML Receipt (Use of the receipt as a certificate after the event)

Check-In in HTML Receipt (Use of the receipt as a certificate after the event)

Posted: April 20, 2018 at 3:10 am

Viewing 11 reply threads


motio

April 20, 2018 at 3:10 am

I have a follow up question to that post:
https://eventespresso.com/topic/generate-custom-pdf/

I would like to use the receipt as a certificate after the event.

I was able to insert most information like People, Datetimes and Post Meta into the receipt.

But I can’t figure out how to display the check-in of the primary registrant (we sell only one spot per ticket so are only using the primary registrant). Is there a “helper” that I can use (like the Event_View helper)?


Josh

  • Support Staff

April 20, 2018 at 12:54 pm

Hi there,

If you have the registration object (or have the registration ID, then get the registration object) you can use the check_in_status_for_datetime() method. Or build out a shortcode using similar PHP code.


motio

April 20, 2018 at 2:54 pm

Hi Josh,

that’s actually is what I have trouble with, I can’t figure out how to load the registration object.

I found this https://github.com/eventespresso/event-espresso-core/blob/master/docs/T–Tutorials/customizing-the-ee-thank-you-page.md description but it shows me an error that registrations() is a member function.

EE_Registry::instance()->load_model( 'Transaction' );
$transaction = EE_Registry::instance()->load_model( 'Transaction' )->get_transaction_from_reg_url_link();
$registrations = $transaction->registrations(); 

Could you hint me to another way how to have the registration object?


Josh

  • Support Staff

April 20, 2018 at 3:51 pm

You’re not actually working within the context of the Thank You page, you’re working within the context of the HTML Receipt, right? So you can get the registration object in the same manner that the Receipt’s Primary Registrant shortcodes get the registration object. You’ll find an example in the
EE_Primary_Registration_Details_Shortcodes class.


motio

April 25, 2018 at 2:09 pm

Thank you Josh, that helped me a lot.

How could I load the registration object in the table template?


Josh

  • Support Staff

April 25, 2018 at 2:30 pm

Which table template specifically?


motio

April 25, 2018 at 2:32 pm

I mean the Events Table View Template (Add-on).


Josh

  • Support Staff

April 25, 2018 at 4:15 pm

That particular add-on only deals with events, datetimes, and venues, so it has no use for the registration object.

I can point you to the documentation that shows how to get related models (for example if you have an event, you can get the related datetimes, then get the related tickets and registrations).

https://github.com/eventespresso/event-espresso-core/blob/master/docs/G–Model-System/model-querying.md#model-relations


motio

April 26, 2018 at 3:33 am

Thank you, that will help me also with other topics.

We sell mostly two different tickets per event. I would like to display the amount of each ticket sold for the current event.
Because the ticket id is in every event different I have to get all tickets from the EEM_Tickets model. With the ‘TKT_ID’ from EE_Registration through the EEM_Registration model I have to connect it to the EE_Ticket class. Than I count count how many Tickets with the name “Kursteilnahme” there are. I’ve tried it but can’t get my head around how to do it.

Do you have an code example which I can transfer to my case? Or is there an easier way?


Tony

  • Support Staff

April 26, 2018 at 6:36 am

Hi Motio,

Each ticket has a sold value stored in the database, that’s the number of Approved registrations linked to that ticket.

So when you have the ticket object, you can do something like echo $ticket->sold(); on the ticket to output the sold value. You’d need to check your have the correct ticket before doing so, but you can do that by checking the name of the ticket.

As far as I am aware, we don’t have any examples of what you are looking for.


motio

May 7, 2018 at 4:56 am

Thank you Tony, step by step I get to understand everything.

In case somebody has a similar task, here is a part of the code:

$get_event = EEH_Event_View::get_event();
$get_tickets = $get_event instanceof EE_Event ? $get_event->tickets() :  '';

// Filter tickets for a Ticket name
$ticket_kursteilnahme = array_filter(
    $get_tickets, function ($e) { return $e->get_raw('TKT_name')  == "Kursteilnahme";
    }
);

// Get array of all formatted ticket prices
$min_price = array_map(function($o) { return $o->pretty_price(); }, $get_tickets);


motio

May 7, 2018 at 5:11 am

Thank you both for your help. I am almost ready with the certificate template and it will save me a lot of time.

Viewing 11 reply threads

The support post ‘Check-In in HTML Receipt (Use of the receipt as a certificate after the event)’ 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