Support

Home Forums Event Espresso Premium Customize thank_you page with payment set to invoice

Customize thank_you page with payment set to invoice

Posted: December 1, 2015 at 10:06 am

Viewing 9 reply threads


simone

December 1, 2015 at 10:06 am

Hello,

I’m here again for a new question!

I would like to add some things (text and additonal pdf file to download) in the thank_you page only in case the payment choosed is “invoice”.

According with your documentation (https://eventespresso.com/wiki/ee4-thank-page-actions-filters-hooks/), I was able to find the right hook: AHEE__thank_you_page_registration_details_template__after_registration_table_row

but I am not able to right use the argument $registration to check if the payment method is “invoice”. That argument is protected and I can access its content.
How can I do?

Very thanks,
Simone


Tony

  • Support Staff

December 1, 2015 at 11:20 am

Hi there,

Rather than hooking in and checking the selected payment method etc, I’d let EE do all of the hard work for you and customize the template it loads when you select the payment method.

This section – http://take.ms/KBo3L

Its dynamic for every payment method so will only load a specific template if Invoice is selected.

You can go to:


event-espresso-core-reg/core/payment_methods/Invoice/templates/invoice_payment_details_content.template.php

Copy that file to:


wp-content/uploads/espresso/templates/payment_methods/Invoice/templates/invoice_payment_details_content.template.php

Then add any custom links to that section you prefer. EE will only load that template for users who have selected the Invoice payment method – http://take.ms/aNNuN

I’ve just added a H1 in that example, you can add much more if you prefer.


simone

December 2, 2015 at 2:34 am

Hi Tony,

the solution you suggested me seems very easy to implement, thank you.
I have done a similar thing with the ticket selector template:

add_filter ('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', 'ee_custom_ticket_selector_template_location');
function ee_custom_ticket_selector_template_location(){
  global $eas_tickets;
  [....]
  return get_template_directory() . '/EE4_templates/ticket_selector_chart.template.php';
}

Is there a way to have this template in the same theme directory as other custom templates?

Thank you,
Simone


simone

December 2, 2015 at 3:51 am

Hi Tony,

I think I need an higher positioning to have my customizatation, more or less where the hook I have mentioned in the first post is placed.

Do I have another option?

Thank you very much
Simone


Tony

  • Support Staff

December 2, 2015 at 8:36 am

You can use the hook you mentioned previously as it passes the $registration.

From there you can pull the transaction using $registration->transaction()

Then from there you can pull the last payment method from the transaction using $transaction->payment_method();

Then use $payment_method->name() method and check if that returns Invoice, if so output your link.

You’ll want to check along the way that you have an instanceof the EE_Registration, EE_Transaction and EE_Payment_Method.


simone

December 9, 2015 at 9:34 am

Dear Tony,

thanks for your fantastic help.
May I ask an another related question?

In the step 2 – payment options page I need to access all the info the user fills in the previous page form (attende information).
I founded some hook, but they can’t give me these info. Can you show me the right hook?

Thank you again to all for your support,
Simone


Josh

  • Support Staff

December 14, 2015 at 2:50 pm

Hi Simone,

There’s a core EE filter hook that’s named:

FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value

That should give you access to the info you’re looking for.


simone

December 15, 2015 at 9:59 am

Dear Tony,

I’m not competent with hook and filter. I have place this lines in my_theme/functions.php

add_filter( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', 'send_event_registration_to_vtiger' );    
function send_event_registration_to_vtiger($func_argument){
   var_dump($func_argument);
}

but $func_argument seems empty.

Is it the right way to use this hook?

Thanks,
Simone


Josh

  • Support Staff

December 16, 2015 at 3:05 pm

Hi Simone,

It turns out that that is not the right way to use the hook. You can get a better idea of how to use the hook by looking at the core method that has that hook, and you’ll likely be able to re-use some of the code from that method.


simone

December 17, 2015 at 10:34 am

Thank you,

I have founded a way to do it.

Simone

Viewing 9 reply threads

The support post ‘Customize thank_you page with payment set to invoice’ 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