Fix colors and font sizes, add default logo, remove CTA button [MAILPOET-2520]

This commit is contained in:
wxa
2019-11-13 14:31:25 +03:00
committed by Jack Kitterhing
parent 0c4dd20ce6
commit 393b377437
10 changed files with 41 additions and 27 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -65,6 +65,16 @@ class NewsletterEditor {
$subscriber = Subscriber::getCurrentWPUser();
$subscriber_data = $subscriber ? $subscriber->asArray() : [];
$woocommerce_data = [];
if ($this->woocommerce_helper->isWooCommerceActive()) {
$email_base_color = $this->wp->getOption('woocommerce_email_base_color', '#ffffff');
$woocommerce_data = [
'email_headings' => $this->wc_transactional_emails->getEmailHeadings(),
'email_base_color' => $email_base_color,
'email_base_text_color' => $this->woocommerce_helper->wcLightOrDark($email_base_color, '#202020', '#ffffff'),
'email_text_color' => $this->wp->getOption('woocommerce_email_text_color', '#000000'),
];
}
$data = [
'shortcodes' => ShortcodesHelper::getShortcodes(),
'settings' => $this->settings->getAll(),
@@ -72,11 +82,7 @@ class NewsletterEditor {
'current_wp_user' => array_merge($subscriber_data, $this->wp->wpGetCurrentUser()->to_array()),
'sub_menu' => Menu::MAIN_PAGE_SLUG,
'mss_active' => Bridge::isMPSendingServiceEnabled(),
'woocommerce' => [
'email_headings' => $this->wc_transactional_emails->getEmailHeadings(),
'email_base_color' => $this->wp->getOption('woocommerce_email_base_color', '#000000'),
'email_text_color' => $this->wp->getOption('woocommerce_email_text_color', '#000000'),
],
'woocommerce' => $woocommerce_data,
'site_name' => $this->wp->wpSpecialcharsDecode($this->wp->getOption('blogname'), ENT_QUOTES),
'site_address' => $this->wp->wpParseUrl($this->wp->homeUrl(), PHP_URL_HOST),
];

View File

@@ -36,6 +36,10 @@ class Helper {
return get_woocommerce_currency();
}
function wcLightOrDark($color, $dark, $light) {
return wc_light_or_dark($color, $dark, $light);
}
function getOrdersCountCreatedBefore($date_time) {
global $wpdb;
$result = $wpdb->get_var( "

View File

@@ -2,6 +2,7 @@
namespace MailPoet\WooCommerce;
use MailPoet\Config\Env;
use MailPoet\Entities\NewsletterEntity;
use MailPoet\Models\Newsletter;
use MailPoet\Newsletter\NewslettersRepository;
@@ -126,18 +127,18 @@ class TransactionalEmails {
private function getWCEmailSettings() {
$wc_email_settings = [
'woocommerce_email_background_color' => '#ffffff',
'woocommerce_email_background_color' => '#f7f7f7',
'woocommerce_email_base_color' => '#333333',
'woocommerce_email_body_background_color' => '#eeeeee',
'woocommerce_email_body_background_color' => '#ffffff',
'woocommerce_email_footer_text' => $this->wp->_x('Footer text', 'Default footer text for a WooCommerce transactional email', 'mailpoet'),
'woocommerce_email_header_image' => '',
'woocommerce_email_header_image' => Env::$assets_url . '/img/newsletter_editor/wc-default-logo.png',
'woocommerce_email_text_color' => '#111111',
];
$result = [];
foreach ($wc_email_settings as $name => $default) {
$value = $this->wp->getOption($name, $default);
$value = $this->wp->getOption($name);
$key = preg_replace('/^woocommerce_email_/', '', $name);
$result[$key] = $value;
$result[$key] = $value ?: $default;
}
$result['footer_text'] = $this->replacePlaceholders($result['footer_text']);
return $result;

View File

@@ -41,7 +41,7 @@ class Template {
[
'block' =>
[
'backgroundColor' => '#eeeeee',
'backgroundColor' => 'transparent',
],
],
'blocks' =>
@@ -82,10 +82,10 @@ class Template {
'type' => 'image',
'link' => '',
'src' => $wc_email_settings['header_image'],
'alt' => 'mailpoet-logo',
'alt' => '',
'fullWidth' => false,
'width' => '160px',
'height' => '490px',
'width' => '180px',
'height' => '362px',
'styles' =>
[
'block' =>
@@ -186,7 +186,7 @@ class Template {
[
'block' =>
[
'backgroundColor' => '#ffffff',
'backgroundColor' => 'transparent',
],
],
'blocks' =>
@@ -240,7 +240,7 @@ class Template {
[
'block' =>
[
'backgroundColor' => '#eeeeee',
'backgroundColor' => 'transparent',
],
],
'blocks' =>
@@ -293,7 +293,7 @@ class Template {
[
'fontColor' => $wc_email_settings['text_color'],
'fontFamily' => 'Arial',
'fontSize' => '16px',
'fontSize' => '14px',
'lineHeight' => '1.6',
],
'h1' =>
@@ -324,11 +324,11 @@ class Template {
],
'wrapper' =>
[
'backgroundColor' => $wc_email_settings['background_color'],
'backgroundColor' => $wc_email_settings['body_background_color'],
],
'body' =>
[
'backgroundColor' => $wc_email_settings['body_background_color'],
'backgroundColor' => $wc_email_settings['background_color'],
],
],
'blockDefaults' =>

View File

@@ -43,6 +43,10 @@ function get_woocommerce_currency() {
return '';
}
function wc_light_or_dark(string $color, string $dark, string $light) {
return '';
}
function wc_get_product($the_product = false, $deprecated = []) {
return null;
}

View File

@@ -1461,7 +1461,7 @@
woocommerceHeading: {
contents: <%= json_encode(woocommerce.email_headings) %>,
styles: {
fontColor: '<%= woocommerce.email_text_color %>',
fontColor: '<%= woocommerce.email_base_text_color %>',
backgroundColor: '<%= woocommerce.email_base_color %>',
},
},

View File

@@ -6,9 +6,9 @@
color: {{ styles.titleColor }};
}
</style>
<div class="mailpoet_content mailpoet_woocommerce_content" data-automation-id="woocommerce_content">
<p style="margin:0 0 16px"><%= __('Hi %s,', 'woocommerce') | format('Elon') %></p>
<p style="margin:0 0 16px"><%= __("Just to let you know &mdash; we've received your order #%s, and it is now being processed:", 'woocommerce') | format('0001') | raw %></p>
<div class="mailpoet_content mailpoet_woocommerce_content" data-automation-id="woocommerce_content" style="font-family:'Helvetica Neue',Helvetica,Roboto,Arial,sans-serif;font-size:14px;line-height:150%;text-align:left;">
<p style="margin:0 0 16px;font-size:14px;"><%= __('Hi %s,', 'woocommerce') | format('Elon') %></p>
<p style="margin:0 0 16px;font-size:14px;"><%= __("Just to let you know &mdash; we've received your order #%s, and it is now being processed:", 'woocommerce') | format('0001') | raw %></p>
<h2
style="display:block;font-family:'Helvetica Neue',Helvetica,Roboto,Arial,sans-serif;font-size:18px;font-weight:bold;line-height:130%;margin:0 0 18px;text-align:left">
@@ -111,6 +111,6 @@
</tr>
</tbody>
</table>
<p style="margin:0 0 16px"><%= __('Thanks for shopping with us.', 'woocommerce') %></p>
<p style="margin:0 0 16px;font-size:14px;"><%= __('Thanks for shopping with us.', 'woocommerce') %></p>
</div>
<div class="mailpoet_block_highlight"></div>

View File

@@ -9,6 +9,7 @@
font-family: 'Source Sans Pro';
font-size: 36px;
color: {{ styles.fontColor }};
margin: 0;
}
</style>
<div class="mailpoet_content mailpoet_woocommerce_heading" data-automation-id="woocommerce_heading">

View File

@@ -12,8 +12,6 @@
<span class="mailpoet_autosaved_at mailpoet_hidden"></span>
</div>
</div>
<div class="clearfix"></div>
<a href="admin.php?page=wc-settings&tab=email" class="button button-primary mailpoet_save_button" style="margin-top: 7px"><%= __('Edit WooCommerce Email settings') %></a>
{{else}}
<input type="button" name="next" value="<%= __('Next') %>" class="button button-primary mailpoet_save_next" />
<div class="mailpoet_button_group mailpoet_save_button_group">