Support

Home Forums Event Espresso Premium Field Labels in SagePay Payment Form

Field Labels in SagePay Payment Form

Posted: September 2, 2015 at 8:45 am

Viewing 1 reply thread


James Miller

September 2, 2015 at 8:45 am

Hi

I need to change the field labels to UK English, such as State to County, and Zip to Postcode. Can you tell me where/how I can do this without customising the plugin if possible. Also, I need to modify a couple of the fields to be mandatory.

Many thanks

James


Tony

  • Support Staff

September 3, 2015 at 6:27 am

Hi James,

Currently to change which fields would be required would require core modifications. We have an open feature request to allow users to change the required fields within gateways, I’ll add your vote to that ticket.

Changing State to County and Zip to Postcode can be done by translating those field. The easiest way is using the custom function shown here:

https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function

Yours would look something like:

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'State' => 'County',
        'Zip' => 'Postcode',
        // Add some more strings here
    );
 
    // See if the current string is in the $strings array
    // If so, replace its translation
    if ( isset( $strings[$original] ) ) {
        // This accomplishes the same thing as __()
        // but without running it through the filter again
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
 
    return $translated;
}
 
add_filter( 'gettext', 'mycustom_filter_gettext', 10, 3 );

You can add that to either your themes functions.php file or a Site Specific Plugin.

Viewing 1 reply thread

The support post ‘Field Labels in SagePay Payment Form’ 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