Add notice for legacy shipping zones after update

This commit is contained in:
Mike Jolley 2016-03-15 15:58:00 +00:00
parent 5fe501e436
commit e22d324be4
8 changed files with 147 additions and 8 deletions

View File

@ -1 +1 @@
.woocommerce-message{overflow:hidden;position:relative;border-left-color:#cc99c2!important}.woocommerce-message a.button-primary,p.woocommerce-actions a.button-primary{background:#cc99c2;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);border-color:#b366a4;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);color:#fff;text-shadow:0 -1px 1px #8a4f7f,1px 0 1px #8a4f7f,0 1px 1px #8a4f7f,-1px 0 1px #8a4f7f}.woocommerce-message a.button-primary:hover,p.woocommerce-actions a.button-primary:hover{background:#bb77ae;border-color:#aa559a;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15)}.woocommerce-message a.button-primary:active,p.woocommerce-actions a.button-primary:active{background:#aa559a;border-color:#aa559a}.woocommerce-message a.docs,.woocommerce-message a.skip,p.woocommerce-actions a.docs,p.woocommerce-actions a.skip{opacity:.5}.woocommerce-message a.docs:focus,.woocommerce-message a.docs:hover,.woocommerce-message a.skip:focus,.woocommerce-message a.skip:hover,p.woocommerce-actions a.docs:focus,p.woocommerce-actions a.docs:hover,p.woocommerce-actions a.skip:focus,p.woocommerce-actions a.skip:hover{opacity:1}.woocommerce-message a.button-primary,.woocommerce-message a.button-secondary,p.woocommerce-actions a.button-primary,p.woocommerce-actions a.button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-left:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}
.woocommerce-message{overflow:hidden;position:relative;border-left-color:#cc99c2!important}.woocommerce-message a.button-primary,p.woocommerce-actions a.button-primary{background:#cc99c2;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);border-color:#b366a4;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);color:#fff;text-shadow:0 -1px 1px #8a4f7f,1px 0 1px #8a4f7f,0 1px 1px #8a4f7f,-1px 0 1px #8a4f7f}.woocommerce-message a.button-primary:hover,p.woocommerce-actions a.button-primary:hover{background:#bb77ae;border-color:#aa559a;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15)}.woocommerce-message a.button-primary:active,p.woocommerce-actions a.button-primary:active{background:#aa559a;border-color:#aa559a}.woocommerce-message a.docs,.woocommerce-message a.skip,p.woocommerce-actions a.docs,p.woocommerce-actions a.skip{opacity:.5}.woocommerce-message a.docs:focus,.woocommerce-message a.docs:hover,.woocommerce-message a.skip:focus,.woocommerce-message a.skip:hover,p.woocommerce-actions a.docs:focus,p.woocommerce-actions a.docs:hover,p.woocommerce-actions a.skip:focus,p.woocommerce-actions a.skip:hover{opacity:1}.woocommerce-message a.woocommerce-message-close,p.woocommerce-actions a.woocommerce-message-close{position:absolute;top:10px;right:10px;padding:10px 15px 10px 21px;font-size:13px;line-height:1.23076923;text-decoration:none}.woocommerce-message a.woocommerce-message-close:before,p.woocommerce-actions a.woocommerce-message-close:before{position:absolute;top:8px;left:0;-webkit-transition:all .1s ease-in-out;transition:all .1s ease-in-out}.woocommerce-message a.button-primary,.woocommerce-message a.button-secondary,p.woocommerce-actions a.button-primary,p.woocommerce-actions a.button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-left:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}div.woocommerce-legacy-shipping-notice{overflow:hidden;padding:1px 12px}div.woocommerce-legacy-shipping-notice p{position:relative;z-index:1;max-width:700px;line-height:1.5em;margin:12px 0}div.woocommerce-legacy-shipping-notice p.main{font-size:1.1em}div.woocommerce-legacy-shipping-notice:before{content:"\f319";font-family:dashicons;text-align:center;line-height:1;color:#F7F1F6;display:block;width:1em;font-size:20em;top:0;right:0;position:absolute}

View File

@ -49,6 +49,23 @@ p.woocommerce-actions,
}
}
a.woocommerce-message-close {
position: absolute;
top: 10px;
right: 10px;
padding: 10px 15px 10px 21px;
font-size: 13px;
line-height: 1.23076923;
text-decoration: none;
&:before {
position: absolute;
top: 8px;
left: 0;
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
}
a.button-primary,
a.button-secondary {
text-decoration: none !important;
@ -65,3 +82,32 @@ p.woocommerce-actions,
.woocommerce-about-text {
margin-bottom: 1em !important;
}
div.woocommerce-legacy-shipping-notice {
overflow: hidden;
padding: 1px 12px;
p {
position: relative;
z-index: 1;
max-width: 700px;
line-height: 1.5em;
margin: 12px 0;
&.main {
font-size: 1.1em;
}
}
&:before {
content: "\f319";
font-family: 'dashicons';
text-align: center;
line-height: 1;
color: #F7F1F6;
display: block;
width: 1em;
font-size: 20em;
top: 0;
right: 0;
position: absolute;
}
}

File diff suppressed because one or more lines are too long

View File

@ -149,6 +149,23 @@
text-decoration: none !important;
}
a.woocommerce-message-close {
position: absolute;
top: 10px;
right: 10px;
padding: 10px 15px 10px 21px;
font-size: 13px;
line-height: 1.23076923;
text-decoration: none;
&:before {
position: absolute;
top: 8px;
left: 0;
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
}
.twitter-share-button {
margin-top: -3px;
margin-left: 3px;
@ -156,6 +173,36 @@
}
}
div.woocommerce-legacy-shipping-notice {
overflow: hidden;
padding: 1px 12px;
p {
position: relative;
z-index: 1;
max-width: 700px;
line-height: 1.5em;
margin: 12px 0;
&.main {
font-size: 1.1em;
}
}
&:before {
content: "\f319";
font-family: 'dashicons';
text-align: center;
line-height: 1;
color: #F7F1F6;
display: block;
width: 1em;
font-size: 20em;
top: 0;
right: 0;
position: absolute;
}
}
#variable_product_options #message, #variable_product_options .notice {
margin: 10px;
}
@ -2134,7 +2181,6 @@ table.wc_shipping {
}
}
}
table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-classes {
td, th {
vertical-align: top;

View File

@ -22,10 +22,11 @@ class WC_Admin_Notices {
* @var array
*/
private $core_notices = array(
'install' => 'install_notice',
'update' => 'update_notice',
'template_files' => 'template_file_check_notice',
'theme_support' => 'theme_check_notice'
'install' => 'install_notice',
'update' => 'update_notice',
'template_files' => 'template_file_check_notice',
'theme_support' => 'theme_check_notice',
'legacy_shipping' => 'legacy_shipping_notice',
);
/**
@ -182,6 +183,27 @@ class WC_Admin_Notices {
self::remove_notice( 'template_files' );
}
}
/**
* Show a notice asking users to convert to shipping zones.
*/
public function legacy_shipping_notice() {
$maybe_load_legacy_methods = array( 'flat_rate', 'free_shipping', 'international_delivery', 'local_delivery', 'local_pickup' );
$enabled = false;
foreach ( $maybe_load_legacy_methods as $method ) {
$options = get_option( 'woocommerce_' . $method . '_settings' );
if ( $options && isset( $options['enabled'] ) && 'yes' === $options['enabled'] ) {
$enabled = true;
}
}
if ( $enabled ) {
include( 'views/html-notice-legacy-shipping.php' );
} else {
self::remove_notice( 'template_files' );
}
}
}
new WC_Admin_Notices();

View File

@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
?>
<h2><?php _e( 'Shipping Zones', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Shipping Zones let you group regions with similar Shipping Methods and rates. WooCommerce will automatically choose the correct Shipping Zone based on your customer&lsquo;s shipping address and present the Shipping Methods within that zone to them.', 'woocommerce' ) ); ?></h2>
<h2><?php _e( 'Shipping Zones', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Shipping Zones let you group regions with similar Shipping Methods and rates.', 'woocommerce' ) . ' ' . __( 'WooCommerce will automatically choose the correct Shipping Zone based on your customer&lsquo;s shipping address and present the Shipping Methods within that zone to them.', 'woocommerce' ) ); ?></h2>
<table class="wc-shipping-zones widefat">
<thead>

View File

@ -0,0 +1,23 @@
<?php
/**
* Admin View: Notice - Legacy Shipping.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div id="message" class="updated woocommerce-message woocommerce-legacy-shipping-notice">
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'legacy_shipping' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Dismiss', 'woocommerce' ); ?></a>
<p class="main"><strong><?php _e( 'New Feature: Shipping Zones!', 'woocommerce' ); ?></strong></p>
<p><?php _e( 'Shipping Zones let you group regions with similar Shipping Methods and rates.', 'woocommerce' ); ?></p>
<p><?php _e( 'Legacy shipping methods (Flat Rate, International, Local Pickup and Delivery and Free Shipping) are deprecated and <em>will be removed in future versions of WooCommerce</em>, but will continue to function as normal for now. We recommend disabling these shipping methods and instead setting up new rates within Shipping Zones as soon as possible.', 'woocommerce' ); ?></p>
<p class="submit">
<?php if ( empty( $_GET['page'] ) || empty( $_GET['tab'] ) || 'wc-settings' !== $_GET['page'] || 'shipping' !== $_GET['tab'] ) : ?>
<a class="button-primary" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ); ?>"><?php _e( 'Setup Shipping Zones', 'woocommerce' ); ?></a>
<?php endif; ?>
<a class="button-secondary" href="<?php echo esc_url( 'https://docs.woothemes.com/document/setting-up-shipping-zones/' ); ?>"><?php _e( 'Lean more about Shipping Zones', 'woocommerce' ); ?></a>
</p>
</div>

View File

@ -14,6 +14,8 @@ if ( ! defined( 'ABSPATH' ) ) {
global $wpdb;
WC_Admin_Notices::add_notice( 'legacy_shipping' );
/**
* Migrate term meta to WordPress tables
*/