Support

Home Forums Event Espresso Premium Payment date on top of Receipt instead of Registration Date

Payment date on top of Receipt instead of Registration Date

Posted: October 30, 2018 at 4:06 am


EbeciaConnect

October 30, 2018 at 4:06 am

How can I change the date on the top-right corner of the receipt to the actual Payment Date?
Right now, it’s showing registration date. But the date that a person register is not the same date as when the person made payment. The Receipt date needs to be the same as the payment date.

I can add a new shortcode for [Payment_date] (as outlined in this post:https://eventespresso.com/topic/payment-timestamp-to-only-show-date/#post-280800)

But that only make the shortcode available to the Payments section, not to the main body of the template.


Tony

  • Support Staff

October 30, 2018 at 9:30 am

The date in which a payment is made, is stored within the payment itself, so to output that date, you need to the payment object.

I can add a new shortcode for [Payment_date]

That code adds the shortcode the EE_Payment_Shortcodes, which is intended to loop over all of the payments within a transaction and passes the payment object to each loop which then outputs the details for each shortcode for each specific payment object.

You can’t use that across the whole template because the data passed to each section is different but what you can do, is add a LAST_PAYMENT_PAYMENT_TIMESTAMP shortcode to the EE_Transaction_Shortcodes library. Transaction shortcodes are available in most of the template and you can usually find the transaction object from anywhere, then pull the last payment from that.

So that shortcode would pull the last payment made on a transaction and then output the timestamp for that, would that work?

Here is an example based on the code Josh provided in your other thread:

https://gist.github.com/Pebblo/41e82e9665e041f9fba092ab57de4891

That functions adds a [LAST_PAYMENT_PAYMENT_TIMESTAMP_*] shortcode, used as is it will output timestamp in full, e.g: October 8, 2018 2:31 pm

But you can also set a format attribute:

[LAST_PAYMENT_PAYMENT_TIMESTAMP_* format=d/m/Y]

Which outputs the above as 08/10/2018

Make sure you use a valid date/time format for PHP or you’ll run into issues.


EbeciaConnect

October 30, 2018 at 7:28 pm

Thanks! That worked indeed.


Tony

  • Support Staff

October 31, 2018 at 9:10 am

You’re most welcome, I’m glad that helped.

The support post ‘Payment date on top of Receipt instead of Registration Date’ 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