Setup wizard: Add function to display service rows
- Update style - Use new reusable class 'wc-wizard-services' instead of 'wc-wizard-payment-gateways' - Update JS script for toggling checkboxes - Update payment gateways: in-cart and manual - Update POST variable names in save function
This commit is contained in:
parent
39028f082a
commit
1eda1a026d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -466,116 +466,94 @@ body {
|
|||
}
|
||||
}
|
||||
|
||||
ul.wc-wizard-shipping-methods,
|
||||
ul.wc-wizard-payment-gateways {
|
||||
// List of services
|
||||
.wc-wizard-services {
|
||||
border: 1px solid #eee;
|
||||
border-bottom-width: 2px;
|
||||
padding: 0;
|
||||
margin: 0 0 1em;
|
||||
list-style: none outside;
|
||||
border-radius: 4px;
|
||||
|
||||
li.wc-wizard-shipping,
|
||||
li.wc-wizard-gateway {
|
||||
padding: 1.5em 1em 1em 4em;
|
||||
border-top: 1px solid #eee;
|
||||
list-style: none outside;
|
||||
cursor: pointer;
|
||||
color: #555;
|
||||
box-sizing: border-box;
|
||||
clear: both;
|
||||
p {
|
||||
margin: 0 0 1em 0;
|
||||
padding: 0;
|
||||
font-size: 1em;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
border-top: 0;
|
||||
.wc-wizard-service-item {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
padding: 2em 0;
|
||||
border-top: 1px solid #eee;
|
||||
|
||||
&:first-child {
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.payment-gateway-fee {
|
||||
color: #b5b5b5;
|
||||
}
|
||||
|
||||
.wc-wizard-service-name {
|
||||
flex-basis: 0;
|
||||
min-width: 175px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
padding: 0 1em;
|
||||
|
||||
img {
|
||||
max-width: 75px;
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
&.featured {
|
||||
width: 50%;
|
||||
float: left;
|
||||
clear: none;
|
||||
border-right: 1px solid #eee;
|
||||
border-top: 0;
|
||||
}
|
||||
.wc-wizard-service-description {
|
||||
flex-grow: 1;
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
&.featured-row-last {
|
||||
border-right: 0;
|
||||
}
|
||||
.wc-wizard-service-enable {
|
||||
flex-basis: 0;
|
||||
min-width: 75px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.wc-wizard-shipping-settings,
|
||||
.wc-wizard-gateway-settings {
|
||||
.wc-wizard-service-toggle {
|
||||
height: 16px;
|
||||
width: 32px;
|
||||
border: 2px solid #935687;
|
||||
background-color: #935687;
|
||||
display: inline-block;
|
||||
text-indent: -9999px;
|
||||
border-radius: 10em;
|
||||
position: relative;
|
||||
|
||||
input[type=checkbox] {
|
||||
display: none;
|
||||
margin-bottom: 0;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
&.checked {
|
||||
background: #f7f1f6;
|
||||
|
||||
.wc-wizard-shipping-settings,
|
||||
.wc-wizard-gateway-settings {
|
||||
display: table;
|
||||
}
|
||||
&:before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: #fff;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
.wc-wizard-shipping-description,
|
||||
.wc-wizard-gateway-description {
|
||||
font-style: italic;
|
||||
&.disabled {
|
||||
border-color: #999;
|
||||
background-color: #999;
|
||||
|
||||
p {
|
||||
margin: 0 0 0.5em;
|
||||
}
|
||||
|
||||
p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.wc-wizard-shipping-enable,
|
||||
.wc-wizard-gateway-enable {
|
||||
margin: 0 0 0.5em;
|
||||
|
||||
label {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
vertical-align: middle;
|
||||
|
||||
img {
|
||||
max-height: 2em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
label::before {
|
||||
content: '';
|
||||
background: #fff;
|
||||
border: 2px solid #eee;
|
||||
display: inline-block;
|
||||
float: left;
|
||||
vertical-align: middle;
|
||||
width: 2em;
|
||||
height: 2em;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
line-height: 1.8em;
|
||||
text-align: center;
|
||||
margin: 0 1em 0 -3em;
|
||||
border-radius: 4px;
|
||||
}
|
||||
input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
|
||||
&:checked + label::before {
|
||||
content: '\f147';
|
||||
font-family: 'dashicons';
|
||||
color: #fff;
|
||||
border-color: #a46497;
|
||||
background: #a46497;
|
||||
}
|
||||
|
||||
&:focus + label {
|
||||
outline: 1px solid #ddd; /* focus style */
|
||||
}
|
||||
&:before {
|
||||
right: auto;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(t){function e(e,a,n){t('<div class="chart-tooltip">'+n+"</div>").css({top:a-16,left:e+20}).appendTo("body").fadeIn(200)}var a=null,n=null;t(".chart-placeholder").bind("plothover",function(i,r,o){if(o){if((a!==o.dataIndex||n!==o.seriesIndex)&&(a=o.dataIndex,n=o.seriesIndex,t(".chart-tooltip").remove(),o.series.points.show||o.series.enable_tooltip)){var s=o.series.data[o.dataIndex][1],l="";o.series.prepend_label&&(l=l+o.series.label+": "),o.series.prepend_tooltip&&(l+=o.series.prepend_tooltip),l+=s,o.series.append_tooltip&&(l+=o.series.append_tooltip),o.series.pie.show?e(r.pageX,r.pageY,l):e(o.pageX,o.pageY,l)}}else t(".chart-tooltip").remove(),a=null}),t(".wc_sparkline.bars").each(function(){var e={grid:{show:!1}},a=[{data:t(this).data("sparkline"),color:t(this).data("color"),bars:{fillColor:t(this).data("color"),fill:!0,show:!0,lineWidth:1,barWidth:t(this).data("barwidth"),align:"center"},shadowSize:0}];t.plot(t(this),a,e)}),t(".wc_sparkline.lines").each(function(){var e={grid:{show:!1}},a=[{data:t(this).data("sparkline"),color:t(this).data("color"),lines:{fill:!1,show:!0,lineWidth:1,align:"center"},shadowSize:0}];t.plot(t(this),a,e)});var i=t(".range_datepicker").datepicker({changeMonth:!0,changeYear:!0,defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,minDate:"-20Y",maxDate:"+0D",showButtonPanel:!0,showOn:"focus",buttonImageOnly:!0,onSelect:function(){var e=t(this).is(".from")?"minDate":"maxDate",a=t(this).datepicker("getDate");i.not(this).datepicker("option",e,a)}});"undefined"==typeof document.createElement("a").download&&t(".export_csv").hide(),t(".export_csv").click(function(){var e=t(this).data("exclude_series")||"";e=e.toString(),e=e.split(",");var a,n,i,r=t(this).data("xaxes"),o=t(this).data("groupby"),s=t(this).data("index_type"),l="data:application/csv;charset=utf-8,";if("table"===t(this).data("export"))t(this).offsetParent().find("thead tr,tbody tr").each(function(){t(this).find("th, td").each(function(){var e=t(this).text();e=e.replace("[?]","").replace("#",""),l+='"'+e+'",'}),l=l.substring(0,l.length-1),l+="\n"}),t(this).offsetParent().find("tfoot tr").each(function(){t(this).find("th, td").each(function(){var e=t(this).text();if(e=e.replace("[?]","").replace("#",""),l+='"'+e+'",',t(this).attr("colspan")>0)for(p=1;p<t(this).attr("colspan");p++)l+='"",'}),l=l.substring(0,l.length-1),l+="\n"});else{if(!window.main_chart)return!1;var h=window.main_chart.getData(),d=[];for(l+='"'+r+'",',t.each(h,function(a,n){e&&-1!==t.inArray(a.toString(),e)||d.push(n)}),a=0;a<d.length;++a)l+='"'+d[a].label+'",';l=l.substring(0,l.length-1),l+="\n";var c={};for(a=0;a<d.length;++a)for(n=d[a].data,i=0;i<n.length;++i){c[n[i][0]]=[];for(var p=0;p<d.length;++p)c[n[i][0]].push(0)}for(a=0;a<d.length;++a)for(n=d[a].data,i=0;i<n.length;++i)c[n[i][0]][a]=n[i][1];t.each(c,function(t,e){var a=new Date(parseInt(t,10));l+="none"===s?'"'+t+'",':"day"===o?'"'+a.getUTCFullYear()+"-"+parseInt(a.getUTCMonth()+1,10)+"-"+a.getUTCDate()+'",':'"'+a.getUTCFullYear()+"-"+parseInt(a.getUTCMonth()+1,10)+'",';for(var n=0;n<e.length;++n){var i=e[n];Math.round(i)!==i&&(i=(i=parseFloat(i)).toFixed(2)),l+='"'+i+'",'}l=l.substring(0,l.length-1),l+="\n"})}return t(this).attr("href",encodeURI(l)),!0})});
|
||||
jQuery(function(t){function e(e,a,n){t('<div class="chart-tooltip">'+n+"</div>").css({top:a-16,left:e+20}).appendTo("body").fadeIn(200)}var a=null,n=null;t(".chart-placeholder").bind("plothover",function(i,r,o){if(o){if((a!==o.dataIndex||n!==o.seriesIndex)&&(a=o.dataIndex,n=o.seriesIndex,t(".chart-tooltip").remove(),o.series.points.show||o.series.enable_tooltip)){var s=o.series.data[o.dataIndex][1],l="";o.series.prepend_label&&(l=l+o.series.label+": "),o.series.prepend_tooltip&&(l+=o.series.prepend_tooltip),l+=s,o.series.append_tooltip&&(l+=o.series.append_tooltip),o.series.pie.show?e(r.pageX,r.pageY,l):e(o.pageX,o.pageY,l)}}else t(".chart-tooltip").remove(),a=null}),t(".wc_sparkline.bars").each(function(){var e={grid:{show:!1}},a=[{data:t(this).data("sparkline"),color:t(this).data("color"),bars:{fillColor:t(this).data("color"),fill:!0,show:!0,lineWidth:1,barWidth:t(this).data("barwidth"),align:"center"},shadowSize:0}];t.plot(t(this),a,e)}),t(".wc_sparkline.lines").each(function(){var e={grid:{show:!1}},a=[{data:t(this).data("sparkline"),color:t(this).data("color"),lines:{fill:!1,show:!0,lineWidth:1,align:"center"},shadowSize:0}];t.plot(t(this),a,e)});var i=t(".range_datepicker").datepicker({changeMonth:!0,changeYear:!0,defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,minDate:"-20Y",maxDate:"+1D",showButtonPanel:!0,showOn:"focus",buttonImageOnly:!0,onSelect:function(){var e=t(this).is(".from")?"minDate":"maxDate",a=t(this).datepicker("getDate");i.not(this).datepicker("option",e,a)}});"undefined"==typeof document.createElement("a").download&&t(".export_csv").hide(),t(".export_csv").click(function(){var e=t(this).data("exclude_series")||"";e=e.toString(),e=e.split(",");var a,n,i,r=t(this).data("xaxes"),o=t(this).data("groupby"),s=t(this).data("index_type"),l="data:application/csv;charset=utf-8,";if("table"===t(this).data("export"))t(this).offsetParent().find("thead tr,tbody tr").each(function(){t(this).find("th, td").each(function(){var e=t(this).text();e=e.replace("[?]","").replace("#",""),l+='"'+e+'",'}),l=l.substring(0,l.length-1),l+="\n"}),t(this).offsetParent().find("tfoot tr").each(function(){t(this).find("th, td").each(function(){var e=t(this).text();if(e=e.replace("[?]","").replace("#",""),l+='"'+e+'",',t(this).attr("colspan")>0)for(p=1;p<t(this).attr("colspan");p++)l+='"",'}),l=l.substring(0,l.length-1),l+="\n"});else{if(!window.main_chart)return!1;var h=window.main_chart.getData(),d=[];for(l+='"'+r+'",',t.each(h,function(a,n){e&&-1!==t.inArray(a.toString(),e)||d.push(n)}),a=0;a<d.length;++a)l+='"'+d[a].label+'",';l=l.substring(0,l.length-1),l+="\n";var c={};for(a=0;a<d.length;++a)for(n=d[a].data,i=0;i<n.length;++i){c[n[i][0]]=[];for(var p=0;p<d.length;++p)c[n[i][0]].push(0)}for(a=0;a<d.length;++a)for(n=d[a].data,i=0;i<n.length;++i)c[n[i][0]][a]=n[i][1];t.each(c,function(t,e){var a=new Date(parseInt(t,10));l+="none"===s?'"'+t+'",':"day"===o?'"'+a.getUTCFullYear()+"-"+parseInt(a.getUTCMonth()+1,10)+"-"+a.getUTCDate()+'",':'"'+a.getUTCFullYear()+"-"+parseInt(a.getUTCMonth()+1,10)+'",';for(var n=0;n<e.length;++n){var i=e[n];Math.round(i)!==i&&(i=(i=parseFloat(i)).toFixed(2)),l+='"'+i+'",'}l=l.substring(0,l.length-1),l+="\n"})}return t(this).attr("href",encodeURI(l)),!0})});
|
|
@ -79,21 +79,20 @@ jQuery( function( $ ) {
|
|||
return true;
|
||||
} );
|
||||
|
||||
$( '.wc-wizard-payment-gateways, .wc-wizard-shipping-methods' ).on( 'change', '.wc-wizard-gateway-enable input, .wc-wizard-shipping-enable input', function() {
|
||||
$( '.wc-wizard-services' ).on( 'change', '.wc-wizard-service-enable input', function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
$( this ).closest( 'li' ).addClass( 'checked' );
|
||||
$( this ).closest( '.wc-wizard-service-toggle' ).removeClass( 'disabled' );
|
||||
} else {
|
||||
$( this ).closest( 'li' ).removeClass( 'checked' );
|
||||
$( this ).closest( '.wc-wizard-service-toggle' ).addClass( 'disabled' );
|
||||
}
|
||||
} );
|
||||
|
||||
$( '.wc-wizard-payment-gateways, .wc-wizard-shipping-methods' ).on( 'click', 'li.wc-wizard-gateway, li.wc-wizard-shipping', function() {
|
||||
var $enabled = $( this ).find( '.wc-wizard-gateway-enable input, .wc-wizard-shipping-enable input' );
|
||||
|
||||
$enabled.prop( 'checked', ! $enabled.prop( 'checked' ) ).change();
|
||||
$( '.wc-wizard-services' ).on( 'click', '.wc-wizard-service-item', function() {
|
||||
var $checkbox = $( this ).find( '.wc-wizard-service-enable input' );
|
||||
$checkbox.prop( 'checked', ! $checkbox.prop( 'checked' ) ).change();
|
||||
} );
|
||||
|
||||
$( '.wc-wizard-payment-gateways li, .wc-wizard-shipping-methods li' ).on( 'click', 'table, a', function( e ) {
|
||||
$( '.wc-wizard-services' ).on( 'click', '.wc-wizard-service-enable input', function( e ) {
|
||||
e.stopPropagation();
|
||||
} );
|
||||
} );
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(e){var t=e.parseJSON(wc_setup_params.locale_info);e('select[name="store_location"]').change(function(){var a=e(this).val().split(":"),c=a[0],n=a[1]||!1,s=t[c],i=["thousand_sep","decimal_sep","num_decimals","currency_pos"];if(s){if(e.each(s,function(t,a){e(':input[name="'+t+'"]').val(a).change(),-1!==e.inArray(t,i)&&e(':input[name="'+t+'"]').closest("tr").hide()}),!e.isArray(s.tax_rates)){var o=[];if(n&&s.tax_rates[n]?o=o.concat(s.tax_rates[n]):s.tax_rates[""]&&(o=o.concat(s.tax_rates[""])),(o=o.concat(s.tax_rates["*"]||[])).length){var r=e("table.tax-rates tbody").empty();e.each(o,function(t,a){e("<tr>",{html:[e("<td>",{"class":"readonly",text:a.country||""}),e("<td>",{"class":"readonly",text:a.state||"*"}),e("<td>",{"class":"readonly",text:a.rate||""}),e("<td>",{"class":"readonly",text:a.name||""})]}).appendTo(r)}),e(".tax-rates").show()}else e(".tax-rates").hide()}}else e(':input[name="currency_pos"]').closest("tr").show(),e(':input[name="thousand_sep"]').closest("tr").show(),e(':input[name="decimal_sep"]').closest("tr").show(),e(':input[name="num_decimals"]').closest("tr").show(),e(".tax-rates").hide()}).change(),e('input[name="woocommerce_calc_taxes"]').change(function(){e(this).is(":checked")?(e(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").show(),e("tr.tax-rates").show()):(e(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").hide(),e("tr.tax-rates").hide())}).change(),e(".button-next").on("click",function(){return e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),!0}),e(".wc-wizard-payment-gateways, .wc-wizard-shipping-methods").on("change",".wc-wizard-gateway-enable input, .wc-wizard-shipping-enable input",function(){e(this).is(":checked")?e(this).closest("li").addClass("checked"):e(this).closest("li").removeClass("checked")}),e(".wc-wizard-payment-gateways, .wc-wizard-shipping-methods").on("click","li.wc-wizard-gateway, li.wc-wizard-shipping",function(){var t=e(this).find(".wc-wizard-gateway-enable input, .wc-wizard-shipping-enable input");t.prop("checked",!t.prop("checked")).change()}),e(".wc-wizard-payment-gateways li, .wc-wizard-shipping-methods li").on("click","table, a",function(e){e.stopPropagation()})});
|
||||
jQuery(function(e){var t=e.parseJSON(wc_setup_params.locale_info);e('select[name="store_location"]').change(function(){var a=e(this).val().split(":"),c=a[0],s=a[1]||!1,n=t[c],r=["thousand_sep","decimal_sep","num_decimals","currency_pos"];if(n){if(e.each(n,function(t,a){e(':input[name="'+t+'"]').val(a).change(),-1!==e.inArray(t,r)&&e(':input[name="'+t+'"]').closest("tr").hide()}),!e.isArray(n.tax_rates)){var i=[];if(s&&n.tax_rates[s]?i=i.concat(n.tax_rates[s]):n.tax_rates[""]&&(i=i.concat(n.tax_rates[""])),(i=i.concat(n.tax_rates["*"]||[])).length){var o=e("table.tax-rates tbody").empty();e.each(i,function(t,a){e("<tr>",{html:[e("<td>",{"class":"readonly",text:a.country||""}),e("<td>",{"class":"readonly",text:a.state||"*"}),e("<td>",{"class":"readonly",text:a.rate||""}),e("<td>",{"class":"readonly",text:a.name||""})]}).appendTo(o)}),e(".tax-rates").show()}else e(".tax-rates").hide()}}else e(':input[name="currency_pos"]').closest("tr").show(),e(':input[name="thousand_sep"]').closest("tr").show(),e(':input[name="decimal_sep"]').closest("tr").show(),e(':input[name="num_decimals"]').closest("tr").show(),e(".tax-rates").hide()}).change(),e('input[name="woocommerce_calc_taxes"]').change(function(){e(this).is(":checked")?(e(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").show(),e("tr.tax-rates").show()):(e(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").hide(),e("tr.tax-rates").hide())}).change(),e(".button-next").on("click",function(){return e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),!0}),e(".wc-wizard-services").on("change",".wc-wizard-service-enable input",function(){e(this).is(":checked")?e(this).closest(".wc-wizard-service-toggle").removeClass("disabled"):e(this).closest(".wc-wizard-service-toggle").addClass("disabled")}),e(".wc-wizard-services").on("click",".wc-wizard-service-item",function(){var t=e(this).find(".wc-wizard-service-enable input");t.prop("checked",!t.prop("checked")).change()}),e(".wc-wizard-services").on("click",".wc-wizard-service-enable input",function(e){e.stopPropagation()})});
|
|
@ -686,6 +686,47 @@ class WC_Admin_Setup_Wizard {
|
|||
return $gateways;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display service item in list.
|
||||
*/
|
||||
public function display_service_item( $item_id, $item_info ) {
|
||||
$enabled = isset( $item_info['enabled'] ) && $item_info['enabled'];
|
||||
?>
|
||||
<li class="wc-wizard-service-item">
|
||||
<div class="wc-wizard-service-name">
|
||||
<?php if ( $item_info['image'] ) : ?>
|
||||
<img src="<?php echo esc_attr( $item_info['image'] ); ?>" alt="<?php echo esc_attr( $item_info['name'] ); ?>" />
|
||||
<?php else : ?>
|
||||
<p><?php echo esc_html( $item_info['name'] ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="wc-wizard-service-description">
|
||||
<?php echo wp_kses_post( wpautop( $item_info['description'] ) ); ?>
|
||||
<?php if ( ! empty( $item_info['settings'] ) ) : ?>
|
||||
<div>
|
||||
<?php foreach ( $item_info['settings'] as $setting_id => $setting ) : ?>
|
||||
<label for="<?php echo esc_attr( $item_id ); ?>_<?php echo esc_attr( $setting_id ); ?>"><?php echo esc_html( $setting['label'] ); ?>:</label>
|
||||
<input
|
||||
type="<?php echo esc_attr( $setting['type'] ); ?>"
|
||||
id="<?php echo esc_attr( $item_id ); ?>_<?php echo esc_attr( $setting_id ); ?>"
|
||||
name="<?php echo esc_attr( $item_id ); ?>_<?php echo esc_attr( $setting_id ); ?>"
|
||||
value="<?php echo esc_attr( $setting['value'] ); ?>"
|
||||
placeholder="<?php echo esc_attr( $setting['placeholder'] ); ?>"
|
||||
/>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="wc-wizard-service-enable">
|
||||
<span class="wc-wizard-service-toggle <?php echo esc_attr( $enabled ? '' : 'disabled' ); ?>">
|
||||
<input id="wc-wizard-service-<?php echo esc_attr( $item_id ); ?>" type="checkbox" name="wc-wizard-service-<?php echo esc_attr( $item_id ); ?>-enabled" value="yes" <?php checked( $enabled ); ?>/>
|
||||
<label for="wc-wizard-service-<?php echo esc_attr( $item_id ); ?>">
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Payments Step.
|
||||
*/
|
||||
|
@ -702,62 +743,15 @@ class WC_Admin_Setup_Wizard {
|
|||
<?php else: ?>
|
||||
<p><?php printf( __( 'WooCommerce can accept both online and offline payments. <a href="%1$s" target="_blank">Additional payment methods</a> can be installed later and managed from the <a href="%2$s" target="_blank">checkout settings</a> screen.', 'woocommerce' ), esc_url( admin_url( 'admin.php?page=wc-addons&view=payment-gateways' ) ), esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout' ) ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
<ul class="wc-wizard-payment-gateways in-cart">
|
||||
<?php foreach ( $in_cart_gateways as $gateway_id => $gateway ) : ?>
|
||||
<li class="wc-wizard-gateway wc-wizard-gateway-<?php echo esc_attr( $gateway_id ); ?> <?php echo esc_attr( $gateway['class'] ); ?>">
|
||||
<div class="wc-wizard-gateway-enable">
|
||||
<input type="checkbox" name="wc-wizard-gateway-<?php echo esc_attr( $gateway_id ); ?>-enabled" class="input-checkbox" value="yes" <?php checked( isset( $gateway['enabled'] ) && $gateway['enabled'] ); ?>/>
|
||||
<label>
|
||||
<?php if ( $gateway['image'] ) : ?>
|
||||
<img src="<?php echo esc_attr( $gateway['image'] ); ?>" alt="<?php echo esc_attr( $gateway['name'] ); ?>" />
|
||||
<?php else : ?>
|
||||
<?php echo esc_html( $gateway['name'] ); ?>
|
||||
<?php endif; ?>
|
||||
</label>
|
||||
</div>
|
||||
<div class="wc-wizard-gateway-description">
|
||||
<?php echo wp_kses_post( wpautop( $gateway['description'] ) ); ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $gateway['settings'] ) ) : ?>
|
||||
<table class="form-table wc-wizard-gateway-settings">
|
||||
<?php foreach ( $gateway['settings'] as $setting_id => $setting ) : ?>
|
||||
<tr>
|
||||
<th scope="row"><label for="<?php echo esc_attr( $gateway_id ); ?>_<?php echo esc_attr( $setting_id ); ?>"><?php echo esc_html( $setting['label'] ); ?>:</label></th>
|
||||
<td>
|
||||
<input
|
||||
type="<?php echo esc_attr( $setting['type'] ); ?>"
|
||||
id="<?php echo esc_attr( $gateway_id ); ?>_<?php echo esc_attr( $setting_id ); ?>"
|
||||
name="<?php echo esc_attr( $gateway_id ); ?>_<?php echo esc_attr( $setting_id ); ?>"
|
||||
class="input-text"
|
||||
value="<?php echo esc_attr( $setting['value'] ); ?>"
|
||||
placeholder="<?php echo esc_attr( $setting['placeholder'] ); ?>"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<ul class="wc-wizard-services in-cart">
|
||||
<?php foreach ( $in_cart_gateways as $gateway_id => $gateway ) {
|
||||
$this->display_service_item( $gateway_id, $gateway );
|
||||
} ?>
|
||||
</ul>
|
||||
<ul class="wc-wizard-payment-gateways manual">
|
||||
<?php foreach ( $manual_gateways as $gateway_id => $gateway ) : ?>
|
||||
<li class="wc-wizard-gateway wc-wizard-gateway-<?php echo esc_attr( $gateway_id ); ?> <?php echo esc_attr( $gateway['class'] ); ?>">
|
||||
<div class="wc-wizard-gateway-enable">
|
||||
<input type="checkbox" name="wc-wizard-gateway-<?php echo esc_attr( $gateway_id ); ?>-enabled" class="input-checkbox" value="yes" <?php checked( isset( $gateway['enabled'] ) && $gateway['enabled'] ); ?>/>
|
||||
<label>
|
||||
<?php if ( $gateway['image'] ) : ?>
|
||||
<img src="<?php echo esc_attr( $gateway['image'] ); ?>" alt="<?php echo esc_attr( $gateway['name'] ); ?>" />
|
||||
<?php else : ?>
|
||||
<?php echo esc_html( $gateway['name'] ); ?>
|
||||
<?php endif; ?>
|
||||
</label>
|
||||
</div>
|
||||
<div class="wc-wizard-gateway-description">
|
||||
<?php echo wp_kses_post( wpautop( $gateway['description'] ) ); ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<ul class="wc-wizard-services manual">
|
||||
<?php foreach ( $manual_gateways as $gateway_id => $gateway ) {
|
||||
$this->display_service_item( $gateway_id, $gateway );
|
||||
} ?>
|
||||
</ul>
|
||||
<p class="wc-setup-actions step">
|
||||
<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step" />
|
||||
|
@ -777,13 +771,13 @@ class WC_Admin_Setup_Wizard {
|
|||
|
||||
foreach ( $gateways as $gateway_id => $gateway ) {
|
||||
// If repo-slug is defined, download and install plugin from .org.
|
||||
if ( ! empty( $gateway['repo-slug'] ) && ! empty( $_POST[ 'wc-wizard-gateway-' . $gateway_id . '-enabled' ] ) ) {
|
||||
if ( ! empty( $gateway['repo-slug'] ) && ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ) {
|
||||
$this->install_plugin( $gateway_id, $gateway );
|
||||
}
|
||||
|
||||
$settings_key = 'woocommerce_' . $gateway_id . '_settings';
|
||||
$settings = array_filter( (array) get_option( $settings_key, array() ) );
|
||||
$settings['enabled'] = ! empty( $_POST[ 'wc-wizard-gateway-' . $gateway_id . '-enabled' ] ) ? 'yes' : 'no';
|
||||
$settings['enabled'] = ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ? 'yes' : 'no';
|
||||
|
||||
if ( ! empty( $gateway['settings'] ) ) {
|
||||
foreach ( $gateway['settings'] as $setting_id => $setting ) {
|
||||
|
@ -795,7 +789,7 @@ class WC_Admin_Setup_Wizard {
|
|||
}
|
||||
|
||||
// Install WooCommerce Services with Stripe to enable deferred account creation
|
||||
if ( ! empty( $_POST[ 'wc-wizard-gateway-stripe-enabled' ] ) ) {
|
||||
if ( ! empty( $_POST[ 'wc-wizard-service-stripe-enabled' ] ) ) {
|
||||
$this->install_woocommerce_services();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue