Use the new woocommerce tab
[MAILPOET-2708]
This commit is contained in:
committed by
Veljko V
parent
eb8f9ccd2f
commit
f6dc87ae83
@@ -49,9 +49,12 @@ if (jQuery('#mailpoet_settings').length > 0) {
|
||||
if (tab === 'basics') {
|
||||
window.location.href = '?page=mailpoet-new-settings#/basics';
|
||||
}
|
||||
if (tab === 'woocommerce' && !window.mailpoet_woocommerce_active) {
|
||||
window.location.hash = '#basics';
|
||||
return;
|
||||
if (tab === 'woocommerce') {
|
||||
if (!window.mailpoet_woocommerce_active) {
|
||||
window.location.href = '?page=mailpoet-new-settings#/basics';
|
||||
} else {
|
||||
window.location.href = '?page=mailpoet-new-settings#/woocommerce';
|
||||
}
|
||||
}
|
||||
// reset all active tabs
|
||||
jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active');
|
||||
|
@@ -33,13 +33,13 @@ export default () => {
|
||||
{t('sendWithTab')}
|
||||
</a>
|
||||
{hasWooCommerce && (
|
||||
<a
|
||||
className="nav-tab"
|
||||
href="?page=mailpoet-settings#woocommerce"
|
||||
data-automation-id="woocommerce_settings_tab"
|
||||
<TabLink
|
||||
name="woocommerce"
|
||||
current={current}
|
||||
automationId="woocommerce_settings_tab"
|
||||
>
|
||||
{t('wooCommerceTab')}
|
||||
</a>
|
||||
</TabLink>
|
||||
)}
|
||||
<a
|
||||
className="nav-tab"
|
||||
|
@@ -19,7 +19,7 @@
|
||||
<a class="nav-tab" href="#signup" data-automation-id="signup_settings_tab"><%= __('Sign-up Confirmation') %></a>
|
||||
<a class="nav-tab" href="#mta" data-automation-id="send_with_settings_tab"><%= __('Send With...') %></a>
|
||||
<% if is_woocommerce_active %>
|
||||
<a class="nav-tab" href="#woocommerce" data-automation-id="woocommerce_settings_tab"><%= __('WooCommerce') %></a>
|
||||
<a class="nav-tab" href="?page=mailpoet-new-settings#/woocommerce" data-automation-id="woocommerce_settings_tab"><%= __('WooCommerce') %></a>
|
||||
<% endif %>
|
||||
<a class="nav-tab" href="#advanced" data-automation-id="settings-advanced-tab"><%= __('Advanced') %></a>
|
||||
<a class="nav-tab nav-tab-reload" href="#premium" data-automation-id="activation_settings_tab"><%= __('Key Activation') %></a>
|
||||
@@ -35,14 +35,7 @@
|
||||
<% include 'settings/signup.html' %>
|
||||
</div>
|
||||
|
||||
<% if is_woocommerce_active %>
|
||||
<!-- woocommerce -->
|
||||
<div data-tab="woocommerce" class="mailpoet_tab_panel">
|
||||
<% include 'settings/woocommerce.html' %>
|
||||
</div>
|
||||
<% endif %>
|
||||
|
||||
<!-- advanced -->
|
||||
<!-- advanced -->
|
||||
<div data-tab="advanced" class="mailpoet_tab_panel">
|
||||
<% include 'settings/advanced.html' %>
|
||||
</div>
|
||||
@@ -94,18 +87,6 @@
|
||||
$('#settings_recaptcha_tokens_error').hide();
|
||||
}
|
||||
|
||||
<% if is_woocommerce_active %>
|
||||
// if WooCommerce opt-in on checkout is enabled but the checkbox message is empty, show an error
|
||||
var woocommerce_optin_on_checkout_enabled = $('input[name="woocommerce[optin_on_checkout][enabled]"]:checked').val(),
|
||||
woocommerce_optin_on_checkout_message = $('input[name="woocommerce[optin_on_checkout][message]"]').val().trim();
|
||||
if (woocommerce_optin_on_checkout_enabled && woocommerce_optin_on_checkout_message == '') {
|
||||
$('#settings_woocommerce_optin_on_checkout_error').show();
|
||||
window.location.href = '#woocommerce';
|
||||
errorFound = true;
|
||||
} else {
|
||||
$('#settings_woocommerce_optin_on_checkout_error').hide();
|
||||
}
|
||||
<% endif %>
|
||||
// stop processing if an error was found
|
||||
if (errorFound) {
|
||||
return false;
|
||||
|
@@ -1,138 +0,0 @@
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="settings[woocommerce_use_mailpoet_editor]">
|
||||
<%= _x('Use MailPoet to customize WooCommerce emails', "Setting for using our editor for WooCommerce email") %>
|
||||
</label>
|
||||
<p class="description">
|
||||
<%= _x('You can use the MailPoet editor to customize the template used to send WooCommerce emails (notification for order processing, completed, ...).', "Setting for using our editor for WooCommerce email") %>
|
||||
</p>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<input
|
||||
type="checkbox"
|
||||
value="1"
|
||||
id="settings[woocommerce_use_mailpoet_editor]"
|
||||
name="woocommerce[use_mailpoet_editor]"
|
||||
<% if(settings.woocommerce.use_mailpoet_editor) %>checked="checked"<% endif %>
|
||||
>
|
||||
<br>
|
||||
<input type="button" name="wc_editor_button" class="button-secondary mailpoet_woocommerce_editor_button" value="<%= _x('Open template editor', 'Settings button to go to WooCommerce email editor') %>">
|
||||
</p>
|
||||
<input
|
||||
type="hidden"
|
||||
value="<%= settings.woocommerce.transactional_email_id %>"
|
||||
name="woocommerce[transactional_email_id]"
|
||||
>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="settings[woocommerce_optin_on_checkout]">
|
||||
<%= _x('Opt-in on checkout', "settings area: add an email opt-in checkbox on the checkout page (e-commerce websites)") %>
|
||||
</label>
|
||||
<p class="description">
|
||||
<%= __('Customers can subscribe to the "WooCommerce Customers" list via a checkbox on the checkout page.') %>
|
||||
</p>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<input
|
||||
data-toggle="mailpoet_woocommerce_optin_on_checkout"
|
||||
type="checkbox"
|
||||
value="1"
|
||||
id="settings[woocommerce_optin_on_checkout]"
|
||||
name="woocommerce[optin_on_checkout][enabled]"
|
||||
<% if(settings.woocommerce.optin_on_checkout.enabled) %>checked="checked"<% endif %>
|
||||
>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="mailpoet_woocommerce_optin_on_checkout">
|
||||
<th scope="row">
|
||||
<label for="settings[woocommerce_checkbox_optin_message]">
|
||||
<%= _x('Checkbox opt-in message', "settings area: set the email opt-in message on the checkout page (e-commerce websites)") %>
|
||||
</label>
|
||||
<p class="description">
|
||||
<%= __('This is the checkbox message your customers will see on your WooCommerce checkout page to subscribe to the "WooCommerce Customers" list.') %>
|
||||
</p>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<input type="text"
|
||||
id="woocommerce_checkbox_optin_message"
|
||||
name="woocommerce[optin_on_checkout][message]"
|
||||
value="<%= settings.woocommerce.optin_on_checkout.message %>"
|
||||
placeholder="<%= _x('Checkbox opt-in message', "placeholder text for the WooCommerce checkout opt-in message") %>"
|
||||
class="regular-text" />
|
||||
<br>
|
||||
<div id="settings_woocommerce_optin_on_checkout_error" class="mailpoet_error_item mailpoet_error">
|
||||
<%= __('The checkbox opt-in message cannot be empty.') %>
|
||||
</div>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="settings[mailpoet_subscribe_old_woocommerce_customers]">
|
||||
<%= __('Subscribe old WooCommerce customers') %>
|
||||
</label>
|
||||
<p class="description">
|
||||
<%= __('Subscribe all my past customers to this list because they agreed to receive marketing emails from me.') %>
|
||||
</p>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<input
|
||||
type="checkbox"
|
||||
value="1"
|
||||
id="settings[mailpoet_subscribe_old_woocommerce_customers]"
|
||||
name="mailpoet_subscribe_old_woocommerce_customers[enabled]"
|
||||
<% if(settings.mailpoet_subscribe_old_woocommerce_customers.enabled) %>checked="checked"<% endif %>
|
||||
>
|
||||
<#
|
||||
Our settings is stupid:
|
||||
We cannot use a simple checkbox with a simple name. The name must be an array.
|
||||
We are using `$.serializeArray` and that ignores empty values.
|
||||
So if the checkbox is not checked it is not sent to the server and not saved.
|
||||
|
||||
For that reason we need the hidden field which is always sent to server and if the checkbox
|
||||
is not set it will rewrite the array in the database using only the dummy field.
|
||||
#>
|
||||
<input
|
||||
type="hidden"
|
||||
value="1"
|
||||
name="mailpoet_subscribe_old_woocommerce_customers[dummy]"
|
||||
>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="settings[mailpoet_accept_cookie_revenue_tracking]">
|
||||
<%= _x('Enable browser cookies', 'Option in settings page: the user can accept or forbid MailPoet to use browser cookies') %>
|
||||
</label>
|
||||
<p class="description">
|
||||
<%= _x('If you enable this option, MailPoet will use browser cookies for more precise WooCommerce tracking. This is practical for abandoned cart emails for example.', 'Browser cookies are data created by websites and stored in visitors web browser') %>
|
||||
</p>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<input
|
||||
type="checkbox"
|
||||
value="1"
|
||||
id="settings[mailpoet_accept_cookie_revenue_tracking]"
|
||||
data-automation-id="accept_cookie_revenue_tracking"
|
||||
name="woocommerce[accept_cookie_revenue_tracking][enabled]"
|
||||
<% if(settings.woocommerce.accept_cookie_revenue_tracking.enabled == "1") %>checked="checked"<% endif %>
|
||||
>
|
||||
<input
|
||||
type="hidden"
|
||||
value="1"
|
||||
name="woocommerce[accept_cookie_revenue_tracking][set]"
|
||||
>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
Reference in New Issue
Block a user