data tabs tweaks. #6562

This commit is contained in:
James Koster 2014-10-17 14:42:15 +01:00
parent ebea42f7ee
commit e27d4afee1
8 changed files with 161 additions and 183 deletions

File diff suppressed because one or more lines are too long

View File

@ -1866,16 +1866,10 @@ img.help_tip {
#woocommerce-product-data, #woocommerce-coupon-data { #woocommerce-product-data, #woocommerce-coupon-data {
.panel-wrap { .panel-wrap {
background: #fff; background: #fff;
padding-left: 153px;
} }
.woocommerce_options_panel, .wc-metaboxes-wrapper { .woocommerce_options_panel, .wc-metaboxes-wrapper {
float: right; float: left;
width: 100%; width: 80%;
.wc-metaboxes, p.toolbar {
padding-left: 12px !important;
padding-right: 20px !important;
}
.wc-radios { .wc-radios {
display: block; display: block;
@ -1890,26 +1884,36 @@ img.help_tip {
} }
} }
} }
.wc-tabs-back {
position: absolute;
top: 0;
left: 0;
bottom: 0;
background: #f5f5f5;
width: 145px;
border-right: 1px solid #DFDFDF;
}
} }
#woocommerce-product-data, #woocommerce-coupon-data, .woocommerce { #woocommerce-product-data, #woocommerce-coupon-data, .woocommerce {
.panel-wrap {
overflow: hidden;
}
ul.wc-tabs { ul.wc-tabs {
background: #f5f5f5; background: #fff;
line-height: 1em; line-height: 1em;
float: left; float: left;
width: 145px; width: 20%;
margin: 0; margin: 0;
position: relative; position: relative;
padding: 0 0 10px; padding: 0 0 10px;
margin-left: -153px; background-color: #fafafa;
border-right: 1px solid #eee;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
&:after {
content: "";
display: block;
width: 100%;
height: 9999em;
position: absolute;
bottom: -9999em;
left: 0;
background-color: #fafafa;
border-right: 1px solid #eee;
}
li { li {
display:block; display:block;
@ -1918,13 +1922,11 @@ img.help_tip {
a { a {
padding: 10px; padding: 10px;
line-height: 18px !important; line-height: 20px !important;
margin: 0; margin: 0;
display: block; display: block;
background: #f5f5f5;
text-decoration: none; text-decoration: none;
border-bottom: 1px solid #f5f5f5; border-bottom: 1px solid #eee;
border-top: 1px solid #eaeaea;
&:before { &:before {
@include iconbefore( "\e028" ); @include iconbefore( "\e028" );
} }
@ -1993,11 +1995,9 @@ img.help_tip {
&.active { &.active {
a { a {
border-color: #DFDFDF;
position: relative; position: relative;
background-color: #fff; background-color: #fff;
color: #555; color: #555;
margin: 0 -1px 0 0;
} }
} }
} }
@ -2028,34 +2028,6 @@ img.help_tip {
} }
} }
@media only screen and (max-width: 900px) {
#woocommerce-product-data, #woocommerce-coupon-data {
.panel-wrap {
padding-left: 35px;
}
.wc-tabs-back {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 28px;
border-right: 1px solid #DFDFDF;
}
}
#woocommerce-product-data ul.product_data_tabs, .woocommerce ul.wc-tabs {
width: 28px;
margin-left: -35px;
li {
a {
overflow: hidden;
white-space: nowrap;
}
}
}
}
#woocommerce-product-data, #woocommerce-product-type-options, #woocommerce-order-data, #woocommerce-order-downloads, #woocommerce-coupon-data { #woocommerce-product-data, #woocommerce-product-type-options, #woocommerce-order-data, #woocommerce-order-downloads, #woocommerce-coupon-data {
.inside { .inside {
padding: 0; padding: 0;
@ -2234,7 +2206,7 @@ img.help_tip {
} }
.options_group { .options_group {
border-top: 1px solid white; border-top: 1px solid white;
border-bottom: 1px solid #DFDFDF; border-bottom: 1px solid #eee;
} }
.options_group:first-child { .options_group:first-child {
border-top: 0; border-top: 0;
@ -2298,7 +2270,7 @@ img.help_tip {
.toolbar { .toolbar {
margin: 0 !important; margin: 0 !important;
border-top: 1px solid white; border-top: 1px solid white;
border-bottom: 1px solid #DFDFDF; border-bottom: 1px solid #eee;
padding: 9px 12px !important; padding: 9px 12px !important;
&:first-child { &:first-child {
border-top:0; border-top:0;
@ -2320,8 +2292,7 @@ img.help_tip {
margin: 0 0 0 6px; margin: 0 0 0 6px;
} }
.wc-metaboxes { .wc-metaboxes {
border-bottom: 1px solid #DFDFDF; border-bottom: 1px solid #eee;
padding: 0 12px 0;
} }
.wc-metabox-sortable-placeholder { .wc-metabox-sortable-placeholder {
border-color:#bbb; border-color:#bbb;
@ -2332,14 +2303,17 @@ img.help_tip {
} }
.wc-metabox { .wc-metabox {
background: #fff; background: #fff;
border: 1px solid #dfdfdf; border-bottom: 1px solid #eee;
margin: 9px 0 !important; margin: 0 !important;
-moz-border-radius-topleft: 3px;
-moz-border-radius-topright: 3px; select {
-webkit-border-top-left-radius: 3px; font-weight: 400;
-webkit-border-top-right-radius: 3px; }
border-top-left-radius: 3px;
border-top-right-radius: 3px; &:last-of-type {
border-bottom: 0;
}
.handlediv { .handlediv {
&:before { &:before {
line-height: .5 !important; line-height: .5 !important;
@ -2371,6 +2345,7 @@ img.help_tip {
strong { strong {
font-weight: normal; font-weight: normal;
line-height: 24px; line-height: 24px;
font-weight: 700;
} }
select { select {
font-family: sans-serif; font-family: sans-serif;
@ -2390,11 +2365,12 @@ img.help_tip {
table { table {
width: 100%; width: 100%;
position: relative; position: relative;
background: #fff; background-color: #fdfdfd;
padding: 3px; padding: 1em;
border-top: 1px solid #eee;
td { td {
text-align: left; text-align: left;
padding: 6px 6px; padding: 0 6px 1em 0;
vertical-align: top; vertical-align: top;
border: 0; border: 0;
label { label {
@ -2463,11 +2439,11 @@ img.help_tip {
/* Configuration */ /* Configuration */
.woocommerce_variable_attributes { .woocommerce_variable_attributes {
background-color: #fdfdfd; background-color: #fdfdfd;
padding: 0 1em; border-top: 1px solid #eee;
border-top: 1px solid #dfdfdf;
.data { .data {
@include clearfix; @include clearfix;
padding: 1em 2em;
} }
.upload_image_button { .upload_image_button {
@ -2499,6 +2475,10 @@ img.help_tip {
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
} }
&.remove:before {
content: "\f335";
}
&:hover { &:hover {
&:before { &:before {
display: block; display: block;
@ -3198,7 +3178,6 @@ table.bar_chart {
} }
table { table {
margin: 0 12px 24px 12px;
width: 94%; width: 94%;
.sort { .sort {
@ -3213,14 +3192,11 @@ table.bar_chart {
#woocommerce-product-data ul.product_data_tabs, #woocommerce-product-data ul.product_data_tabs,
#woocommerce-product-data .wc-tabs-back { #woocommerce-product-data .wc-tabs-back {
width:40px; width: 10%;
} }
#woocommerce-product-data .woocommerce_options_panel, #woocommerce-coupon-data .wc-metaboxes-wrapper, #woocommerce-coupon-data .woocommerce_options_panel, #woocommerce-product-data .wc-metaboxes-wrapper, #woocommerce-product-data .woocommerce_options_panel {
#woocommerce-coupon-data .woocommerce_options_panel, width: 90%;
#woocommerce-product-data .wc-metaboxes-wrapper,
#woocommerce-coupon-data .wc-metaboxes-wrapper {
width: 98%;
} }
#woocommerce-product-data ul.product_data_tabs li a { #woocommerce-product-data ul.product_data_tabs li a {
@ -3236,7 +3212,7 @@ table.bar_chart {
text-indent: 0; text-indent: 0;
text-align: center; text-align: center;
line-height: 40px; line-height: 40px;
width: 40px; width: 100%;
height: 40px; height: 40px;
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -152,14 +152,14 @@ jQuery( function ( $ ) {
// If the user clicks on some form input inside the h3, like a select list (for variations), the box should not be toggled // If the user clicks on some form input inside the h3, like a select list (for variations), the box should not be toggled
if ($(event.target).filter(':input, option').length) return; if ($(event.target).filter(':input, option').length) return;
jQuery(this).next('.wc-metabox-content').toggle(); jQuery(this).next('.wc-metabox-content').stop().slideToggle();
}) })
.on('click', '.expand_all', function(event){ .on('click', '.expand_all', function(event){
jQuery(this).closest('.wc-metaboxes-wrapper').find('.wc-metabox > table').show(); jQuery(this).closest('.wc-metaboxes-wrapper').find('.wc-metabox > .wc-metabox-content').show();
return false; return false;
}) })
.on('click', '.close_all', function(event){ .on('click', '.close_all', function(event){
jQuery(this).closest('.wc-metaboxes-wrapper').find('.wc-metabox > table').hide(); jQuery(this).closest('.wc-metaboxes-wrapper').find('.wc-metabox > .wc-metabox-content').hide();
return false; return false;
}); });
jQuery('.wc-metabox.closed').each(function(){ jQuery('.wc-metabox.closed').each(function(){

View File

@ -1 +1 @@
jQuery(function(a){function b(){a("#tiptip_holder").removeAttr("style"),a("#tiptip_arrow").removeAttr("style"),a(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200})}function c(){a("select.ajax_chosen_select_products_and_variations").ajaxChosen({method:"GET",url:woocommerce_admin_meta_boxes.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"woocommerce_json_search_products_and_variations",security:woocommerce_admin_meta_boxes.search_products_nonce}},function(b){var c={};return a.each(b,function(a,b){c[a]=b}),c})}b(),a("#titlediv #title").keyup(function(b){var c=b.keyCode||b.which;return"9"==c&&a("#woocommerce-coupon-description").size()>0?(b.stopPropagation(),a("#woocommerce-coupon-description").focus(),!1):void 0}),a(function(){jQuery(".wc-metabox > h3").click(function(){a(this).parent(".wc-metabox").toggleClass("closed").toggleClass("open")})}),a("ul.wc-tabs").show(),a("div.panel-wrap").each(function(){a(this).find("div.panel:not(:first)").hide()}),a("ul.wc-tabs a").click(function(){var b=a(this).closest("div.panel-wrap");return a("ul.wc-tabs li",b).removeClass("active"),a(this).parent().addClass("active"),a("div.panel",b).hide(),a(a(this).attr("href")).show(),!1}),a("ul.wc-tabs li:visible").eq(0).find("a").click(),jQuery("select.chosen_select").chosen(),jQuery("select.chosen_select_nostd").chosen({allow_single_deselect:"true"}),jQuery("select.ajax_chosen_select_products").ajaxChosen({method:"GET",url:woocommerce_admin_meta_boxes.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"woocommerce_json_search_products",security:woocommerce_admin_meta_boxes.search_products_nonce}},function(b){var c={};return a.each(b,function(a,b){c[a]=b}),c}),c(),a("body").on("wc_backbone_modal_loaded",function(a,b){"#wc-modal-add-products"===b&&c()}),jQuery("select.ajax_chosen_select_downloadable_products_and_variations").ajaxChosen({method:"GET",url:woocommerce_admin_meta_boxes.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"woocommerce_json_search_downloadable_products_and_variations",security:woocommerce_admin_meta_boxes.search_products_nonce}},function(b){var c={};return a.each(b,function(a,b){c[a]=b}),c}),a(".date-picker").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,showOn:"button",buttonImage:woocommerce_admin_meta_boxes.calendar_image,buttonImageOnly:!0}),a(".date-picker-field").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0}),jQuery(".wc-metaboxes-wrapper").on("click",".wc-metabox h3",function(b){a(b.target).filter(":input, option").length||jQuery(this).next(".wc-metabox-content").toggle()}).on("click",".expand_all",function(){return jQuery(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > table").show(),!1}).on("click",".close_all",function(){return jQuery(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > table").hide(),!1}),jQuery(".wc-metabox.closed").each(function(){jQuery(this).find(".wc-metabox-content").hide()})}); jQuery(function(a){function b(){a("#tiptip_holder").removeAttr("style"),a("#tiptip_arrow").removeAttr("style"),a(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200})}function c(){a("select.ajax_chosen_select_products_and_variations").ajaxChosen({method:"GET",url:woocommerce_admin_meta_boxes.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"woocommerce_json_search_products_and_variations",security:woocommerce_admin_meta_boxes.search_products_nonce}},function(b){var c={};return a.each(b,function(a,b){c[a]=b}),c})}b(),a("#titlediv #title").keyup(function(b){var c=b.keyCode||b.which;return"9"==c&&a("#woocommerce-coupon-description").size()>0?(b.stopPropagation(),a("#woocommerce-coupon-description").focus(),!1):void 0}),a(function(){jQuery(".wc-metabox > h3").click(function(){a(this).parent(".wc-metabox").toggleClass("closed").toggleClass("open")})}),a("ul.wc-tabs").show(),a("div.panel-wrap").each(function(){a(this).find("div.panel:not(:first)").hide()}),a("ul.wc-tabs a").click(function(){var b=a(this).closest("div.panel-wrap");return a("ul.wc-tabs li",b).removeClass("active"),a(this).parent().addClass("active"),a("div.panel",b).hide(),a(a(this).attr("href")).show(),!1}),a("ul.wc-tabs li:visible").eq(0).find("a").click(),jQuery("select.chosen_select").chosen(),jQuery("select.chosen_select_nostd").chosen({allow_single_deselect:"true"}),jQuery("select.ajax_chosen_select_products").ajaxChosen({method:"GET",url:woocommerce_admin_meta_boxes.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"woocommerce_json_search_products",security:woocommerce_admin_meta_boxes.search_products_nonce}},function(b){var c={};return a.each(b,function(a,b){c[a]=b}),c}),c(),a("body").on("wc_backbone_modal_loaded",function(a,b){"#wc-modal-add-products"===b&&c()}),jQuery("select.ajax_chosen_select_downloadable_products_and_variations").ajaxChosen({method:"GET",url:woocommerce_admin_meta_boxes.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"woocommerce_json_search_downloadable_products_and_variations",security:woocommerce_admin_meta_boxes.search_products_nonce}},function(b){var c={};return a.each(b,function(a,b){c[a]=b}),c}),a(".date-picker").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,showOn:"button",buttonImage:woocommerce_admin_meta_boxes.calendar_image,buttonImageOnly:!0}),a(".date-picker-field").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0}),jQuery(".wc-metaboxes-wrapper").on("click",".wc-metabox h3",function(b){a(b.target).filter(":input, option").length||jQuery(this).next(".wc-metabox-content").stop().slideToggle()}).on("click",".expand_all",function(){return jQuery(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > .wc-metabox-content").show(),!1}).on("click",".close_all",function(){return jQuery(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > .wc-metabox-content").hide(),!1}),jQuery(".wc-metabox.closed").each(function(){jQuery(this).find(".wc-metabox-content").hide()})});

View File

@ -1 +1 @@
jQuery(function(e){if(typeof wc_add_to_cart_params==="undefined")return false;e(document).on("click",".add_to_cart_button",function(t){var n=e(this);if(n.is(".product_type_simple")){if(!n.attr("data-product_id"))return true;n.removeClass("added");n.addClass("loading");var r={action:"woocommerce_add_to_cart"};e.each(n.data(),function(e,t){r[e]=t});e("body").trigger("adding_to_cart",[n,r]);e.post(wc_add_to_cart_params.ajax_url,r,function(t){if(!t)return;var r=window.location.toString();r=r.replace("add-to-cart","added-to-cart");if(t.error&&t.product_url){window.location=t.product_url;return}if(wc_add_to_cart_params.cart_redirect_after_add==="yes"){window.location=wc_add_to_cart_params.cart_url;return}else{n.removeClass("loading");fragments=t.fragments;cart_hash=t.cart_hash;if(fragments){e.each(fragments,function(t,n){e(t).addClass("updating")})}e(".shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{background:"transparent url("+wc_add_to_cart_params.ajax_loader_url+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}});n.addClass("added");if(!wc_add_to_cart_params.is_cart&&n.parent().find(".added_to_cart").size()===0){n.after(' <a href="'+wc_add_to_cart_params.cart_url+'" class="added_to_cart wc-forward" title="'+wc_add_to_cart_params.i18n_view_cart+'">'+wc_add_to_cart_params.i18n_view_cart+"</a>")}if(fragments){e.each(fragments,function(t,n){e(t).replaceWith(n)})}e(".widget_shopping_cart, .updating").stop(true).css("opacity","1").unblock();e(".shop_table.cart").load(r+" .shop_table.cart:eq(0) > *",function(){e("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" id="add1" class="plus" />').prepend('<input type="button" value="-" id="minus1" class="minus" />');e(".shop_table.cart").stop(true).css("opacity","1").unblock();e("body").trigger("cart_page_refreshed")});e(".cart_totals").load(r+" .cart_totals:eq(0) > *",function(){e(".cart_totals").stop(true).css("opacity","1").unblock()});e("body").trigger("added_to_cart",[fragments,cart_hash])}});return false}return true})}) jQuery(function(a){return"undefined"==typeof wc_add_to_cart_params?!1:void a(document).on("click",".add_to_cart_button",function(){var b=a(this);if(b.is(".product_type_simple")){if(!b.attr("data-product_id"))return!0;b.removeClass("added"),b.addClass("loading");var c={action:"woocommerce_add_to_cart"};return a.each(b.data(),function(a,b){c[a]=b}),a("body").trigger("adding_to_cart",[b,c]),a.post(wc_add_to_cart_params.ajax_url,c,function(c){if(c){var d=window.location.toString();return d=d.replace("add-to-cart","added-to-cart"),c.error&&c.product_url?void(window.location=c.product_url):"yes"===wc_add_to_cart_params.cart_redirect_after_add?void(window.location=wc_add_to_cart_params.cart_url):(b.removeClass("loading"),fragments=c.fragments,cart_hash=c.cart_hash,fragments&&a.each(fragments,function(b){a(b).addClass("updating")}),a(".shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{background:"transparent url("+wc_add_to_cart_params.ajax_loader_url+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}}),b.addClass("added"),wc_add_to_cart_params.is_cart||0!==b.parent().find(".added_to_cart").size()||b.after(' <a href="'+wc_add_to_cart_params.cart_url+'" class="added_to_cart wc-forward" title="'+wc_add_to_cart_params.i18n_view_cart+'">'+wc_add_to_cart_params.i18n_view_cart+"</a>"),fragments&&a.each(fragments,function(b,c){a(b).replaceWith(c)}),a(".widget_shopping_cart, .updating").stop(!0).css("opacity","1").unblock(),a(".shop_table.cart").load(d+" .shop_table.cart:eq(0) > *",function(){a("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" id="add1" class="plus" />').prepend('<input type="button" value="-" id="minus1" class="minus" />'),a(".shop_table.cart").stop(!0).css("opacity","1").unblock(),a("body").trigger("cart_page_refreshed")}),a(".cart_totals").load(d+" .cart_totals:eq(0) > *",function(){a(".cart_totals").stop(!0).css("opacity","1").unblock()}),a("body").trigger("added_to_cart",[fragments,cart_hash]),void 0)}}),!1}return!0})});

View File

@ -82,8 +82,6 @@ class WC_Meta_Box_Product_Data {
<span class="type_box"> &mdash; <?php echo $type_box; ?></span> <span class="type_box"> &mdash; <?php echo $type_box; ?></span>
<div class="wc-tabs-back"></div>
<ul class="product_data_tabs wc-tabs" style="display:none;"> <ul class="product_data_tabs wc-tabs" style="display:none;">
<?php <?php
$product_data_tabs = apply_filters( 'woocommerce_product_data_tabs', array( $product_data_tabs = apply_filters( 'woocommerce_product_data_tabs', array(
@ -445,82 +443,84 @@ class WC_Meta_Box_Product_Data {
<div class="handlediv" title="<?php _e( 'Click to toggle', 'woocommerce' ); ?>"></div> <div class="handlediv" title="<?php _e( 'Click to toggle', 'woocommerce' ); ?>"></div>
<strong class="attribute_name"><?php echo apply_filters( 'woocommerce_attribute_label', $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name, $tax->attribute_name ); ?></strong> <strong class="attribute_name"><?php echo apply_filters( 'woocommerce_attribute_label', $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name, $tax->attribute_name ); ?></strong>
</h3> </h3>
<table cellpadding="0" cellspacing="0" class="woocommerce_attribute_data wc-metabox-content"> <div class="woocommerce_attribute_data wc-metabox-content">
<tbody> <table cellpadding="0" cellspacing="0">
<tr> <tbody>
<td class="attribute_name"> <tr>
<label><?php _e( 'Name', 'woocommerce' ); ?>:</label> <td class="attribute_name">
<strong><?php echo $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name; ?></strong> <label><?php _e( 'Name', 'woocommerce' ); ?>:</label>
<strong><?php echo $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name; ?></strong>
<input type="hidden" name="attribute_names[<?php echo $i; ?>]" value="<?php echo esc_attr( $attribute_taxonomy_name ); ?>" /> <input type="hidden" name="attribute_names[<?php echo $i; ?>]" value="<?php echo esc_attr( $attribute_taxonomy_name ); ?>" />
<input type="hidden" name="attribute_position[<?php echo $i; ?>]" class="attribute_position" value="<?php echo esc_attr( $position ); ?>" /> <input type="hidden" name="attribute_position[<?php echo $i; ?>]" class="attribute_position" value="<?php echo esc_attr( $position ); ?>" />
<input type="hidden" name="attribute_is_taxonomy[<?php echo $i; ?>]" value="1" /> <input type="hidden" name="attribute_is_taxonomy[<?php echo $i; ?>]" value="1" />
</td> </td>
<td rowspan="3"> <td rowspan="3">
<label><?php _e( 'Value(s)', 'woocommerce' ); ?>:</label> <label><?php _e( 'Value(s)', 'woocommerce' ); ?>:</label>
<?php if ( 'select' == $tax->attribute_type ) : ?> <?php if ( 'select' == $tax->attribute_type ) : ?>
<select multiple="multiple" data-placeholder="<?php _e( 'Select terms', 'woocommerce' ); ?>" class="multiselect attribute_values" name="attribute_values[<?php echo $i; ?>][]"> <select multiple="multiple" data-placeholder="<?php _e( 'Select terms', 'woocommerce' ); ?>" class="multiselect attribute_values" name="attribute_values[<?php echo $i; ?>][]">
<?php <?php
$all_terms = get_terms( $attribute_taxonomy_name, 'orderby=name&hide_empty=0' ); $all_terms = get_terms( $attribute_taxonomy_name, 'orderby=name&hide_empty=0' );
if ( $all_terms ) { if ( $all_terms ) {
foreach ( $all_terms as $term ) { foreach ( $all_terms as $term ) {
$has_term = has_term( (int) $term->term_id, $attribute_taxonomy_name, $thepostid ) ? 1 : 0; $has_term = has_term( (int) $term->term_id, $attribute_taxonomy_name, $thepostid ) ? 1 : 0;
echo '<option value="' . esc_attr( $term->slug ) . '" ' . selected( $has_term, 1, false ) . '>' . $term->name . '</option>'; echo '<option value="' . esc_attr( $term->slug ) . '" ' . selected( $has_term, 1, false ) . '>' . $term->name . '</option>';
}
} }
} ?>
?> </select>
</select>
<button class="button plus select_all_attributes"><?php _e( 'Select all', 'woocommerce' ); ?></button> <button class="button minus select_no_attributes"><?php _e( 'Select none', 'woocommerce' ); ?></button> <button class="button plus select_all_attributes"><?php _e( 'Select all', 'woocommerce' ); ?></button> <button class="button minus select_no_attributes"><?php _e( 'Select none', 'woocommerce' ); ?></button>
<button class="button fr plus add_new_attribute" data-attribute="<?php echo $attribute_taxonomy_name; ?>"><?php _e( 'Add new', 'woocommerce' ); ?></button> <button class="button fr plus add_new_attribute" data-attribute="<?php echo $attribute_taxonomy_name; ?>"><?php _e( 'Add new', 'woocommerce' ); ?></button>
<?php elseif ( 'text' == $tax->attribute_type ) : ?> <?php elseif ( 'text' == $tax->attribute_type ) : ?>
<input type="text" name="attribute_values[<?php echo $i; ?>]" value="<?php <input type="text" name="attribute_values[<?php echo $i; ?>]" value="<?php
// Text attributes should list terms pipe separated // Text attributes should list terms pipe separated
if ( $post_terms ) { if ( $post_terms ) {
$values = array(); $values = array();
foreach ( $post_terms as $term ) foreach ( $post_terms as $term )
$values[] = $term->name; $values[] = $term->name;
echo esc_attr( implode( ' ' . WC_DELIMITER . ' ', $values ) ); echo esc_attr( implode( ' ' . WC_DELIMITER . ' ', $values ) );
}
?>" placeholder="<?php _e( 'Pipe (|) separate terms', 'woocommerce' ); ?>" />
<?php endif; ?>
<?php do_action( 'woocommerce_product_option_terms', $tax, $i ); ?>
</td>
</tr>
<tr>
<td>
<label><input type="checkbox" class="checkbox" <?php
if ( isset( $attribute['is_visible'] ) ) {
checked( $attribute['is_visible'], 1 );
} else {
checked( apply_filters( 'default_attribute_visibility', false, $tax ), true );
} }
?>" placeholder="<?php _e( 'Pipe (|) separate terms', 'woocommerce' ); ?>" /> ?> name="attribute_visibility[<?php echo $i; ?>]" value="1" /> <?php _e( 'Visible on the product page', 'woocommerce' ); ?></label>
<?php endif; ?> </td>
<?php do_action( 'woocommerce_product_option_terms', $tax, $i ); ?> </tr>
</td> <tr>
</tr> <td>
<tr> <div class="enable_variation show_if_variable">
<td> <label><input type="checkbox" class="checkbox" <?php
<label><input type="checkbox" class="checkbox" <?php
if ( isset( $attribute['is_visible'] ) ) { if ( isset( $attribute['is_variation'] ) ) {
checked( $attribute['is_visible'], 1 ); checked( $attribute['is_variation'], 1 );
} else { } else {
checked( apply_filters( 'default_attribute_visibility', false, $tax ), true ); checked( apply_filters( 'default_attribute_variation', false, $tax ), true );
} }
?> name="attribute_visibility[<?php echo $i; ?>]" value="1" /> <?php _e( 'Visible on the product page', 'woocommerce' ); ?></label> ?> name="attribute_variation[<?php echo $i; ?>]" value="1" /> <?php _e( 'Used for variations', 'woocommerce' ); ?></label>
</td> </div>
</tr> </td>
<tr> </tr>
<td> </tbody>
<div class="enable_variation show_if_variable"> </table>
<label><input type="checkbox" class="checkbox" <?php </div>
if ( isset( $attribute['is_variation'] ) ) {
checked( $attribute['is_variation'], 1 );
} else {
checked( apply_filters( 'default_attribute_variation', false, $tax ), true );
}
?> name="attribute_variation[<?php echo $i; ?>]" value="1" /> <?php _e( 'Used for variations', 'woocommerce' ); ?></label>
</div>
</td>
</tr>
</tbody>
</table>
</div> </div>
<?php <?php
} }
@ -545,34 +545,36 @@ class WC_Meta_Box_Product_Data {
<div class="handlediv" title="<?php _e( 'Click to toggle', 'woocommerce' ); ?>"></div> <div class="handlediv" title="<?php _e( 'Click to toggle', 'woocommerce' ); ?>"></div>
<strong class="attribute_name"><?php echo apply_filters( 'woocommerce_attribute_label', esc_html( $attribute['name'] ), esc_html( $attribute['name'] ) ); ?></strong> <strong class="attribute_name"><?php echo apply_filters( 'woocommerce_attribute_label', esc_html( $attribute['name'] ), esc_html( $attribute['name'] ) ); ?></strong>
</h3> </h3>
<table cellpadding="0" cellspacing="0" class="woocommerce_attribute_data wc-metabox-content"> <div class="woocommerce_attribute_data wc-metabox-content">
<tbody> <table cellpadding="0" cellspacing="0">
<tr> <tbody>
<td class="attribute_name"> <tr>
<label><?php _e( 'Name', 'woocommerce' ); ?>:</label> <td class="attribute_name">
<input type="text" class="attribute_name" name="attribute_names[<?php echo $i; ?>]" value="<?php echo esc_attr( $attribute['name'] ); ?>" /> <label><?php _e( 'Name', 'woocommerce' ); ?>:</label>
<input type="hidden" name="attribute_position[<?php echo $i; ?>]" class="attribute_position" value="<?php echo esc_attr( $position ); ?>" /> <input type="text" class="attribute_name" name="attribute_names[<?php echo $i; ?>]" value="<?php echo esc_attr( $attribute['name'] ); ?>" />
<input type="hidden" name="attribute_is_taxonomy[<?php echo $i; ?>]" value="0" /> <input type="hidden" name="attribute_position[<?php echo $i; ?>]" class="attribute_position" value="<?php echo esc_attr( $position ); ?>" />
</td> <input type="hidden" name="attribute_is_taxonomy[<?php echo $i; ?>]" value="0" />
<td rowspan="3"> </td>
<label><?php _e( 'Value(s)', 'woocommerce' ); ?>:</label> <td rowspan="3">
<textarea name="attribute_values[<?php echo $i; ?>]" cols="5" rows="5" placeholder="<?php _e( 'Enter some text, or some attributes by pipe (|) separating values.', 'woocommerce' ); ?>"><?php echo esc_textarea( $attribute['value'] ); ?></textarea> <label><?php _e( 'Value(s)', 'woocommerce' ); ?>:</label>
</td> <textarea name="attribute_values[<?php echo $i; ?>]" cols="5" rows="5" placeholder="<?php _e( 'Enter some text, or some attributes by pipe (|) separating values.', 'woocommerce' ); ?>"><?php echo esc_textarea( $attribute['value'] ); ?></textarea>
</tr> </td>
<tr> </tr>
<td> <tr>
<label><input type="checkbox" class="checkbox" <?php checked( $attribute['is_visible'], 1 ); ?> name="attribute_visibility[<?php echo $i; ?>]" value="1" /> <?php _e( 'Visible on the product page', 'woocommerce' ); ?></label> <td>
</td> <label><input type="checkbox" class="checkbox" <?php checked( $attribute['is_visible'], 1 ); ?> name="attribute_visibility[<?php echo $i; ?>]" value="1" /> <?php _e( 'Visible on the product page', 'woocommerce' ); ?></label>
</tr> </td>
<tr> </tr>
<td> <tr>
<div class="enable_variation show_if_variable"> <td>
<label><input type="checkbox" class="checkbox" <?php checked( $attribute['is_variation'], 1 ); ?> name="attribute_variation[<?php echo $i; ?>]" value="1" /> <?php _e( 'Used for variations', 'woocommerce' ); ?></label> <div class="enable_variation show_if_variable">
</div> <label><input type="checkbox" class="checkbox" <?php checked( $attribute['is_variation'], 1 ); ?> name="attribute_variation[<?php echo $i; ?>]" value="1" /> <?php _e( 'Used for variations', 'woocommerce' ); ?></label>
</td> </div>
</tr> </td>
</tbody> </tr>
</table> </tbody>
</table>
</div>
</div> </div>
<?php <?php
} }

View File

@ -51,7 +51,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</h3> </h3>
<div class="woocommerce_variable_attributes wc-metabox-content"> <div class="woocommerce_variable_attributes wc-metabox-content">
<div class="data"> <div class="data">
<p class="form-row form-row-first"> <p class="form-row form-row-first upload_image">
<a href="#" class="upload_image_button <?php if ( $image_id > 0 ) echo 'remove'; ?>" rel="<?php echo esc_attr( $variation_id ); ?>"><img src="<?php if ( ! empty( $image ) ) echo esc_attr( $image ); else echo esc_attr( wc_placeholder_img_src() ); ?>" /><input type="hidden" name="upload_image_id[<?php echo $loop; ?>]" class="upload_image_id" value="<?php echo esc_attr( $image_id ); ?>" /></a> <a href="#" class="upload_image_button <?php if ( $image_id > 0 ) echo 'remove'; ?>" rel="<?php echo esc_attr( $variation_id ); ?>"><img src="<?php if ( ! empty( $image ) ) echo esc_attr( $image ); else echo esc_attr( wc_placeholder_img_src() ); ?>" /><input type="hidden" name="upload_image_id[<?php echo $loop; ?>]" class="upload_image_id" value="<?php echo esc_attr( $image_id ); ?>" /></a>
</p> </p>
<?php if ( wc_product_sku_enabled() ) : ?> <?php if ( wc_product_sku_enabled() ) : ?>