Support

Home Forums Event Espresso Premium Attendee ID for each Transaction

Attendee ID for each Transaction

Posted: June 25, 2021 at 4:24 am


Mark

June 25, 2021 at 4:24 am

Hi,
I want to add attendee_ID to the transaction table.
https://www.screenpresso.com/=elgre
Thanks.


Tony

  • Support Staff

June 25, 2021 at 4:58 am

Hi there,

We don’t have an option to include this within EE itself but there are filters you can use to add additional columns.

Just to confirm, are you aware that ATT_ID is linked to the registration(s) assigned to a transaction, not directly to the transaction?

You could also have multiple registrations assigned to a single transaction which may (or may not) mean you have multiple ATT_ID’s to display.


Mark

June 28, 2021 at 3:48 am

Yeah, I want an Attendee ID for each transaction despite the repetition. I know that an attendee may have multiple registrations so multiple transactions so I want an attendee ID to add for each Transaction.
Thanks.


Tony

  • Support Staff

June 28, 2021 at 7:02 am

Ok, but again, a single transaction can have multiple registrations assigned to it which may or may not be assigned to multiple attendees.

So it’s not just a case of a repeating attendee ID on multiple transactions, but multiple attendees on single transactions.

We don’t have an example of doing this but there are filters available within Event Espresso to allow you to change the output, meaning you can add additional columns to the transaction list table.

I have an example of how to add a column on the Registrations list table here:

https://gist.github.com/Pebblo/88f2a0a9213c716e4886a249e7709245

That’ll give you a starting point but you’ll need different filters for that page, the filter uses the current page so any filter with espresso_registrations would likely need to be changed to espresso_transactions, for example:

FHEE_manage_event-espresso_page_espresso_transactions_columns

You can then use the model system to pull all of the details you need for this:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System


Mark

June 29, 2021 at 3:30 am

How to get an Attendee ID for each transaction?


Tony

  • Support Staff

June 29, 2021 at 6:22 am

The Attendee ID (ATT_ID) is not assigned to a transaction, the ATT_ID(s) is assigned to each individual registration linked to the transaction.

So you need to pull all of the registrations assigned to the transaction and get the ATT_ID from that/those. There is a few different ways to do that, for example:

$registrations = $transaction->registrations();

Returns an array of registrations assigned to the transaction, loop over those to pull the ATT_ID from each.

Or you could pull just the value directly from the database, which is a little more performant than the above if all you need is the ATT_IDs and you can use the model system I linked above to do so. If you haven’t read over those docs I recommend you do as they make pulling in various data for Event Espresso fairly straight forward.


Mark

July 1, 2021 at 5:31 am

Hi Tony,
Today I saw the esp_registration table and I noted that there is TXN_ID for each attendee_ID.
So could you please tell me the function that gets ATT_ID for each transaction ID?
Thanks.


Tony

  • Support Staff

July 2, 2021 at 3:52 am

Is this still in relation to the above custom column or something else?

Today I saw the esp_registration table and I noted that there is TXN_ID for each attendee_ID.

In short, no, there is not.

First, let’s clarify what you are asking for as there seems to be some confusion here.

esp_registration does not have attendee_ID

I’m guessing you are referring to ATT_ID?

Or are you referring to REG_ID as the ‘attendee_ID’?

So could you please tell me the function that gets ATT_ID for each transaction ID?

In relation to what? The transaction? If this is related to the above you have this backwards, transactions do not relate to the ATT_ID.


Mark

July 7, 2021 at 9:52 am

ATT_ID is the Attendee transaction ID?


Tony

  • Support Staff

July 7, 2021 at 11:00 am

ATT_ID is the ID of the EE_Contact (EE_Attendee) assigned to the registrations on that transaction.

There seems to be some confusion here, I’m not sure what an ‘Attende transaction ID’ is?

What exactly are you referring to as attendee_ID? EE does not have that field, only ATT_ID so may I ask where you’ve seen attendee_ID?


Mark

July 9, 2021 at 5:02 am

No, I see ATT_ID and assuming it the attendee ID.


Tony

  • Support Staff

July 9, 2021 at 5:59 am

Ok, so where do you see that currently?

As mentioned, the ATT_ID is not directly related to the transaction, it’s related to the registrations linked to that transaction.

If you have the transaction object you pull the registrations for it, loop over them and output the ATT_ID for each:

$registrations = $transaction->registrations();
foreach( $registrations as $reg ) {
    // Do something to save/output the ATT_ID for each registration.
    echo $reg->attendee_ID();
}

Gives you the ATT_ID for each registration linked to that transaction.

You can pull just the ATT_ID and group them in a single query using the models if you already have the Transaction (or the transaction ID).


$ATT_IDs = EEM_Registration::instance()->get_col( 
    array( 
        array(
            'TXN_ID' => $transaction->ID()
        ),
        'group_by' => 'ATT_ID'
    ), 
    'ATT_ID'
);


Mark

July 10, 2021 at 3:24 am

Hi Tony,
I need ATT_ID for a transaction. Give me a way to do it.
https://www.screenpresso.com/=t43P
Thanks.


Tony

  • Support Staff

July 12, 2021 at 9:43 am

OK, so that’s different from your original location.

We don’t currently have a hook that can be used to display the ATT_ID in that location.


Mark

July 16, 2021 at 1:34 am

But I think I can use the transaction ID displaying on that page to get the Attendee ID. Am I right?
And if the above case is possible then how I can edit that page?
Thanks.


Tony

  • Support Staff

July 16, 2021 at 7:51 am

But I think I can use the transaction ID displaying on that page to get the Attendee ID. Am I right?

Sure, that’s how my examples above do it, use the TXN_ID to pull the registrations and then display the ATT_ID(s).

And if the above case is possible then how I can edit that page?

Right now you can’t without modifying core, well technically you can use a filter we have available when override the template that used in that location. Whilst I don’t mind giving you the filter:

FHEE__EEH_Template__display_template__template_path

And even an example of using it: https://gist.github.com/Pebblo/4703f274437ac01b00ef093caa8646f5

If you can’t work out how to do it from there I’m not going to walk through how to use it as the filter is intended for developers comfortable with PHP, WP and EE.

I can’ request we include an additional hook on the default template to include additional details in a future version though.

The support post ‘Attendee ID for each Transaction’ 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