Support

Home Forums Event Espresso Premium Display the Promotion Code in Registration Pending Payment Template

Display the Promotion Code in Registration Pending Payment Template

Posted: February 9, 2016 at 9:32 am

Viewing 5 reply threads


Juan

February 9, 2016 at 9:32 am

Hi, I am using the Promotions add-on and I would like to show in the Registration Pending Payment email the promotion code used in the registration process.

Is there any way to achieve that?
Thanks


Josh

  • Support Staff

February 9, 2016 at 2:38 pm

Hi Juan,

At this time there isn’t a Messages shortcode that prints the promotion code that was used at checkout. I can put in a feature request for this. If this is something you need added sooner than later, I can suggest contacting one of the recommended developers for a quote:

https://eventespresso.com/developers/event-espresso-pros/


Juan

February 10, 2016 at 3:10 am

Hi Josh,

Thank you for adding that feature request, I think it is a nice shortcode to have.

I am a developer myself and had modified some of the EE core functionalities, but there isn’t enough documentation so I need to ask. Probably you can help me guiding me on the right direction.
I am trying to access the “promotion code” variable/method in the core file EE_Transaction_Shortcodes.lib.php but I can’t find it, I thought it should be in the variable $payment which is an instance of EE_Payment, but it doesn’t seem to be there. Do you know how can I access it?

Thank you


Tony

  • Support Staff

February 10, 2016 at 3:51 am

Hi Juan,

Please do not edit core files, we can not provide support if you edit the core files and generally have a filter available to edit/add the functionality in most places within Event Espresso (as we do for adding custom messages shortcodes). If a filter is not available we are more than happy to request one is added to allow you to modify what you need.

So with the Messages system we have a filter hook available that can be used to add your own custom shortcodes, that filer is ‘FHEE__EE_Shortcodes__parser_after’

Take a look here for an example of how to use is:

https://gist.github.com/Pebblo/e87cc8e30c4848dcdfe2

You’ll want to add the shortcode to the EE_Transaction_Shortcodes.

When parsing the shortcode you’ll have the EE_Transaction object passed in as $data.

The promo codes are stored as line items assigned to the transaction, I do not believe there is a ‘promotion code’ property you can access from EE_Payment, but if you take a look at the add_promotions_column_to_reg_csv_report() method within EED_Promotions class you can see how the promotion code is pulled in from database and added to the CSV, you do do almost the same within the shortcode and output a list of Promo codes that apply to the transaction.


Juan

February 10, 2016 at 3:56 am

Hi Tony,

Thank you for the warning, it didn’t cross my mind to edit that core file! I was just reading the code 🙂

Thank you as well for the explanation, it seems much clearer for me now, I will try your suggestion.


Tony

  • Support Staff

February 10, 2016 at 4:33 am

I realised, the $data object passed to the parser is not the EE_Transaction object.

It will be an EE_Messages_Addressee object, from that you can get the transaction using something like:

$transaction = $data->txn;

Viewing 5 reply threads

The support post ‘Display the Promotion Code in Registration Pending Payment Template’ 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