Merge pull request #22466 from woocommerce/fix/22036

Fixed padding of addresses in email template
This commit is contained in:
Mike Jolley 2019-01-17 13:34:30 +00:00 committed by GitHub
commit d7476c7217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 20 deletions

View File

@ -12,7 +12,7 @@
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates/Emails
* @version 3.2.1
* @version 3.5.4
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -20,27 +20,29 @@ if ( ! defined( 'ABSPATH' ) ) {
}
$text_align = is_rtl() ? 'right' : 'left';
$address = $order->get_formatted_billing_address();
$shipping = $order->get_formatted_shipping_address();
?><table id="addresses" cellspacing="0" cellpadding="0" style="width: 100%; vertical-align: top; margin-bottom: 40px; padding:0;" border="0">
<tr>
<td style="text-align:<?php echo $text_align; ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; border:0; padding:0;" valign="top" width="50%">
<h2><?php _e( 'Billing address', 'woocommerce' ); ?></h2>
<td style="text-align:<?php echo esc_attr( $text_align ); ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; border:0; padding:0;" valign="top" width="50%">
<h2><?php esc_html_e( 'Billing address', 'woocommerce' ); ?></h2>
<address class="address">
<?php echo ( $address = $order->get_formatted_billing_address() ) ? $address : __( 'N/A', 'woocommerce' ); ?>
<?php echo wp_kses_post( $address ? $address : esc_html__( 'N/A', 'woocommerce' ) ); ?>
<?php if ( $order->get_billing_phone() ) : ?>
<br/><?php echo esc_html( $order->get_billing_phone() ); ?>
<?php endif; ?>
<?php if ( $order->get_billing_email() ) : ?>
<p><?php echo esc_html( $order->get_billing_email() ); ?></p>
<br/><?php echo esc_html( $order->get_billing_email() ); ?>
<?php endif; ?>
</address>
</td>
<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() && ( $shipping = $order->get_formatted_shipping_address() ) ) : ?>
<td style="text-align:<?php echo $text_align; ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; padding:0;" valign="top" width="50%">
<h2><?php _e( 'Shipping address', 'woocommerce' ); ?></h2>
<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() && $shipping ) : ?>
<td style="text-align:<?php echo esc_attr( $text_align ); ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; padding:0;" valign="top" width="50%">
<h2><?php esc_html_e( 'Shipping address', 'woocommerce' ); ?></h2>
<address class="address"><?php echo $shipping; ?></address>
<address class="address"><?php echo wp_kses_post( $shipping ); ?></address>
</td>
<?php endif; ?>
</tr>

View File

@ -27,9 +27,10 @@ $base_text = wc_light_or_dark( $base, '#202020', '#ffffff' );
$text = get_option( 'woocommerce_email_text_color' );
// Pick a contrasting color for links.
$link = wc_hex_is_light( $base ) ? $base : $base_text;
$link_color = wc_hex_is_light( $base ) ? $base : $base_text;
if ( wc_hex_is_light( $body ) ) {
$link = wc_hex_is_light( $base ) ? $base_text : $base;
$link_color = wc_hex_is_light( $base ) ? $base_text : $base;
}
$bg_darker_10 = wc_hex_darker( $bg, 10 );
@ -137,7 +138,7 @@ $text_lighter_20 = wc_hex_lighter( $text, 20 );
}
.address {
padding: 12px 12px 0;
padding: 12px;
color: <?php echo esc_attr( $text_lighter_20 ); ?>;
border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>;
}
@ -190,7 +191,7 @@ h3 {
}
a {
color: <?php echo esc_attr( $link ); ?>;
color: <?php echo esc_attr( $link_color ); ?>;
font-weight: normal;
text-decoration: underline;
}