Merge branch 'shipping-zone-modals'
# Conflicts: # assets/css/admin.css # assets/css/admin.scss
This commit is contained in:
commit
c757fd9940
|
@ -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.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}
|
||||
.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:"\e01b";font-family:WooCommerce;text-align:center;line-height:1;color:#F7F1F6;display:block;width:1em;font-size:20em;top:36px;right:12px;position:absolute}
|
|
@ -98,16 +98,16 @@ div.woocommerce-legacy-shipping-notice {
|
|||
}
|
||||
}
|
||||
&:before {
|
||||
content: "\f319";
|
||||
font-family: 'dashicons';
|
||||
content: "\e01b";
|
||||
font-family: "WooCommerce";
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
color: #F7F1F6;
|
||||
display: block;
|
||||
width: 1em;
|
||||
font-size: 20em;
|
||||
top: 0;
|
||||
right: 0;
|
||||
top: 36px;
|
||||
right: 12px;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -173,36 +173,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -2318,9 +2288,9 @@ table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-class
|
|||
background: #F7F1F6 !important;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
padding: 7.5em 10%;
|
||||
padding: 7.5em 7.5%;
|
||||
border-bottom: 2px solid #EEE2EC;
|
||||
p {
|
||||
p, li {
|
||||
color: #a46497;
|
||||
font-size: 1.5em;
|
||||
line-height: 1.5em;
|
||||
|
@ -2333,17 +2303,22 @@ table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-class
|
|||
font-size: 2em;
|
||||
}
|
||||
}
|
||||
li {
|
||||
margin-left: 1em;
|
||||
list-style: circle inside;
|
||||
}
|
||||
&:before {
|
||||
content: "\f319";
|
||||
font-family: 'dashicons';
|
||||
content: "\e01b";
|
||||
font-family: "WooCommerce";
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
color: #EEE2EC;
|
||||
display: block;
|
||||
width: 17px;
|
||||
width: 1em;
|
||||
font-size: 40em;
|
||||
top: 0;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
right: -3.75%;
|
||||
margin-top: -0.1875em;
|
||||
position: absolute;
|
||||
}
|
||||
.button-primary {
|
||||
|
@ -2485,6 +2460,12 @@ table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-class
|
|||
li:last-child {
|
||||
display: block;
|
||||
}
|
||||
li:first-child {
|
||||
margin: 0 !important;
|
||||
}
|
||||
li.wc-shipping-zone-methods-add-row {
|
||||
margin: .5em 0 0;
|
||||
}
|
||||
}
|
||||
.button {
|
||||
display: inline-block;
|
||||
|
@ -2498,11 +2479,16 @@ table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-class
|
|||
float: right;
|
||||
padding: .5em;
|
||||
cursor: pointer;
|
||||
line-height: 24px;
|
||||
|
||||
&:before {
|
||||
@include icon;
|
||||
font-family: 'Dashicons';
|
||||
color: #999;
|
||||
vertical-align: middle;
|
||||
line-height: 24px;
|
||||
font-size: 16px;
|
||||
margin: 0;
|
||||
}
|
||||
&:hover {
|
||||
&:before {
|
||||
|
@ -2513,7 +2499,7 @@ table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-class
|
|||
|
||||
a.wc-shipping-zone-delete, a.wc-shipping-zone-method-delete, a.wc-shipping-class-delete {
|
||||
&:before {
|
||||
content: "\e013";
|
||||
content: "\f158";
|
||||
}
|
||||
&:hover {
|
||||
&:before {
|
||||
|
@ -2524,16 +2510,14 @@ table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-class
|
|||
|
||||
a.wc-shipping-class-edit {
|
||||
&:before {
|
||||
font-family: "Dashicons";
|
||||
content: "\f464";
|
||||
}
|
||||
}
|
||||
|
||||
a.wc-shipping-zone-method-settings {
|
||||
&:before {
|
||||
@include icon("\f111");
|
||||
font-family: 'Dashicons';
|
||||
line-height: 2.26;
|
||||
content: "\f111";
|
||||
margin-top: -1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2559,6 +2543,52 @@ table.wc-shipping-zones, table.wc-shipping-zone-methods, table.wc-shipping-class
|
|||
}
|
||||
}
|
||||
|
||||
.wc-modal-shipping-method-settings {
|
||||
background: #f8f8f8;
|
||||
padding: 1em !important;
|
||||
form {
|
||||
.form-table {
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
margin: 0 0 1.5em;
|
||||
tr {
|
||||
th {
|
||||
width: 30%;
|
||||
position: relative;
|
||||
.woocommerce-help-tip {
|
||||
float: right;
|
||||
margin: -8px -.5em 0 0;
|
||||
vertical-align: middle;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
td {
|
||||
input, select, textarea {
|
||||
width: 50%;
|
||||
min-width: 250px;
|
||||
}
|
||||
input[type="checkbox"] {
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
td, th {
|
||||
vertical-align: middle;
|
||||
margin: 0;
|
||||
line-height: 24px;
|
||||
padding: 1em;
|
||||
border-bottom: 1px solid #f8f8f8;
|
||||
}
|
||||
}
|
||||
&:last-of-type {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wc-backbone-modal .wc-shipping-zone-method-selector {
|
||||
padding: 2px;
|
||||
.wc-shipping-zone-method-description {
|
||||
|
@ -4848,11 +4878,19 @@ table.bar_chart {
|
|||
|
||||
.wc-backbone-modal-content {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 500px;
|
||||
background: #fff;
|
||||
z-index: 100000;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
&.wc-backbone-modal-shipping-method-settings {
|
||||
.wc-backbone-modal-content {
|
||||
width: 75%;
|
||||
min-width: 500px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,11 +76,7 @@
|
|||
|
||||
var $content = $( '.wc-backbone-modal-content' ).find( 'article' );
|
||||
var content_h = ( $content.height() < 90 ) ? 90 : $content.height();
|
||||
var max_h = $( window ).height() - 200;
|
||||
|
||||
if ( max_h > 400 ) {
|
||||
max_h = 400;
|
||||
}
|
||||
var max_h = $( window ).height() * 0.75;
|
||||
|
||||
if ( content_h > max_h ) {
|
||||
$content.css({
|
||||
|
@ -94,10 +90,10 @@
|
|||
});
|
||||
}
|
||||
|
||||
$( '.wc-backbone-modal-content' ).css({
|
||||
/*$( '.wc-backbone-modal-content' ).css({
|
||||
'margin-top': '-' + ( $( '.wc-backbone-modal-content' ).height() / 2 ) + 'px',
|
||||
'margin-left': '-' + ( $( '.wc-backbone-modal-content' ).width() / 2 ) + 'px'
|
||||
});
|
||||
});*/
|
||||
|
||||
$( document.body ).trigger( 'wc_backbone_modal_loaded', this._target );
|
||||
},
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(a,b,c){"use strict";a.fn.WCBackboneModal=function(b){return this.each(function(){new a.WCBackboneModal(a(this),b)})},a.WCBackboneModal=function(b,c){var d=a.extend({},a.WCBackboneModal.defaultOptions,c);d.template&&new a.WCBackboneModal.View({target:d.template,string:d.variable})},a.WCBackboneModal.defaultOptions={template:"",variable:{}},a.WCBackboneModal.View=b.View.extend({tagName:"div",id:"wc-backbone-modal-dialog",_target:void 0,_string:void 0,events:{"click .modal-close":"closeButton","click #btn-ok":"addButton","touchstart #btn-ok":"addButton",keydown:"keyboardActions"},initialize:function(a){this._target=a.target,this._string=a.string,c.bindAll(this,"render"),this.render()},render:function(){var b=wp.template(this._target);this.$el.attr("tabindex","0").append(b(this._string)),a(document.body).css({overflow:"hidden"}).append(this.$el);var c=a(".wc-backbone-modal-content").find("article"),d=c.height()<90?90:c.height(),e=a(window).height()-200;e>400&&(e=400),d>e?c.css({overflow:"auto",height:e+"px"}):c.css({overflow:"visible",height:d>90?"auto":d+"px"}),a(".wc-backbone-modal-content").css({"margin-top":"-"+a(".wc-backbone-modal-content").height()/2+"px","margin-left":"-"+a(".wc-backbone-modal-content").width()/2+"px"}),a(document.body).trigger("wc_backbone_modal_loaded",this._target)},closeButton:function(b){b.preventDefault(),a(document.body).trigger("wc_backbone_modal_before_remove",this._target),this.undelegateEvents(),a(document).off("focusin"),a(document.body).css({overflow:"auto"}),this.remove(),a(document.body).trigger("wc_backbone_modal_removed",this._target)},addButton:function(b){a(document.body).trigger("wc_backbone_modal_response",[this._target,this.getFormData()]),this.closeButton(b)},getFormData:function(){var b={};return a(document.body).trigger("wc_backbone_modal_before_update",this._target),a.each(a("form",this.$el).serializeArray(),function(c,d){b.hasOwnProperty(d.name)?(b[d.name]=a.makeArray(b[d.name]),b[d.name].push(d.value)):b[d.name]=d.value}),b},keyboardActions:function(a){var b=a.keyCode||a.which;13!==b||a.target.tagName&&("input"===a.target.tagName.toLowerCase()||"textarea"===a.target.tagName.toLowerCase())||this.addButton(a),27===b&&this.closeButton(a)}})}(jQuery,Backbone,_);
|
||||
!function(a,b,c){"use strict";a.fn.WCBackboneModal=function(b){return this.each(function(){new a.WCBackboneModal(a(this),b)})},a.WCBackboneModal=function(b,c){var d=a.extend({},a.WCBackboneModal.defaultOptions,c);d.template&&new a.WCBackboneModal.View({target:d.template,string:d.variable})},a.WCBackboneModal.defaultOptions={template:"",variable:{}},a.WCBackboneModal.View=b.View.extend({tagName:"div",id:"wc-backbone-modal-dialog",_target:void 0,_string:void 0,events:{"click .modal-close":"closeButton","click #btn-ok":"addButton","touchstart #btn-ok":"addButton",keydown:"keyboardActions"},initialize:function(a){this._target=a.target,this._string=a.string,c.bindAll(this,"render"),this.render()},render:function(){var b=wp.template(this._target);this.$el.attr("tabindex","0").append(b(this._string)),a(document.body).css({overflow:"hidden"}).append(this.$el);var c=a(".wc-backbone-modal-content").find("article"),d=c.height()<90?90:c.height(),e=.75*a(window).height();d>e?c.css({overflow:"auto",height:e+"px"}):c.css({overflow:"visible",height:d>90?"auto":d+"px"}),a(document.body).trigger("wc_backbone_modal_loaded",this._target)},closeButton:function(b){b.preventDefault(),a(document.body).trigger("wc_backbone_modal_before_remove",this._target),this.undelegateEvents(),a(document).off("focusin"),a(document.body).css({overflow:"auto"}),this.remove(),a(document.body).trigger("wc_backbone_modal_removed",this._target)},addButton:function(b){a(document.body).trigger("wc_backbone_modal_response",[this._target,this.getFormData()]),this.closeButton(b)},getFormData:function(){var b={};return a(document.body).trigger("wc_backbone_modal_before_update",this._target),a.each(a("form",this.$el).serializeArray(),function(c,d){b.hasOwnProperty(d.name)?(b[d.name]=a.makeArray(b[d.name]),b[d.name].push(d.value)):b[d.name]=d.value}),b},keyboardActions:function(a){var b=a.keyCode||a.which;13!==b||a.target.tagName&&("input"===a.target.tagName.toLowerCase()||"textarea"===a.target.tagName.toLowerCase())||this.addButton(a),27===b&&this.closeButton(a)}})}(jQuery,Backbone,_);
|
|
@ -104,7 +104,7 @@ jQuery(function( $ ) {
|
|||
|
||||
// Autosuggest product tags on bulk edit
|
||||
var tax = 'product_tag';
|
||||
$( 'tr.inline-editor textarea[name="tax_input[' + tax + ']"]' ).suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma } );
|
||||
$( 'tr.inline-editor textarea[name="tax_input[' + tax + ']"]' ).suggest( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma } );
|
||||
});
|
||||
|
||||
$( '#wpbody' ).on( 'change', '#woocommerce-fields-bulk .inline-edit-group .change_to', function() {
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(a){a("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var b=a(this).closest("tr").attr("id");b=b.replace("post-","");var c=a("#woocommerce_inline_"+b),d=c.find(".sku").text(),e=c.find(".regular_price").text(),f=c.find(".sale_price ").text(),g=c.find(".weight").text(),h=c.find(".length").text(),i=c.find(".width").text(),j=c.find(".height").text(),k=c.find(".shipping_class").text(),l=c.find(".visibility").text(),m=c.find(".stock_status").text(),n=c.find(".stock").text(),o=c.find(".featured").text(),p=c.find(".manage_stock").text(),q=c.find(".menu_order").text(),r=c.find(".tax_status").text(),s=c.find(".tax_class").text(),t=c.find(".backorders").text();a('input[name="_sku"]',".inline-edit-row").val(d),a('input[name="_regular_price"]',".inline-edit-row").val(e),a('input[name="_sale_price"]',".inline-edit-row").val(f),a('input[name="_weight"]',".inline-edit-row").val(g),a('input[name="_length"]',".inline-edit-row").val(h),a('input[name="_width"]',".inline-edit-row").val(i),a('input[name="_height"]',".inline-edit-row").val(j),a('select[name="_shipping_class"] option:selected',".inline-edit-row").attr("selected",!1).change(),a('select[name="_shipping_class"] option[value="'+k+'"]').attr("selected","selected").change(),a('input[name="_stock"]',".inline-edit-row").val(n),a('input[name="menu_order"]',".inline-edit-row").val(q),a('select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').removeAttr("selected"),a('select[name="_tax_status"] option[value="'+r+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_tax_class"] option[value="'+s+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_visibility"] option[value="'+l+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_stock_status"] option[value="'+m+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_backorders"] option[value="'+t+'"]',".inline-edit-row").attr("selected","selected"),"yes"===o?a('input[name="_featured"]',".inline-edit-row").attr("checked","checked"):a('input[name="_featured"]',".inline-edit-row").removeAttr("checked"),"yes"===p?(a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"),a('input[name="_manage_stock"]',".inline-edit-row").attr("checked","checked")):(a(".stock_qty_field",".inline-edit-row").hide(),a('input[name="_manage_stock"]',".inline-edit-row").removeAttr("checked"));var u=c.find(".product_type").text(),v=c.find(".product_is_virtual").text();"simple"===u||"external"===u?a(".price_fields",".inline-edit-row").show().removeAttr("style"):a(".price_fields",".inline-edit-row").hide(),"yes"===v?a(".dimension_fields",".inline-edit-row").hide():a(".dimension_fields",".inline-edit-row").show().removeAttr("style"),"grouped"===u?a(".stock_fields",".inline-edit-row").hide():a(".stock_fields",".inline-edit-row").show().removeAttr("style")}),a("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){a(this).is(":checked")?a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"):a(".stock_qty_field",".inline-edit-row").hide()}),a("#wpbody").on("click","#doaction, #doaction2",function(){a("input.text",".inline-edit-row").val(""),a("#woocommerce-fields").find("select").prop("selectedIndex",0),a("#woocommerce-fields-bulk").find(".inline-edit-group .change-input").hide();var b="product_tag";a('tr.inline-editor textarea[name="tax_input['+b+']"]').suggest(ajaxurl+"?action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:!0,multipleSep:inlineEditL10n.comma})}),a("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){0<a(this).val()?a(this).closest("div").find(".change-input").show():a(this).closest("div").find(".change-input").hide()})});
|
||||
jQuery(function(a){a("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var b=a(this).closest("tr").attr("id");b=b.replace("post-","");var c=a("#woocommerce_inline_"+b),d=c.find(".sku").text(),e=c.find(".regular_price").text(),f=c.find(".sale_price ").text(),g=c.find(".weight").text(),h=c.find(".length").text(),i=c.find(".width").text(),j=c.find(".height").text(),k=c.find(".shipping_class").text(),l=c.find(".visibility").text(),m=c.find(".stock_status").text(),n=c.find(".stock").text(),o=c.find(".featured").text(),p=c.find(".manage_stock").text(),q=c.find(".menu_order").text(),r=c.find(".tax_status").text(),s=c.find(".tax_class").text(),t=c.find(".backorders").text();a('input[name="_sku"]',".inline-edit-row").val(d),a('input[name="_regular_price"]',".inline-edit-row").val(e),a('input[name="_sale_price"]',".inline-edit-row").val(f),a('input[name="_weight"]',".inline-edit-row").val(g),a('input[name="_length"]',".inline-edit-row").val(h),a('input[name="_width"]',".inline-edit-row").val(i),a('input[name="_height"]',".inline-edit-row").val(j),a('select[name="_shipping_class"] option:selected',".inline-edit-row").attr("selected",!1).change(),a('select[name="_shipping_class"] option[value="'+k+'"]').attr("selected","selected").change(),a('input[name="_stock"]',".inline-edit-row").val(n),a('input[name="menu_order"]',".inline-edit-row").val(q),a('select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').removeAttr("selected"),a('select[name="_tax_status"] option[value="'+r+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_tax_class"] option[value="'+s+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_visibility"] option[value="'+l+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_stock_status"] option[value="'+m+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_backorders"] option[value="'+t+'"]',".inline-edit-row").attr("selected","selected"),"yes"===o?a('input[name="_featured"]',".inline-edit-row").attr("checked","checked"):a('input[name="_featured"]',".inline-edit-row").removeAttr("checked"),"yes"===p?(a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"),a('input[name="_manage_stock"]',".inline-edit-row").attr("checked","checked")):(a(".stock_qty_field",".inline-edit-row").hide(),a('input[name="_manage_stock"]',".inline-edit-row").removeAttr("checked"));var u=c.find(".product_type").text(),v=c.find(".product_is_virtual").text();"simple"===u||"external"===u?a(".price_fields",".inline-edit-row").show().removeAttr("style"):a(".price_fields",".inline-edit-row").hide(),"yes"===v?a(".dimension_fields",".inline-edit-row").hide():a(".dimension_fields",".inline-edit-row").show().removeAttr("style"),"grouped"===u?a(".stock_fields",".inline-edit-row").hide():a(".stock_fields",".inline-edit-row").show().removeAttr("style")}),a("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){a(this).is(":checked")?a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"):a(".stock_qty_field",".inline-edit-row").hide()}),a("#wpbody").on("click","#doaction, #doaction2",function(){a("input.text",".inline-edit-row").val(""),a("#woocommerce-fields").find("select").prop("selectedIndex",0),a("#woocommerce-fields-bulk").find(".inline-edit-group .change-input").hide();var b="product_tag";a('tr.inline-editor textarea[name="tax_input['+b+']"]').suggest(ajaxurl+(ajaxurl.indexOf("?")>0?"&":"?")+"action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:!0,multipleSep:inlineEditL10n.comma})}),a("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){0<a(this).val()?a(this).closest("div").find(".change-input").show():a(this).closest("div").find(".change-input").hide()})});
|
|
@ -84,7 +84,7 @@
|
|||
Backbone.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_tax_rates_save_changes',
|
||||
url: ajaxurl + ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_tax_rates_save_changes',
|
||||
data: {
|
||||
current_class: data.current_class,
|
||||
wc_tax_nonce: data.wc_tax_nonce,
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -22,7 +22,7 @@
|
|||
},
|
||||
save: function() {
|
||||
if ( _.size( this.changes ) ) {
|
||||
$.post( ajaxurl + '?action=woocommerce_shipping_classes_save_changes', {
|
||||
$.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_classes_save_changes', {
|
||||
wc_shipping_classes_nonce : data.wc_shipping_classes_nonce,
|
||||
changes : this.changes
|
||||
}, this.onSaveResponse, 'json' );
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(a,b,c,d){a(function(){var e=a(".wc-shipping-classes"),f=a(".wc-shipping-class-rows"),g=a(".wc-shipping-class-save"),h=c.template("wc-shipping-class-row"),i=c.template("wc-shipping-class-row-blank"),j=Backbone.Model.extend({changes:{},logChanges:function(a){var b=this.changes||{};_.each(a,function(a,c){b[c]=_.extend(b[c]||{term_id:c},a)}),this.changes=b,this.trigger("change:classes")},save:function(){_.size(this.changes)?a.post(d+"?action=woocommerce_shipping_classes_save_changes",{wc_shipping_classes_nonce:b.wc_shipping_classes_nonce,changes:this.changes},this.onSaveResponse,"json"):l.trigger("saved:classes")},onSaveResponse:function(a,c){"success"===c&&(a.success?(l.set("classes",a.data.shipping_classes),l.trigger("change:classes"),l.changes={},l.trigger("saved:classes")):a.data?window.alert(a.data):window.alert(b.strings.save_failed)),m.unblock()}}),k=Backbone.View.extend({rowTemplate:h,initialize:function(){this.listenTo(this.model,"change:classes",this.setUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.clearUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.render),f.on("change",{view:this},this.updateModelOnChange),a(window).on("beforeunload",{view:this},this.unloadConfirmation),g.on("click",{view:this},this.onSubmit),a(document.body).on("click",".wc-shipping-class-add",{view:this},this.onAddNewRow),a(document.body).on("click",".wc-shipping-class-save-changes",{view:this},this.onSubmit)},block:function(){a(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){a(this.el).unblock()},render:function(){var b=_.indexBy(this.model.get("classes"),"term_id"),c=this;this.$el.empty(),this.unblock(),_.size(b)?(b=_.sortBy(b,function(a){return a.name}),a.each(b,function(a,b){c.$el.append(c.rowTemplate(b));var d=c.$el.find('tr[data-id="'+b.term_id+'"]');b.editing&&d.addClass("editing")}),this.$el.find(".view").show(),this.$el.find(".edit").hide(),this.$el.find(".wc-shipping-class-edit").on("click",{view:this},this.onEditRow),this.$el.find(".wc-shipping-class-delete").on("click",{view:this},this.onDeleteRow),this.$el.find(".wc-shipping-class-postcodes-toggle").on("click",{view:this},this.onTogglePostcodes),this.$el.find(".editing .wc-shipping-class-edit").trigger("click"),0===_.size(b)%2?e.find("tbody.wc-shipping-class-rows").next("tbody").find("tr").addClass("odd"):e.find("tbody.wc-shipping-class-rows").next("tbody").find("tr").removeClass("odd")):c.$el.append(i)},onSubmit:function(a){a.data.view.block(),a.data.view.model.save(),a.preventDefault()},onAddNewRow:function(a){a.preventDefault();var c=a.data.view,d=c.model,e=_.indexBy(d.get("classes"),"term_id"),f={},g=_.size(e),h=_.extend({},b.default_class,{term_id:"new-"+g+"-"+Date.now(),editing:!0,newRow:!0});e[h.term_id]=h,f[h.term_id]=h,d.set("classes",e),d.logChanges(f),c.render()},onEditRow:function(b){b.preventDefault(),a(this).closest("tr").addClass("editing"),a(this).closest("tr").find(".view").hide(),a(this).closest("tr").find(".edit").show(),b.data.view.model.trigger("change:classes")},onDeleteRow:function(b){var c=b.data.view,d=c.model,e=_.indexBy(d.get("classes"),"term_id"),f={},g=a(this).closest("tr").data("id");b.preventDefault(),delete e[g],f[g]=_.extend(f[g]||{},{deleted:"deleted"}),d.set("classes",e),d.logChanges(f),c.render()},setUnloadConfirmation:function(){this.needsUnloadConfirm=!0,g.removeAttr("disabled")},clearUnloadConfirmation:function(){this.needsUnloadConfirm=!1,g.attr("disabled","disabled")},unloadConfirmation:function(a){return a.data.view.needsUnloadConfirm?(a.returnValue=b.strings.unload_confirmation_msg,window.event.returnValue=b.strings.unload_confirmation_msg,b.strings.unload_confirmation_msg):void 0},updateModelOnChange:function(b){var c=b.data.view.model,d=a(b.target),e=d.closest("tr").data("id"),f=d.data("attribute"),g=d.val(),h=_.indexBy(c.get("classes"),"term_id"),i={};h[e][f]!==g&&(i[e]={},i[e][f]=g,h[e][f]=g),c.logChanges(i)}}),l=new j({classes:b.classes}),m=new k({model:l,el:f});m.render()})}(jQuery,shippingClassesLocalizeScript,wp,ajaxurl);
|
||||
!function(a,b,c,d){a(function(){var e=a(".wc-shipping-classes"),f=a(".wc-shipping-class-rows"),g=a(".wc-shipping-class-save"),h=c.template("wc-shipping-class-row"),i=c.template("wc-shipping-class-row-blank"),j=Backbone.Model.extend({changes:{},logChanges:function(a){var b=this.changes||{};_.each(a,function(a,c){b[c]=_.extend(b[c]||{term_id:c},a)}),this.changes=b,this.trigger("change:classes")},save:function(){_.size(this.changes)?a.post(d+(d.indexOf("?")>0?"&":"?")+"action=woocommerce_shipping_classes_save_changes",{wc_shipping_classes_nonce:b.wc_shipping_classes_nonce,changes:this.changes},this.onSaveResponse,"json"):l.trigger("saved:classes")},onSaveResponse:function(a,c){"success"===c&&(a.success?(l.set("classes",a.data.shipping_classes),l.trigger("change:classes"),l.changes={},l.trigger("saved:classes")):a.data?window.alert(a.data):window.alert(b.strings.save_failed)),m.unblock()}}),k=Backbone.View.extend({rowTemplate:h,initialize:function(){this.listenTo(this.model,"change:classes",this.setUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.clearUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.render),f.on("change",{view:this},this.updateModelOnChange),a(window).on("beforeunload",{view:this},this.unloadConfirmation),g.on("click",{view:this},this.onSubmit),a(document.body).on("click",".wc-shipping-class-add",{view:this},this.onAddNewRow),a(document.body).on("click",".wc-shipping-class-save-changes",{view:this},this.onSubmit)},block:function(){a(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){a(this.el).unblock()},render:function(){var b=_.indexBy(this.model.get("classes"),"term_id"),c=this;this.$el.empty(),this.unblock(),_.size(b)?(b=_.sortBy(b,function(a){return a.name}),a.each(b,function(a,b){c.$el.append(c.rowTemplate(b));var d=c.$el.find('tr[data-id="'+b.term_id+'"]');b.editing&&d.addClass("editing")}),this.$el.find(".view").show(),this.$el.find(".edit").hide(),this.$el.find(".wc-shipping-class-edit").on("click",{view:this},this.onEditRow),this.$el.find(".wc-shipping-class-delete").on("click",{view:this},this.onDeleteRow),this.$el.find(".wc-shipping-class-postcodes-toggle").on("click",{view:this},this.onTogglePostcodes),this.$el.find(".editing .wc-shipping-class-edit").trigger("click"),0===_.size(b)%2?e.find("tbody.wc-shipping-class-rows").next("tbody").find("tr").addClass("odd"):e.find("tbody.wc-shipping-class-rows").next("tbody").find("tr").removeClass("odd")):c.$el.append(i)},onSubmit:function(a){a.data.view.block(),a.data.view.model.save(),a.preventDefault()},onAddNewRow:function(a){a.preventDefault();var c=a.data.view,d=c.model,e=_.indexBy(d.get("classes"),"term_id"),f={},g=_.size(e),h=_.extend({},b.default_class,{term_id:"new-"+g+"-"+Date.now(),editing:!0,newRow:!0});e[h.term_id]=h,f[h.term_id]=h,d.set("classes",e),d.logChanges(f),c.render()},onEditRow:function(b){b.preventDefault(),a(this).closest("tr").addClass("editing"),a(this).closest("tr").find(".view").hide(),a(this).closest("tr").find(".edit").show(),b.data.view.model.trigger("change:classes")},onDeleteRow:function(b){var c=b.data.view,d=c.model,e=_.indexBy(d.get("classes"),"term_id"),f={},g=a(this).closest("tr").data("id");b.preventDefault(),delete e[g],f[g]=_.extend(f[g]||{},{deleted:"deleted"}),d.set("classes",e),d.logChanges(f),c.render()},setUnloadConfirmation:function(){this.needsUnloadConfirm=!0,g.removeAttr("disabled")},clearUnloadConfirmation:function(){this.needsUnloadConfirm=!1,g.attr("disabled","disabled")},unloadConfirmation:function(a){return a.data.view.needsUnloadConfirm?(a.returnValue=b.strings.unload_confirmation_msg,window.event.returnValue=b.strings.unload_confirmation_msg,b.strings.unload_confirmation_msg):void 0},updateModelOnChange:function(b){var c=b.data.view.model,d=a(b.target),e=d.closest("tr").data("id"),f=d.data("attribute"),g=d.val(),h=_.indexBy(c.get("classes"),"term_id"),i={};h[e][f]!==g&&(i[e]={},i[e][f]=g,h[e][f]=g),c.logChanges(i)}}),l=new j({classes:b.classes}),m=new k({model:l,el:f});m.render()})}(jQuery,shippingClassesLocalizeScript,wp,ajaxurl);
|
|
@ -22,7 +22,7 @@
|
|||
},
|
||||
save: function() {
|
||||
if ( _.size( this.changes ) ) {
|
||||
$.post( ajaxurl + '?action=woocommerce_shipping_zone_methods_save_changes', {
|
||||
$.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_methods_save_changes', {
|
||||
wc_shipping_zones_nonce : data.wc_shipping_zones_nonce,
|
||||
changes : this.changes,
|
||||
zone_id : data.zone_id
|
||||
|
@ -32,10 +32,10 @@
|
|||
}
|
||||
},
|
||||
addMethod: function() {
|
||||
if ( _.size( this.changes ) ) {
|
||||
if ( _.size( this.changes ) && window.confirm( data.strings.save_changes_prompt ) ) {
|
||||
this.save();
|
||||
}
|
||||
$.post( ajaxurl + '?action=woocommerce_shipping_zone_add_method', {
|
||||
$.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_add_method', {
|
||||
wc_shipping_zones_nonce : data.wc_shipping_zones_nonce,
|
||||
method_id : $('select[name="add_method_id"]').val(),
|
||||
zone_id : data.zone_id
|
||||
|
@ -79,6 +79,10 @@
|
|||
$( window ).on( 'beforeunload', { view: this }, this.unloadConfirmation );
|
||||
$save_button.on( 'click', { view: this }, this.onSubmit );
|
||||
$('.wc-shipping-zone-add-method').on( 'click', { view: this }, this.onAdd );
|
||||
|
||||
// Settings modal
|
||||
$( document.body ).on( 'click', '.wc-shipping-zone-method-settings', { view: this }, this.onConfigureShippingMethod );
|
||||
$( document.body ).on( 'wc_backbone_modal_response', this.onConfigureShippingMethodSubmitted );
|
||||
},
|
||||
block: function() {
|
||||
$( this.el ).block({
|
||||
|
@ -229,6 +233,74 @@
|
|||
if ( _.size( changes ) ) {
|
||||
model.logChanges( changes );
|
||||
}
|
||||
},
|
||||
onConfigureShippingMethod: function( event ) {
|
||||
var instance_id = $( this ).closest( 'tr' ).data( 'id' ),
|
||||
model = event.data.view.model,
|
||||
methods = _.indexBy( model.get( 'methods' ), 'instance_id' ),
|
||||
method = methods[ instance_id ];
|
||||
|
||||
// Only load modal if supported
|
||||
if ( ! method.settings_html ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
$( this ).WCBackboneModal({
|
||||
template : 'wc-modal-shipping-method-settings',
|
||||
variable : {
|
||||
instance_id : instance_id,
|
||||
method : method
|
||||
},
|
||||
data : {
|
||||
instance_id : instance_id,
|
||||
method : method
|
||||
}
|
||||
});
|
||||
|
||||
$( document.body ).trigger( 'init_tooltips' );
|
||||
},
|
||||
onConfigureShippingMethodSubmitted: function( event, target, posted_data ) {
|
||||
if ( 'wc-modal-shipping-method-settings' === target ) {
|
||||
shippingMethodView.block();
|
||||
|
||||
// Save method settings via ajax call
|
||||
$.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_methods_save_settings', {
|
||||
wc_shipping_zones_nonce : data.wc_shipping_zones_nonce,
|
||||
instance_id : posted_data.instance_id,
|
||||
data : posted_data
|
||||
}, function( response, textStatus ) {
|
||||
if ( 'success' === textStatus && response.success ) {
|
||||
$( 'table.wc-shipping-zone-methods' ).parent().find( '#woocommerce_errors' ).remove();
|
||||
|
||||
// If there were errors, prepend the form.
|
||||
if ( response.data.errors.length > 0 ) {
|
||||
this.showErrors( response.data.errors );
|
||||
}
|
||||
|
||||
// Method was saved. Re-render.
|
||||
if ( _.size( shippingMethodView.model.changes ) ) {
|
||||
shippingMethodView.model.save();
|
||||
} else {
|
||||
shippingMethodView.model.onSaveResponse( response, textStatus );
|
||||
}
|
||||
} else {
|
||||
window.alert( data.strings.save_failed );
|
||||
shippingMethodView.unblock();
|
||||
}
|
||||
}, 'json' );
|
||||
}
|
||||
},
|
||||
showErrors: function( errors ) {
|
||||
var error_html = '<div id="woocommerce_errors" class="error notice is-dismissible">';
|
||||
|
||||
$( errors ).each( function( index, value ) {
|
||||
error_html = error_html + '<p>' + value + '</p>';
|
||||
} );
|
||||
error_html = error_html + '</div>';
|
||||
|
||||
$( 'table.wc-shipping-zone-methods' ).before( error_html );
|
||||
}
|
||||
} ),
|
||||
shippingMethod = new ShippingMethod({
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -30,7 +30,7 @@
|
|||
},
|
||||
save: function() {
|
||||
if ( _.size( this.changes ) ) {
|
||||
$.post( ajaxurl + '?action=woocommerce_shipping_zones_save_changes', {
|
||||
$.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zones_save_changes', {
|
||||
wc_shipping_zones_nonce : data.wc_shipping_zones_nonce,
|
||||
changes : this.changes
|
||||
}, this.onSaveResponse, 'json' );
|
||||
|
@ -129,6 +129,7 @@
|
|||
// Make the rows function
|
||||
this.$el.find('.view').show();
|
||||
this.$el.find('.edit').hide();
|
||||
this.$el.find('.wc-shipping-zone-save-changes-notice').hide();
|
||||
this.$el.find( '.wc-shipping-zone-edit' ).on( 'click', { view: this }, this.onEditRow );
|
||||
this.$el.find( '.wc-shipping-zone-delete' ).on( 'click', { view: this }, this.onDeleteRow );
|
||||
this.$el.find( '.wc-shipping-zone-postcodes-toggle' ).on( 'click', { view: this }, this.onTogglePostcodes );
|
||||
|
@ -150,7 +151,7 @@
|
|||
var $tr = $( '.wc-shipping-zones tr[data-id="' + zone_id + '"]');
|
||||
var $method_list = $tr.find('.wc-shipping-zone-methods ul');
|
||||
|
||||
$method_list.empty();
|
||||
$method_list.find( '.wc-shipping-zone-method' ).remove();
|
||||
|
||||
if ( _.size( shipping_methods ) ) {
|
||||
_.each( shipping_methods, function( shipping_method, instance_id ) {
|
||||
|
@ -160,11 +161,9 @@
|
|||
class_name = 'method_enabled';
|
||||
}
|
||||
|
||||
$method_list.append( '<li><a href="admin.php?page=wc-settings&tab=shipping&instance_id=' + instance_id + '" class="' + class_name + '">' + shipping_method.title + '</a></li>' );
|
||||
$method_list.prepend( '<li class="wc-shipping-zone-method"><a href="admin.php?page=wc-settings&tab=shipping&instance_id=' + instance_id + '" class="' + class_name + '">' + shipping_method.title + '</a></li>' );
|
||||
} );
|
||||
$method_list.append( '<li>' + data.strings.add_another_method + '</li>' );
|
||||
} else {
|
||||
$method_list.append( '<li>' + data.strings.no_methods + '</li>' );
|
||||
|
||||
}
|
||||
},
|
||||
initTooltips: function() {
|
||||
|
@ -219,6 +218,8 @@
|
|||
$( this ).closest('tr').find('.edit').show();
|
||||
$( '.wc-shipping-zone-region-select:not(.enhanced)' ).select2( select2_args );
|
||||
$( '.wc-shipping-zone-region-select:not(.enhanced)' ).addClass('enhanced');
|
||||
$( this ).closest('tr').find('.add_shipping_method').attr( 'disabled', 'disabled' ).addClass( 'tips' );
|
||||
event.data.view.initTooltips();
|
||||
event.data.view.model.trigger( 'change:zones' );
|
||||
},
|
||||
onDeleteRow: function( event ) {
|
||||
|
@ -306,7 +307,7 @@
|
|||
shippingZoneView.block();
|
||||
|
||||
// Add method to zone via ajax call
|
||||
$.post( ajaxurl + '?action=woocommerce_shipping_zone_add_method', {
|
||||
$.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_add_method', {
|
||||
wc_shipping_zones_nonce : data.wc_shipping_zones_nonce,
|
||||
method_id : posted_data.add_method_id,
|
||||
zone_id : posted_data.zone_id
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -79,21 +79,25 @@ jQuery( function ( $ ) {
|
|||
} else {
|
||||
$( document.body ).triggerHandler( 'wc_remove_error_tip', [ $(this), 'i18_sale_less_than_regular_error' ] );
|
||||
}
|
||||
})
|
||||
.on( 'init_tooltips', function() {
|
||||
var tiptip_args = {
|
||||
'attribute': 'data-tip',
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
};
|
||||
|
||||
$( '.tips, .help_tip, .woocommerce-help-tip' ).tipTip( tiptip_args );
|
||||
|
||||
// Add tiptip to parent element for widefat tables
|
||||
$( '.parent-tips' ).each( function() {
|
||||
$( this ).closest( 'a, th' ).attr( 'data-tip', $( this ).data( 'tip' ) ).tipTip( tiptip_args ).css( 'cursor', 'help' );
|
||||
});
|
||||
});
|
||||
|
||||
// Tooltips
|
||||
var tiptip_args = {
|
||||
'attribute': 'data-tip',
|
||||
'fadeIn': 50,
|
||||
'fadeOut': 50,
|
||||
'delay': 200
|
||||
};
|
||||
$( '.tips, .help_tip, .woocommerce-help-tip' ).tipTip( tiptip_args );
|
||||
|
||||
// Add tiptip to parent element for widefat tables
|
||||
$( '.parent-tips' ).each( function() {
|
||||
$( this ).closest( 'a, th' ).attr( 'data-tip', $( this ).data( 'tip' ) ).tipTip( tiptip_args ).css( 'cursor', 'help' );
|
||||
});
|
||||
$( document.body ).trigger( 'init_tooltips' );
|
||||
|
||||
// wc_input_table tables
|
||||
$( '.wc_input_table.sortable tbody' ).sortable({
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -97,12 +97,16 @@ abstract class WC_Settings_API {
|
|||
|
||||
/**
|
||||
* Get a field's posted and validated value.
|
||||
* @param string $key
|
||||
* @param array $field
|
||||
* @param array $post_data
|
||||
* @return string
|
||||
*/
|
||||
public function get_field_value( $key, $field ) {
|
||||
public function get_field_value( $key, $field, $post_data = array() ) {
|
||||
$type = $this->get_field_type( $field );
|
||||
$field_key = $this->get_field_key( $key );
|
||||
$value = isset( $_POST[ $field_key ] ) ? $_POST[ $field_key ] : null;
|
||||
$post_data = empty( $post_data ) ? $_POST : $post_data;
|
||||
$value = isset( $post_data[ $field_key ] ) ? $post_data[ $field_key ] : null;
|
||||
|
||||
// Look for a validate_FIELDID_field method for special handling
|
||||
if ( is_callable( array( $this, 'validate_' . $key . '_field' ) ) ) {
|
||||
|
@ -121,15 +125,20 @@ abstract class WC_Settings_API {
|
|||
/**
|
||||
* Processes and saves options.
|
||||
* If there is an error thrown, will continue to save and validate fields, but will leave the erroring field out.
|
||||
* @param array $post_data Defaults to $_POST but can be passed in.
|
||||
* @return bool was anything saved?
|
||||
*/
|
||||
public function process_admin_options() {
|
||||
public function process_admin_options( $post_data = array() ) {
|
||||
$this->init_settings();
|
||||
|
||||
if ( empty( $post_data ) ) {
|
||||
$post_data = $_POST;
|
||||
}
|
||||
|
||||
foreach ( $this->get_form_fields() as $key => $field ) {
|
||||
if ( 'title' !== $this->get_field_type( $field ) ) {
|
||||
try {
|
||||
$this->settings[ $key ] = $this->get_field_value( $key, $field );
|
||||
$this->settings[ $key ] = $this->get_field_value( $key, $field, $post_data );
|
||||
} catch ( Exception $e ) {
|
||||
$this->add_error( $e->getMessage() );
|
||||
}
|
||||
|
@ -147,13 +156,20 @@ abstract class WC_Settings_API {
|
|||
$this->errors[] = $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get admin error messages.
|
||||
*/
|
||||
public function get_errors() {
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display admin error messages.
|
||||
*/
|
||||
public function display_errors() {
|
||||
if ( count( $this->errors ) > 0 ) {
|
||||
if ( $this->get_errors() ) {
|
||||
echo '<div id="woocommerce_errors" class="error notice is-dismissible">';
|
||||
foreach ( $this->errors as $error ) {
|
||||
foreach ( $this->get_errors() as $error ) {
|
||||
echo '<p>' . wp_kses_post( $error ) . '</p>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
|
|
@ -22,6 +22,7 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
|||
* - shipping-zones Shipping zone functionality + instances
|
||||
* - instance-settings Instance settings screens.
|
||||
* - settings Non-instance settings screens. Enabled by default for BW compatibility with methods before instances existed.
|
||||
* - instance-settings-modal Allows the instance settings to be loaded within a modal in the zones UI.
|
||||
* @var array
|
||||
*/
|
||||
public $supports = array( 'settings' );
|
||||
|
@ -355,18 +356,29 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
|||
return $this->instance_id ? $this->supports( 'instance-settings' ) : $this->supports( 'settings' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return admin options as a html string.
|
||||
* @return string
|
||||
*/
|
||||
public function get_admin_options_html() {
|
||||
if ( $this->instance_id ) {
|
||||
$settings_html = $this->generate_settings_html( $this->get_instance_form_fields(), false );
|
||||
} else {
|
||||
$settings_html = $this->generate_settings_html( $this->get_form_fields(), false );
|
||||
}
|
||||
|
||||
return '<table class="form-table">' . $settings_html . '</table>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the shipping settings screen.
|
||||
*/
|
||||
public function admin_options() {
|
||||
if ( $this->instance_id ) {
|
||||
echo wp_kses_post( wpautop( $this->get_method_description() ) );
|
||||
echo '<table class="form-table">' . $this->generate_settings_html( $this->get_instance_form_fields(), false ) . '</table>';
|
||||
} else {
|
||||
if ( ! $this->instance_id ) {
|
||||
echo '<h2>' . esc_html( $this->get_method_title() ) . '</h2>';
|
||||
echo wp_kses_post( wpautop( $this->get_method_description() ) );
|
||||
echo '<table class="form-table">' . $this->generate_settings_html( $this->get_form_fields(), false ) . '</table>';
|
||||
}
|
||||
echo wp_kses_post( wpautop( $this->get_method_description() ) );
|
||||
echo $this->get_admin_options_html();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -450,16 +462,21 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
|
|||
* Processes and saves options.
|
||||
* If there is an error thrown, will continue to save and validate fields, but will leave the erroring field out.
|
||||
* @since 2.6.0
|
||||
* @param array $post_data Defaults to $_POST but can be passed in.
|
||||
* @return bool was anything saved?
|
||||
*/
|
||||
public function process_admin_options() {
|
||||
public function process_admin_options( $post_data = array() ) {
|
||||
if ( $this->instance_id ) {
|
||||
$this->init_instance_settings();
|
||||
|
||||
if ( empty( $post_data ) ) {
|
||||
$post_data = $_POST;
|
||||
}
|
||||
|
||||
foreach ( $this->get_instance_form_fields() as $key => $field ) {
|
||||
if ( 'title' !== $this->get_field_type( $field ) ) {
|
||||
try {
|
||||
$this->instance_settings[ $key ] = $this->get_field_value( $key, $field );
|
||||
$this->instance_settings[ $key ] = $this->get_field_value( $key, $field, $post_data );
|
||||
} catch ( Exception $e ) {
|
||||
$this->add_error( $e->getMessage() );
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ class WC_Admin_Assets {
|
|||
wp_register_script( 'wc-settings-tax', WC()->plugin_url() . '/assets/js/admin/settings-views-html-settings-tax' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-blockui' ), WC_VERSION );
|
||||
wp_register_script( 'wc-backbone-modal', WC()->plugin_url() . '/assets/js/admin/backbone-modal' . $suffix . '.js', array( 'underscore', 'backbone', 'wp-util' ), WC_VERSION );
|
||||
wp_register_script( 'wc-shipping-zones', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zones' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-enhanced-select', 'wc-backbone-modal' ), WC_VERSION );
|
||||
wp_register_script( 'wc-shipping-zone-methods', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zone-methods' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable' ), WC_VERSION );
|
||||
wp_register_script( 'wc-shipping-zone-methods', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zone-methods' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-backbone-modal' ), WC_VERSION );
|
||||
wp_register_script( 'wc-shipping-classes', WC()->plugin_url() . '/assets/js/admin/wc-shipping-classes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone' ), WC_VERSION );
|
||||
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), '3.5.4' );
|
||||
wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'select2' ), WC_VERSION );
|
||||
|
|
|
@ -212,6 +212,7 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
|||
'wc_shipping_zones_nonce' => wp_create_nonce( 'wc_shipping_zones_nonce' ),
|
||||
'strings' => array(
|
||||
'unload_confirmation_msg' => __( 'Your changed data will be lost if you leave this page without saving.', 'woocommerce' ),
|
||||
'save_changes_prompt' => __( 'Do you wish to save your changes first? Your changed data will be discarded if you choose to cancel.', 'woocommerce' ),
|
||||
'save_failed' => __( 'Your changes were not saved. Please retry.', 'woocommerce' ),
|
||||
'add_method_failed' => __( 'Shipping method could not be added. Please retry.', 'woocommerce' ),
|
||||
'yes' => __( 'Yes', 'woocommerce' ),
|
||||
|
@ -241,8 +242,6 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
|||
'strings' => array(
|
||||
'unload_confirmation_msg' => __( 'Your changed data will be lost if you leave this page without saving.', 'woocommerce' ),
|
||||
'save_failed' => __( 'Your changes were not saved. Please retry.', 'woocommerce' ),
|
||||
'no_methods' => '<a href="#" class="add_shipping_method button">' . __( 'Add Shipping Method', 'woocommerce' ) . '</a>',
|
||||
'add_another_method' => '<a href="#" class="add_shipping_method button">' . __( 'Add Shipping Method', 'woocommerce' ) . '</a>'
|
||||
),
|
||||
) );
|
||||
wp_enqueue_script( 'wc-shipping-zones' );
|
||||
|
|
|
@ -5,11 +5,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
?>
|
||||
|
||||
<h2><?php _e( 'Shipping Methods', 'woocommerce' ); ?> (<?php echo esc_html( $zone->get_zone_name() ); ?>) <?php echo wc_back_link( __( 'Return to Shipping Zones', 'woocommerce' ), admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ); ?></h2>
|
||||
<p><?php _e( 'The following Shipping Methods apply to customers with shipping addresses within this zone.', 'woocommerce' ); ?><p>
|
||||
<p><?php _e( 'The following shipping methods apply to customers with shipping addresses within this zone.', 'woocommerce' ); ?><p>
|
||||
<table class="wc-shipping-zone-methods widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="wc-shipping-zone-method-sort"> </th>
|
||||
<th class="wc-shipping-zone-method-sort"><?php echo wc_help_tip( __( 'Drag and drop to re-order your shipping methods. This is the order in which they will display during checkout.', 'woocommerce' ) ); ?></th>
|
||||
<th class="wc-shipping-zone-method-title"><?php esc_html_e( 'Title', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-method-type"><?php esc_html_e( 'Type', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-method-enabled"><?php esc_html_e( 'Enabled', 'woocommerce' ); ?></th>
|
||||
|
@ -31,9 +31,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="submit" class="button wc-shipping-zone-add-method" value="<?php esc_attr_e( 'Add Shipping Method', 'woocommerce' ); ?>" />
|
||||
<input type="submit" class="button wc-shipping-zone-add-method" value="<?php esc_attr_e( 'Add shipping method', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
<input type="submit" name="save" class="button button-primary wc-shipping-zone-method-save" value="<?php esc_attr_e( 'Save Shipping Methods', 'woocommerce' ); ?>" disabled />
|
||||
<input type="submit" name="save" class="button button-primary wc-shipping-zone-method-save" value="<?php esc_attr_e( 'Save shipping methods', 'woocommerce' ); ?>" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
@ -43,9 +43,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<script type="text/html" id="tmpl-wc-shipping-zone-method-row-blank">
|
||||
<tr>
|
||||
<td class="wc-shipping-zone-method-blank-state" colspan="6">
|
||||
<p class="main"><?php _e( 'Add Shipping Methods to this zone', 'woocommerce' ); ?></p>
|
||||
<p><?php _e( 'You can add multiple Shipping Methods within this zone. Only customers within the zone will see them.', 'woocommerce' ); ?></p>
|
||||
<p><?php _e( 'Choose a method from the dropdown below and click "Add Shipping Method" to get started.', 'woocommerce' ); ?></p>
|
||||
<p class="main"><?php _e( 'Add shipping methods to this zone', 'woocommerce' ); ?></p>
|
||||
<p><?php _e( 'You can add multiple shipping methods within this zone. Only customers within the zone will see them.', 'woocommerce' ); ?></p>
|
||||
<p><?php _e( 'Choose a method from the dropdown below and click "Add shipping method" to get started.', 'woocommerce' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
@ -62,3 +62,30 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-wc-modal-shipping-method-settings">
|
||||
<div class="wc-backbone-modal wc-backbone-modal-shipping-method-settings">
|
||||
<div class="wc-backbone-modal-content">
|
||||
<section class="wc-backbone-modal-main" role="main">
|
||||
<header class="wc-backbone-modal-header">
|
||||
<h1><?php echo esc_html( sprintf( __( '%s Settings', 'Shipping Method Settings', 'woocommerce' ), '{{{ data.method.method_title }}}' ) ); ?></h1>
|
||||
<button class="modal-close modal-close-link dashicons dashicons-no-alt">
|
||||
<span class="screen-reader-text"><?php _e( 'Close modal panel', 'woocommerce' ); ?></span>
|
||||
</button>
|
||||
</header>
|
||||
<article class="wc-modal-shipping-method-settings">
|
||||
<form action="" method="post">
|
||||
{{{ data.method.settings_html }}}
|
||||
<input type="hidden" name="instance_id" value="{{{ data.instance_id }}}" />
|
||||
</form>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" class="button button-primary button-large"><?php _e( 'Save changes', 'woocommerce' ); ?></button>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wc-backbone-modal-backdrop modal-close"></div>
|
||||
</script>
|
||||
|
|
|
@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
}
|
||||
?>
|
||||
|
||||
<h2><?php _e( 'Shipping Zones', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'A Shipping Zone is a group of regions that can be assigned different Shipping Methods & rates.', 'woocommerce' ) . ' ' . __( 'WooCommerce will automatically choose the correct Shipping Zone based on your customer‘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( __( 'A shipping zone is a geographic region where a certain set of shipping methods and rates apply.', 'woocommerce' ) . ' ' . __( 'WooCommerce will automatically choose the correct shipping zone based on your customer‘s shipping address and present the shipping methods within that zone to them.', 'woocommerce' ) ); ?></h2>
|
||||
|
||||
<table class="wc-shipping-zones widefat">
|
||||
<thead>
|
||||
|
@ -19,8 +19,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<a class="button button-secondary wc-shipping-zone-add" href="#"><?php esc_html_e( 'Add Shipping Zone', 'woocommerce' ); ?></a>
|
||||
<input type="submit" name="save" class="button button-primary wc-shipping-zone-save" value="<?php esc_attr_e( 'Save Shipping Zones', 'woocommerce' ); ?>" disabled />
|
||||
<a class="button button-secondary wc-shipping-zone-add" href="#"><?php esc_html_e( 'Add shipping zone', 'woocommerce' ); ?></a>
|
||||
<input type="submit" name="save" class="button button-primary wc-shipping-zone-save" value="<?php esc_attr_e( 'Save shipping zones', 'woocommerce' ); ?>" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
@ -31,27 +31,25 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<td class="wc-shipping-zone-name">
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=0' ) ); ?>"><?php esc_html_e( 'Rest of the World', 'woocommerce' ); ?></a>
|
||||
<div class="row-actions">
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}"><?php _e( 'Edit Shipping Methods', 'woocommerce' ); ?></a>
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}"><?php _e( 'Edit shipping methods', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-region"><?php esc_html_e( 'Shipping Methods added here will apply to shipping addresses that aren‘t included in any other Shipping Zone.', 'woocommerce' ); ?></td>
|
||||
<td class="wc-shipping-zone-region"><?php esc_html_e( 'Shipping Methods added here will apply to shipping addresses that aren‘t included in any other shipping zone.', 'woocommerce' ); ?></td>
|
||||
<td class="wc-shipping-zone-methods">
|
||||
<?php
|
||||
$worldwide = new WC_Shipping_Zone( 0 );
|
||||
$methods = $worldwide->get_shipping_methods();
|
||||
<ul>
|
||||
<?php
|
||||
$worldwide = new WC_Shipping_Zone( 0 );
|
||||
$methods = $worldwide->get_shipping_methods();
|
||||
|
||||
if ( ! $methods ) {
|
||||
echo '<ul><li><a href="#" class="add_shipping_method button">' . __( 'Add Shipping Method', 'woocommerce' ) . '</a></li></ul>';
|
||||
} else {
|
||||
echo '<ul>';
|
||||
foreach ( $methods as $method ) {
|
||||
$class_name = 'yes' === $method->enabled ? 'method_enabled' : 'method_disabled';
|
||||
echo '<li><a href="admin.php?page=wc-settings&tab=shipping&instance_id=' . absint( $method->instance_id ) . '" class="' . esc_attr( $class_name ) . '">' . esc_html( $method->get_title() ) . '</a></li>';
|
||||
if ( $methods ) {
|
||||
foreach ( $methods as $method ) {
|
||||
$class_name = 'yes' === $method->enabled ? 'method_enabled' : 'method_disabled';
|
||||
echo '<li class="wc-shipping-zone-method"><a href="admin.php?page=wc-settings&tab=shipping&instance_id=' . absint( $method->instance_id ) . '" class="' . esc_attr( $class_name ) . '">' . esc_html( $method->get_title() ) . '</a></li>';
|
||||
}
|
||||
}
|
||||
echo '<li><a href="#" class="add_shipping_method button">' . __( 'Add Shipping Method', 'woocommerce' ) . '</a></li>';
|
||||
echo '</ul>';
|
||||
}
|
||||
?>
|
||||
?>
|
||||
<li class="wc-shipping-zone-methods-add-row"><a href="#" class="add_shipping_method button" data-tip="<?php esc_attr_e( 'Save changes to continue adding shipping methods to this zone.', 'woocommerce' ); ?>"><?php _e( 'Add shipping method', 'woocommerce' ); ?></a></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-actions"></td>
|
||||
</tr>
|
||||
|
@ -61,10 +59,15 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<script type="text/html" id="tmpl-wc-shipping-zone-row-blank">
|
||||
<tr>
|
||||
<td class="wc-shipping-zones-blank-state" colspan="5">
|
||||
<p class="main"><?php _e( 'A Shipping Zone is a group of regions that can be assigned different Shipping Methods & rates.', 'woocommerce' ); ?></p>
|
||||
<p><?php _e( 'You can add as many Shipping Zones as you want, for example you could have "Local", "Domestic", and "Europe" zones.', 'woocommerce' ); ?></p>
|
||||
<p><?php _e( 'Once a Shipping Zone has been added, you can add one or more Shipping Methods to it. Customers will only see Shipping Methods that apply to their address.', 'woocommerce' ); ?></p>
|
||||
<a class="button button-primary wc-shipping-zone-add"><?php _e( 'Add Shipping Zone', 'woocommerce' ); ?></a>
|
||||
<p class="main"><?php _e( 'A shipping zone is a geographic region where a certain set of shipping methods and rates apply.', 'woocommerce' ); ?></p>
|
||||
<p><?php _e( 'For example:', 'woocommerce' ); ?></p>
|
||||
<ul>
|
||||
<li><?php _e( 'Local Zone = California ZIP 90210 = Local pickup', 'woocommerce' ); ?>
|
||||
<li><?php _e( 'US Domestic Zone = All US states = Flat rate shipping', 'woocommerce' ); ?>
|
||||
<li><?php _e( 'Europe Zone = Any country in Europe = Flat rate shipping', 'woocommerce' ); ?>
|
||||
</ul>
|
||||
<p><?php _e( 'Add as many zones as you need – customers will only see the methods available for their address.', 'woocommerce' ); ?></p>
|
||||
<a class="button button-primary wc-shipping-zone-add"><?php _e( 'Add shipping zone', 'woocommerce' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
@ -76,7 +79,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<div class="view">
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}">{{ data.zone_name }}</a>
|
||||
<div class="row-actions">
|
||||
<a class="wc-shipping-zone-edit" href="#"><?php _e( 'Edit Zone', 'woocommerce' ); ?></a> | <a href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}"><?php _e( 'Edit Shipping Methods', 'woocommerce' ); ?></a>
|
||||
<a class="wc-shipping-zone-edit" href="#"><?php _e( 'Edit Zone', 'woocommerce' ); ?></a> | <a href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}"><?php _e( 'Edit shipping methods', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="edit"><input type="text" name="zone_name[{{ data.zone_id }}]" data-attribute="zone_name" value="{{ data.zone_name }}" placeholder="<?php esc_attr_e( 'Zone Name', 'woocommerce' ); ?>" /></div>
|
||||
|
@ -111,10 +114,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</div>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-methods">
|
||||
<div class="view">
|
||||
<ul></ul>
|
||||
<div>
|
||||
<ul>
|
||||
<li class="wc-shipping-zone-methods-add-row"><a href="#" class="add_shipping_method button" data-tip="<?php esc_attr_e( 'Save changes to continue adding shipping methods to this zone.', 'woocommerce' ); ?>"><?php _e( 'Add shipping method', 'woocommerce' ); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="edit"><?php _e( '<a href="#" class="wc-shipping-zone-save-changes">Save changes</a> to start adding Shipping Methods to this zone.', 'woocommerce' ); ?></div>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<a class="wc-shipping-zone-delete tips" data-tip="<?php _e( 'Delete', 'woocommerce' ); ?>" href="#"><?php _e( 'Delete', 'woocommerce' ); ?></a>
|
||||
|
@ -127,7 +131,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<div class="wc-backbone-modal-content">
|
||||
<section class="wc-backbone-modal-main" role="main">
|
||||
<header class="wc-backbone-modal-header">
|
||||
<h1><?php _e( 'Add Shipping Method', 'woocommerce' ); ?></h1>
|
||||
<h1><?php _e( 'Add shipping method', 'woocommerce' ); ?></h1>
|
||||
<button class="modal-close modal-close-link dashicons dashicons-no-alt">
|
||||
<span class="screen-reader-text"><?php _e( 'Close modal panel', 'woocommerce' ); ?></span>
|
||||
</button>
|
||||
|
@ -151,7 +155,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" class="button button-primary button-large"><?php _e( 'Add Shipping Method', 'woocommerce' ); ?></button>
|
||||
<button id="btn-ok" class="button button-primary button-large"><?php _e( 'Add shipping method', 'woocommerce' ); ?></button>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
|
|
|
@ -93,7 +93,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
} else {
|
||||
?>
|
||||
<p class="submit">
|
||||
<?php submit_button( __( 'Save Changes', 'woocommerce' ), 'primary', 'update_api_key', false ); ?>
|
||||
<?php submit_button( __( 'Save changes', 'woocommerce' ), 'primary', 'update_api_key', false ); ?>
|
||||
<a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'revoke-key' => $key_id ), admin_url( 'admin.php?page=wc-settings&tab=api§ion=keys' ) ), 'revoke' ) ); ?>"><?php _e( 'Revoke Key', 'woocommerce' ); ?></a>
|
||||
</p>
|
||||
<?php
|
||||
|
|
|
@ -60,6 +60,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tbody>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'woocommerce' ) ?>" />
|
||||
<input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ) ?>" />
|
||||
</p>
|
||||
</form>
|
||||
|
|
|
@ -10,14 +10,14 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<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( 'A Shipping Zone is a group of regions that can be assigned different Shipping Methods & 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="main"><strong><?php _e( 'New feature: shipping zones!', 'woocommerce' ); ?></strong></p>
|
||||
<p><?php _e( 'A shipping zone is a group of regions that can be assigned different 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>
|
||||
<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>
|
||||
<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>
|
||||
|
|
|
@ -145,6 +145,7 @@ class WC_AJAX {
|
|||
'shipping_zones_save_changes' => false,
|
||||
'shipping_zone_add_method' => false,
|
||||
'shipping_zone_methods_save_changes' => false,
|
||||
'shipping_zone_methods_save_settings' => false,
|
||||
'shipping_classes_save_changes' => false,
|
||||
);
|
||||
|
||||
|
@ -3207,6 +3208,38 @@ class WC_AJAX {
|
|||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save method settings
|
||||
*/
|
||||
public static function shipping_zone_methods_save_settings() {
|
||||
if ( ! isset( $_POST['wc_shipping_zones_nonce'], $_POST['instance_id'], $_POST['data'] ) ) {
|
||||
wp_send_json_error( 'missing_fields' );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! wp_verify_nonce( $_POST['wc_shipping_zones_nonce'], 'wc_shipping_zones_nonce' ) ) {
|
||||
wp_send_json_error( 'bad_nonce' );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'manage_woocommerce' ) ) {
|
||||
wp_send_json_error( 'missing_capabilities' );
|
||||
exit;
|
||||
}
|
||||
|
||||
$instance_id = absint( $_POST['instance_id'] );
|
||||
$zone = WC_Shipping_Zones::get_zone_by( 'instance_id', $instance_id );
|
||||
$shipping_method = WC_Shipping_Zones::get_shipping_method( $instance_id );
|
||||
$data = $_POST['data'];
|
||||
|
||||
$shipping_method->process_admin_options( $data );
|
||||
|
||||
wp_send_json_success( array(
|
||||
'methods' => $zone->get_shipping_methods(),
|
||||
'errors' => $shipping_method->get_errors(),
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle submissions from assets/js/wc-shipping-classes.js Backbone model.
|
||||
*/
|
||||
|
|
|
@ -238,9 +238,10 @@ class WC_Shipping_Zone extends WC_Data {
|
|||
|
||||
// Let's make sure that we have an instance before setting its attributes
|
||||
if ( is_object( $methods[ $raw_method->instance_id ] ) ) {
|
||||
$methods[ $raw_method->instance_id ]->method_order = absint( $raw_method->method_order );
|
||||
$methods[ $raw_method->instance_id ]->enabled = $raw_method->is_enabled ? 'yes' : 'no';
|
||||
$methods[ $raw_method->instance_id ]->has_settings = $methods[ $raw_method->instance_id ]->has_settings();
|
||||
$methods[ $raw_method->instance_id ]->method_order = absint( $raw_method->method_order );
|
||||
$methods[ $raw_method->instance_id ]->enabled = $raw_method->is_enabled ? 'yes' : 'no';
|
||||
$methods[ $raw_method->instance_id ]->has_settings = $methods[ $raw_method->instance_id ]->has_settings();
|
||||
$methods[ $raw_method->instance_id ]->settings_html = $methods[ $raw_method->instance_id ]->supports( 'instance-settings-modal' ) ? $methods[ $raw_method->instance_id ]->get_admin_options_html() : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -411,6 +412,7 @@ class WC_Shipping_Zone extends WC_Data {
|
|||
$instance_id = 0;
|
||||
$wc_shipping = WC_Shipping::instance();
|
||||
$allowed_classes = $wc_shipping->get_shipping_method_class_names();
|
||||
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}woocommerce_shipping_zone_methods WHERE zone_id = %d", $this->get_zone_id() ) );
|
||||
|
||||
if ( in_array( $type, array_keys( $allowed_classes ) ) ) {
|
||||
$wpdb->insert(
|
||||
|
@ -418,7 +420,7 @@ class WC_Shipping_Zone extends WC_Data {
|
|||
array(
|
||||
'method_id' => $type,
|
||||
'zone_id' => $this->get_zone_id(),
|
||||
'method_order' => 0
|
||||
'method_order' => ( $count + 1 )
|
||||
),
|
||||
array(
|
||||
'%s',
|
||||
|
|
|
@ -529,16 +529,20 @@ class WC_Email extends WC_Settings_API {
|
|||
/**
|
||||
* Admin Panel Options Processing.
|
||||
*/
|
||||
public function process_admin_options() {
|
||||
public function process_admin_options( $post_data = array() ) {
|
||||
if ( empty( $post_data ) ) {
|
||||
$post_data = $_POST;
|
||||
}
|
||||
|
||||
// Save regular options
|
||||
parent::process_admin_options();
|
||||
parent::process_admin_options( $post_data );
|
||||
|
||||
// Save templates
|
||||
if ( isset( $_POST['template_html_code'] ) ) {
|
||||
$this->save_template( $_POST['template_html_code'], $this->template_html );
|
||||
$this->save_template( $post_data['template_html_code'], $this->template_html );
|
||||
}
|
||||
if ( isset( $_POST['template_plain_code'] ) ) {
|
||||
$this->save_template( $_POST['template_plain_code'], $this->template_plain );
|
||||
$this->save_template( $post_data['template_plain_code'], $this->template_plain );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(a){function b(){var b=a("form.checkout, form#order_review, form#add_payment_method");if((a("#payment_method_simplify_commerce").is(":checked")&&a("#wc-simplify_commerce-new").is(":checked")||"1"===a("#woocommerce_add_payment_method").val())&&0===a("input.simplify-token").length){b.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var d=a("#simplify_commerce-card-number").val(),e=a("#simplify_commerce-card-cvc").val(),f=a.payment.cardExpiryVal(a("#simplify_commerce-card-expiry").val()),g=b.find("#billing_address_1").val(),h=b.find("#billing_address_2").val(),i=b.find("#billing_country").val(),j=b.find("#billing_state").val(),k=b.find("#billing_city").val(),l=b.find("#billing_postcode").val();return d=d.replace(/\s/g,""),SimplifyCommerce.generateToken({key:Simplify_commerce_params.key,card:{number:d,cvc:e,expMonth:f.month,expYear:f.year-2e3,addressLine1:g,addressLine2:h,addressCountry:i,addressState:j,addressZip:l,addressCity:k}},c),!1}return!0}function c(b){var c=a("form.checkout, form#order_review, form#add_payment_method"),d=a("#wc-simplify_commerce-cc-form");if(b.error){if(a(".woocommerce-error, .simplify-token",d).remove(),c.unblock(),"validation"===b.error.code){for(var e=b.error.fieldErrors,f=e.length,g="",h=0;f>h;h++)g+="<li>"+Simplify_commerce_params[e[h].field]+" "+Simplify_commerce_params.is_invalid+" - "+e[h].message+".</li>";d.prepend('<ul class="woocommerce-error">'+g+"</ul>")}}else d.append('<input type="hidden" class="simplify-token" name="simplify_token" value="'+b.id+'"/>'),c.submit()}a(function(){a(document.body).on("checkout_error",function(){a(".simplify-token").remove()}),a("form.checkout").on("checkout_place_order_simplify_commerce",function(){return b()}),a("form#order_review").on("submit",function(){return b()}),a("form#add_payment_method").on("submit",function(){return b()}),a("form.checkout, form#order_review, form#add_payment_method").on("change","#wc-simplify_commerce-cc-form input",function(){a(".simplify-token").remove()})})}(jQuery);
|
||||
!function(a){function b(){var b=a("form.checkout, form#order_review, form#add_payment_method");if((a("#payment_method_simplify_commerce").is(":checked")&&a("#wc-simplify_commerce-new").is(":checked")||"1"===a("#woocommerce_add_payment_method").val())&&0===a("input.simplify-token").length){b.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var d=a("#simplify_commerce-card-number").val(),e=a("#simplify_commerce-card-cvc").val(),f=a.payment.cardExpiryVal(a("#simplify_commerce-card-expiry").val()),g=b.find("#billing_address_1").val(),h=b.find("#billing_address_2").val(),i=b.find("#billing_country").val(),j=b.find("#billing_state").val(),k=b.find("#billing_city").val(),l=b.find("#billing_postcode").val();return l=l.replace(/-/g,""),d=d.replace(/\s/g,""),SimplifyCommerce.generateToken({key:Simplify_commerce_params.key,card:{number:d,cvc:e,expMonth:f.month,expYear:f.year-2e3,addressLine1:g,addressLine2:h,addressCountry:i,addressState:j,addressZip:l,addressCity:k}},c),!1}return!0}function c(b){var c=a("form.checkout, form#order_review, form#add_payment_method"),d=a("#wc-simplify_commerce-cc-form");if(b.error){if(a(".woocommerce-error, .simplify-token",d).remove(),c.unblock(),"validation"===b.error.code){for(var e=b.error.fieldErrors,f=e.length,g="",h=0;f>h;h++)g+="<li>"+Simplify_commerce_params[e[h].field]+" "+Simplify_commerce_params.is_invalid+" - "+e[h].message+".</li>";d.prepend('<ul class="woocommerce-error">'+g+"</ul>")}}else d.append('<input type="hidden" class="simplify-token" name="simplify_token" value="'+b.id+'"/>'),c.submit()}a(function(){a(document.body).on("checkout_error",function(){a(".simplify-token").remove()}),a("form.checkout").on("checkout_place_order_simplify_commerce",function(){return b()}),a("form#order_review").on("submit",function(){return b()}),a("form#add_payment_method").on("submit",function(){return b()}),a("form.checkout, form#order_review, form#add_payment_method").on("change","#wc-simplify_commerce-cc-form input",function(){a(".simplify-token").remove()})})}(jQuery);
|
|
@ -26,7 +26,8 @@ class WC_Shipping_Flat_Rate extends WC_Shipping_Method {
|
|||
$this->method_description = __( 'Lets you charge a fixed rate for shipping.', 'woocommerce' );
|
||||
$this->supports = array(
|
||||
'shipping-zones',
|
||||
'instance-settings'
|
||||
'instance-settings',
|
||||
'instance-settings-modal',
|
||||
);
|
||||
$this->init();
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method {
|
|||
$this->method_description = __( 'Free Shipping is a special method which can be triggered with coupons and minimum spends.', 'woocommerce' );
|
||||
$this->supports = array(
|
||||
'shipping-zones',
|
||||
'instance-settings'
|
||||
'instance-settings',
|
||||
'instance-settings-modal',
|
||||
);
|
||||
$this->title = $this->get_option( 'title' );
|
||||
$this->min_amount = $this->get_option( 'min_amount', 0 );
|
||||
|
|
|
@ -25,7 +25,8 @@ class WC_Shipping_Local_Pickup extends WC_Shipping_Method {
|
|||
$this->method_description = __( 'Allow customers to pick up orders themselves. By default, when using local pickup store base taxes will apply regardless of customer address.', 'woocommerce' );
|
||||
$this->supports = array(
|
||||
'shipping-zones',
|
||||
'instance-settings'
|
||||
'instance-settings',
|
||||
'instance-settings-modal',
|
||||
);
|
||||
$this->init();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue