Support

Home Forums Event Espresso Premium Modify Transaction Description – iDeal

Modify Transaction Description – iDeal

Posted: February 22, 2022 at 2:33 am

Viewing 9 reply threads


CapellaAmersfoort

February 22, 2022 at 2:33 am

Is there a way to update the item description on the iDeal transaction? I would like to include the name of the event and the transaction id; Tickets voor {Event Name} - transactie {transaction_id}

I saw an example on the forum:add_filter( 'FHEE__EE_Gateway___order_description',
'my_custom_order_description', 10, 3
);
function my_custom_order_description( $desc, $gateway, $payment ) {
$desc = 'Tickets';
$transaction = $payment->transaction();
if( $transaction instanceof EEI_Transaction ) {
$primary_registrant = $transaction->primary_registration();
if( $primary_registrant instanceof EE_Registration ) {
$event = $primary_registrant->event_obj();
if ( $event instanceof EEI_Event ) {
$desc = $event->name();
}
}
}
return $desc;
}

Will this override the default description? So, in my case I only want to add the event in my description.


Tony

  • Support Staff

February 22, 2022 at 7:00 am

Hi there,

Yes, this is possible, however, you need to be aware that iDeal sets a limit on the length of the description field.

It can be a max of 255 chars, they wont reject a payment if its longer but they will truncate the description for you.

I can help with an example of how to do it, however, before doing so I’m not sure I understand what this means:

Will this override the default description? So, in my case I only want to add the event in my description.

Can you explain a little more, please?


CapellaAmersfoort

February 23, 2022 at 2:14 am

The default transaction desciption has only one tag available; {transaction_id}
I prefer the following description ‘Tickets voor {Event Name} – transactie {transaction_id}. So I need a additional tag; {Event Name}

So the question is how to get this tag. Is it necessary create code and add it to the custom functions plugin? Is this code complete overriding the complete transaction description? Hope the expaination is clear to you πŸ™‚


Tony

  • Support Staff

February 23, 2022 at 6:42 am

The default payment method order description within Event Espresso is:

Event Registrations from {site_name} for {event_name}

That’s used by all payment methods in EE unless it’s overridden by the payment method itself (which Mollie does not do).

We have a filter in place that allows you to change that default description via code (which is what the above does) and you can do the above using something like this:

https://gist.github.com/Pebblo/65d6abf7eb9f02c90bbf6c2ed83783b9

You can add that to a custom functions plugin on your site, we have some documentation on creating one here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


CapellaAmersfoort

February 23, 2022 at 6:50 am

Thanks! So, I can use the filter to change the default description, or without this filter the tages {site_name}, {transaction-id} and {event_name}? Is that correct?


Tony

  • Support Staff

February 23, 2022 at 6:55 am

Apologies, but there are no tags, I’m not sure what you are referring to by tags here. The snippet changes the description for you when you add it to the site.

Without my snippet the description will be something like:

Event Registrations from Tony’s site for Tony’s event

With my snippet the description will be something like:

Tickets voor Tony’s event – transactie 111

Like this: https://monosnap.com/file/4RkgF7HrSwb0LKLcmIiJpLXBZ97C2z

Is that what you are looking for?


CapellaAmersfoort

February 23, 2022 at 7:15 am

Sorry form the mis understanding. I used the word tag instead of snippet. Are there ‘standard’ snippets, like {transaction-id} and {event_name}, I can use in the description?
If not, I will use the snippet you add; https://gist.github.com/Pebblo/65d6abf7eb9f02c90bbf6c2ed83783b9


Tony

  • Support Staff

February 23, 2022 at 7:24 am

No, that’s not how it works here, use the snippet πŸ™‚

To explain, in my snippet I’m creating a $first_event_name variable and pulling in the event name from the $payment object that was passed to the filter. I do that one LINE 8.

I then do something similar for the $transaction variable, I’m pulling in the EE_Transaction object into a variable. I do that one LINE 9.

Then one LINE 14 I’m using those variables directly within a string to created the new description.

There are no standard/global tags/snippets to do this (its actually considered bag practice to do that) and you need to build your own variables/objects within the snippet to output whatever you want to do.


CapellaAmersfoort

February 23, 2022 at 7:42 am

Thanks for your explaination and help, of course!


Tony

  • Support Staff

February 23, 2022 at 7:51 am

You’re most welcome πŸ™‚

Viewing 9 reply threads

The support post ‘Modify Transaction Description – iDeal’ 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