Support

Home Forums Event Espresso Premium How to Make Changes to Payment Templates

How to Make Changes to Payment Templates

Posted: May 22, 2014 at 8:57 am


bdearth

May 22, 2014 at 8:57 am

Hi,

We’d like to change the wording and visuals in a few areas, when registrants buy tickets. Can you please help with :

1) I’ve located the one file that we need to change, it is: registration_page_payment_options.template.php – After clicking the PayPal logo, a hyperlink appears that reads, “select a different method of payment:.” With there being no other methods of payment, we would like this to simply read, “[We] accept payment by credit card or a PayPal account via PayPal.com.” **As well, this way, any users that don’t understand that PayPal isn’t needed to set up an account, they will feel more comfortable to continue clicking through using the PayPal option. However, as this is the only payment option, this statement needs to be changed.

Now, with having located the correct file to change [registration_page_payment_options.template.php], where does this file need to appear in [which] directory, in order for us to keep the template changes, and to avoid the file being overwritten with new updates.

I’ve been told once that any edited files need to be placed in the /uploads/ directory, so that they will not be overwritten. However, I have tried both methods, of both dropping the file in the main /uploads/espresso/ directory, as well as recreating the original directory path [/uploads/espresso/modules/single_page_checkout/templates/], and the changes do not take effect on the live site.

Where are we supposed to upload the files that are changes, so that they are not overwritten? Please provide us with a directory path example.

Although, in the step before, it is slightly confusing, as once the PayPal button appears, the “Finalize Registration” button appears as well. This will confuse users, who may try to click the “Finalize Registration” button first, potentially not wanting to use PayPal. **Which .php file can we add our new disclaimer (beneath the PayPal logo), so that users are more aware just to click the PayPal logo, and then we will have the hyperlink statement removed.

Thank you,

-B.


Lorenzo Orlando Caum

  • Support Staff

May 22, 2014 at 9:10 am

Hello,

This template can’t currently be relocated to the wp-content/uploads/espresso folder.

With that mentioned, this will be available in an upcoming version of Event Espresso 4.


Lorenzo


bdearth

May 22, 2014 at 10:06 am

Hi Lorenzo,

Thank you for your fast reply. Does this mean that we are safe to edit the file that appears in the plugins directory, without worry of the file being overwritten?

Thanks,

-B.


Lorenzo Orlando Caum

  • Support Staff

May 22, 2014 at 10:17 am

Hi,

Any edits to the core plugin will be lost on a software update. This is why we have updated those templates in an upcoming version of EE4 to work with the wp-content/uploads/espresso folder.


Lorenzo


bdearth

May 23, 2014 at 6:17 am

Hi,

Does that mean that this template file cannot be changed, and if it is, it will be overwritten? Please advise.

-B.


Lorenzo Orlando Caum

  • Support Staff

May 23, 2014 at 6:43 am

Any edits to that template will be lost on a software update.


Lorenzo


bdearth

May 23, 2014 at 7:18 am

CSS could take care of hiding one line, by “display: none;” however, how do we display our own custom message for users, without the hassle of having to use functions, like PHP or JS? And will this be editable in future versions of EE?

Thank you,

-B.


bdearth

May 23, 2014 at 7:21 am

As well, with having learned about keeping our own files in the uploads directory, so that they will not be overwritten — are we no longer able to customize in this fashion?

Thanks,

-B.


Josh

  • Support Staff

May 23, 2014 at 5:27 pm

Hi Betty,

The uploads/espresso directory was something that was used in Event Espresso 3, and in Event Espresso 4 some files (like the invoice templates) can load from there.

That said, for your use case I’d recommend using the available hooks to change and add text. Overriding the entire template can cause a lot of maintenance headaches down the road. When you think about it, you’re proposing to copy over an entire file to another location with the end result to change a bit of text. This will lead to some trouble down the road. For example, when we add a new feature (like maybe promo codes) and it requires some changes to the same template that you’ve copied over to an alternate location, when you update to that new version the new feature will not work until you go back and reapply your changes to our new template.

So while it may seem like a hassle to use a function to change some text compared with editing a file directly, it can actually be a big time saver to use a filter function because it lets you, as they say, “set it and forget it”.

Here’s how you do that for the question you cited earlier:

If you look in the template, you’ll see there’s a filter:

<?php echo apply_filters( 'FHEE__registration_page_payment_options__select_other_gateway_lnk', __( 'select a different method of payment:', 'event_espresso' )); ?>

The filter allows you to change that text with a little function that can load from just about anywhere, like from your own little plugin or your theme’s functions.php file:

add_filter ('FHEE__registration_page_payment_options__select_other_gateway_lnk', 'my_custom_payment_message');

function my_custom_payment_message() {
    return '[We] accept payment by credit card or a PayPal account via PayPal.com.';
}

Alternatively, you might find it to work better to display your custom payment message above the PayPal button and not display the link to select a different payment method. Which can be done like this:

add_filter ('FHEE__registration_page_payment_options__select_method_of_payment_hdr', 'my_custom_payment_message');

function my_custom_payment_message() {
    return '[We] accept payment by credit card or a PayPal account via PayPal.com.';
}

add_filter ('FHEE__registration_page_payment_options__select_other_gateway_lnk', 'we_dont_accept_other_payment_methods');

function we_dont_accept_other_payment_methods() {
    return;
}


bdearth

May 26, 2014 at 7:03 am

Hi Josh,

Thank you for the suggestion, however we wanted to avoid using functions, to lessen the amount of developer work in the future.

-B.


bdearth

May 26, 2014 at 7:19 am

Josh, thank you for the hook information, however with having added this to the functions.php file, the results are still the same, with the “select a different method of payment:” hyperlink.

With having included this option, does Event Espresso offer alternate forms of payment? If not, why does this statement exist?

-B.


Sidney Harrell

May 26, 2014 at 3:10 pm

Try changing it to:

add_filter ('FHEE__registration_page_payment_options__select_other_gateway_lnk', 'my_custom_payment_message');
 
function my_custom_payment_message() {
    die("Made it to my custom function");
    return '[We] accept payment by credit card or a PayPal account via PayPal.com.';
}

To see if the function you added to the hook is getting executed.


bdearth

May 26, 2014 at 3:24 pm

Hi Sidney,

Thank you for the suggestion. To clarify, do I add this script in the functions.php file, that is included within the theme we’re using? As well, is it just this portion that needs to be added, or in conjunction with Josh’s script?

Thanks,

-B.


Lorenzo Orlando Caum

  • Support Staff

May 26, 2014 at 5:40 pm

Hello again,

Those filters are currently available in a future release of Event Espresso. That is why they aren’t working.

Sorry about that. I’m checking for an alternative option now.


Lorenzo


Lorenzo Orlando Caum

  • Support Staff

May 26, 2014 at 5:49 pm

Hi,

I’ve confirmed this solution will work on the current version of Event Espresso 4.2.4:

function ee_payment_options_paypal_optional( $translated, $original, $domain ) {
$strings = array(
 'After finalizing your registration, you will be transferred to the PayPal.com website where your payment will be securely processed.' => 'After finalizing your registration, you will be transferred to the PayPal.com website where your payment will be securely processed. A <strong>PayPal account is not required</strong> and you can pay with a credit or debit card.'
 );
if ( isset( $strings[$original] ) ) {
 $translations = &get_translations_for_domain( $domain );
 $translated = $translations->translate( $strings[$original] );
 }
return $translated;
}

add_filter( 'gettext', 'ee_payment_options_paypal_optional', 10, 3 );

It works by looking for that exact phrase and then replacing it with a new phrase (the text after the arrow =>).

Here is what it will look like:

http://cl.ly/image/2X3k2K0e2a0m

Cheers


Lorenzo


bdearth

May 28, 2014 at 12:55 pm

Thanks, Lorenzo, this works! We appreciate your assistance with this matter.

-B.

The support post ‘How to Make Changes to Payment Templates’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  bdearth 5 years, 6 months ago ago

Topic Tags

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!