variations markup / css refactor. #6562

This commit is contained in:
James Koster 2014-10-17 12:17:21 +01:00
parent 5ff8f65d1f
commit eb258950bd
3 changed files with 282 additions and 321 deletions

File diff suppressed because one or more lines are too long

View File

@ -2087,11 +2087,12 @@ img.help_tip {
visibility: hidden; visibility: hidden;
} }
} }
.woocommerce_options_panel .checkbox, table.woocommerce_variable_attributes .checkbox { .woocommerce_options_panel .checkbox, .woocommerce_variable_attributes .checkbox {
width: auto; width: auto;
vertical-align: middle; vertical-align: middle;
margin: 7px 0; margin: 7px 0;
} }
.woocommerce_variations, .woocommerce_options_panel { .woocommerce_variations, .woocommerce_options_panel {
.downloadable_files { .downloadable_files {
table { table {
@ -2359,7 +2360,7 @@ img.help_tip {
} }
h3 { h3 {
margin: 0 !important; margin: 0 !important;
padding: 6px !important; padding: .75em .75em .75em 1em !important;
font-size: 1em !important; font-size: 1em !important;
overflow: hidden; overflow: hidden;
zoom: 1; zoom: 1;
@ -2460,133 +2461,107 @@ img.help_tip {
} }
/* Configuration */ /* Configuration */
#variable_product_options { .woocommerce_variable_attributes {
.woocommerce_variation { background-color: #fdfdfd;
table { padding: 0 1em;
background: #fafafa; border-top: 1px solid #dfdfdf;
border-top:1px solid #eee;
padding: 6px; .data {
td { @include clearfix;
input { }
min-width: inherit !important;
} .upload_image_button {
&.dimensions_field { display: block;
input { width: 48px;
width: 32%; height: 48px;
margin-right: 2%; float: left;
} margin-right: 20px;
.last { position: relative;
margin-right: 0;
} img {
} width: 100%;
&.options { height: auto;
width: 150px; }
label {
margin-bottom: 6px; &:before {
} content: "\f317";
} font-family: 'Dashicons';
&.data { display: none;
padding: 0 0 0 12px; position: absolute;
table.data_table { top: 0;
width: 100%; left: 0;
padding: 0 12px 6px 12px; right: 0;
background: #fff; bottom: 0;
border: 1px solid #dfdfdf; text-align: center;
-moz-border-radius: 3px; line-height: 48px;
-webkit-border-radius: 3px; font-size: 2em;
-khtml-border-radius: 3px; font-weight: 400;
border-radius: 3px; -webkit-font-smoothing: antialiased;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ }
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */ &:hover {
td { &:before {
width: 50%; display: block;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
}
}
table.data_table:before {
content: "";
display: block;
position: absolute;
top: 33px;
left: 0;
margin: 0 0 0 -1px;
border: 7px solid #dfdfdf;
border-color: transparent transparent transparent #dfdfdf;
}
table.data_table:after {
content: "";
display: block;
position: absolute;
top: 34px;
left: 0;
margin: 0 0 0 -1px;
border: 6px solid #fafafa;
border-color: transparent transparent transparent #fafafa;
}
}
&.upload_image {
white-space: nowrap;
width: 75px;
img {
float: none;
width: 73px;
border: 1px solid #dfdfdf;
}
.button {
margin: 0;
padding: 4px 10px;
width: auto;
float: none;
vertical-align: middle;
}
.upload_image_button {
display: block;
position: relative;
.overlay {
display: none;
width: 75px;
height: 75px;
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
opacity:0.5;
background: #eee url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAXklEQVQYGW2OUQrAMAhDFy8+dnKnwiuh2I+aJulDZebDkfSie1b28Q7EXWrfvSm60RQnkQUC8ja7owpmL6d4GdDZ0cNNHyIhZEj4QYCxze6orsluAh8AnR0xKPR07weXJi8JGd3qqwAAAABJRU5ErkJggg==) no-repeat center center;
}
}
.upload_image_button:hover {
.overlay {
display: block;
}
}
.upload_image_button.remove .overlay {
background: #eee url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAWElEQVQYGY2OUQ6AMAxCZdm9jSev65K3YKNm+6EFBlVEHDxJJ3Pi0C72xlBNyTs3jU7wEUTTIB51GCp2CL8HLpHEdaOLb/N2dfuq9NT0zOo/M9q6EaImsd/uViMLVuD4KAAAAABJRU5ErkJggg==) no-repeat center center;
}
}
} }
.cancel_sale_schedule, .sale_schedule { }
float: right; }
}
tr.sale_price_dates_fields { .options {
td { border: 1px solid #eee;
padding-right: 24px; border-width: 1px 0;
position: relative; padding: .25em 0;
img {
position: absolute; label {
right: 0; display: inline-block;
bottom: 0; padding: 4px 1em 2px 0;
padding: 5px 0; }
margin: 0 0 6px;
} input[type=checkbox] {
} margin-top: 5px;
margin-right: 3px;
}
}
}
.form-row {
label {
display: block;
}
input[type=text],
input[type=number],
select {
width: 100%;
}
&.dimensions_field {
input {
width: 25%;
float: left;
margin-right: 1%;
&:last-of-type {
margin-right: 0;
} }
} }
} }
} }
.form-row-first,
.form-row-last {
width: 48%;
float: right;
}
.form-row-first {
clear: both;
float: left;
}
.form-row-full {
clear: both;
}
/* Tooltips */ /* Tooltips */
.tips { .tips {
cursor: help; cursor: help;

View File

@ -49,204 +49,190 @@ if ( ! defined( 'ABSPATH' ) ) {
<input type="hidden" name="variable_post_id[<?php echo $loop; ?>]" value="<?php echo esc_attr( $variation_id ); ?>" /> <input type="hidden" name="variable_post_id[<?php echo $loop; ?>]" value="<?php echo esc_attr( $variation_id ); ?>" />
<input type="hidden" class="variation_menu_order" name="variation_menu_order[<?php echo $loop; ?>]" value="<?php echo $loop; ?>" /> <input type="hidden" class="variation_menu_order" name="variation_menu_order[<?php echo $loop; ?>]" value="<?php echo $loop; ?>" />
</h3> </h3>
<table cellpadding="0" cellspacing="0" class="woocommerce_variable_attributes wc-metabox-content"> <div class="woocommerce_variable_attributes wc-metabox-content">
<tbody> <div class="data">
<tr> <p class="form-row form-row-first">
<td class="sku" colspan="2"> <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>
<?php if ( wc_product_sku_enabled() ) : ?> </p>
<label><?php _e( 'SKU', 'woocommerce' ); ?>: <a class="tips" data-tip="<?php _e( 'Enter a SKU for this variation or leave blank to use the parent product SKU.', 'woocommerce' ); ?>" href="#">[?]</a></label> <?php if ( wc_product_sku_enabled() ) : ?>
<input type="text" size="5" name="variable_sku[<?php echo $loop; ?>]" value="<?php if ( isset( $_sku ) ) echo esc_attr( $_sku ); ?>" placeholder="<?php echo esc_attr( $parent_data['sku'] ); ?>" /> <p class="sku form-row form-row-last">
<label><?php _e( 'SKU', 'woocommerce' ); ?>: <a class="tips" data-tip="<?php _e( 'Enter a SKU for this variation or leave blank to use the parent product SKU.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="text" size="5" name="variable_sku[<?php echo $loop; ?>]" value="<?php if ( isset( $_sku ) ) echo esc_attr( $_sku ); ?>" placeholder="<?php echo esc_attr( $parent_data['sku'] ); ?>" />
</p>
<?php else : ?>
<input type="hidden" name="variable_sku[<?php echo $loop; ?>]" value="<?php if ( isset( $_sku ) ) echo esc_attr( $_sku ); ?>" />
<?php endif; ?>
<p class="form-row form-row-full options">
<label><input type="checkbox" class="checkbox" name="variable_enabled[<?php echo $loop; ?>]" <?php checked( $variation_post_status, 'publish' ); ?> /> <?php _e( 'Enabled', 'woocommerce' ); ?></label>
<label><input type="checkbox" class="checkbox variable_is_downloadable" name="variable_is_downloadable[<?php echo $loop; ?>]" <?php checked( isset( $_downloadable ) ? $_downloadable : '', 'yes' ); ?> /> <?php _e( 'Downloadable', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enable this option if access is given to a downloadable file upon purchase of a product', 'woocommerce' ); ?>" href="#">[?]</a></label>
<label><input type="checkbox" class="checkbox variable_is_virtual" name="variable_is_virtual[<?php echo $loop; ?>]" <?php checked( isset( $_virtual ) ? $_virtual : '', 'yes' ); ?> /> <?php _e( 'Virtual', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enable this option if a product is not shipped or there is no shipping cost', 'woocommerce' ); ?>" href="#">[?]</a></label>
<?php if ( get_option( 'woocommerce_manage_stock' ) == 'yes' ) : ?>
<label><input type="checkbox" class="checkbox variable_manage_stock" name="variable_manage_stock[<?php echo $loop; ?>]" <?php checked( isset( $_manage_stock ) ? $_manage_stock : '', 'yes' ); ?> /> <?php _e( 'Manage stock?', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enable this option to enable stock management at variation level', 'woocommerce' ); ?>" href="#">[?]</a></label>
<?php endif; ?>
<?php do_action( 'woocommerce_variation_options', $loop, $variation_data, $variation ); ?>
</p>
<p class="form-row form-row-first">
<label><?php echo __( 'Regular Price:', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')'; ?></label>
<input type="text" size="5" name="variable_regular_price[<?php echo $loop; ?>]" value="<?php if ( isset( $_regular_price ) ) echo esc_attr( $_regular_price ); ?>" class="wc_input_price" placeholder="<?php _e( 'Variation price (required)', 'woocommerce' ); ?>" />
</p>
<p class="form-row form-row-last">
<label><?php echo __( 'Sale Price:', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')'; ?> <a href="#" class="sale_schedule"><?php _e( 'Schedule', 'woocommerce' ); ?></a><a href="#" class="cancel_sale_schedule" style="display:none"><?php _e( 'Cancel schedule', 'woocommerce' ); ?></a></label>
<input type="text" size="5" name="variable_sale_price[<?php echo $loop; ?>]" value="<?php if ( isset( $_sale_price ) ) echo esc_attr( $_sale_price ); ?>" class="wc_input_price" />
</p>
<div class="sale_price_dates_fields" style="display:none">
<p class="form-row form-row-first">
<label><?php _e( 'Sale start date:', 'woocommerce' ) ?></label>
<input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[<?php echo $loop; ?>]" value="<?php echo ! empty( $_sale_price_dates_from ) ? date_i18n( 'Y-m-d', $_sale_price_dates_from ) : ''; ?>" placeholder="<?php echo _x( 'From&hellip;', 'placeholder', 'woocommerce' ) ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
</p>
<p class="form-row form-row-last">
<label><?php _e( 'Sale end date:', 'woocommerce' ) ?></label>
<input type="text" name="variable_sale_price_dates_to[<?php echo $loop; ?>]" value="<?php echo ! empty( $_sale_price_dates_to ) ? date_i18n( 'Y-m-d', $_sale_price_dates_to ) : ''; ?>" placeholder="<?php echo _x('To&hellip;', 'placeholder', 'woocommerce') ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
</p>
</div>
<?php if ( get_option( 'woocommerce_manage_stock' ) == 'yes' ) : ?>
<div class="show_if_variation_manage_stock">
<p class="form-row form-row-first">
<label><?php _e( 'Stock Qty:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enter a quantity to enable stock management at variation level, or leave blank to use the parent product\'s options.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="number" size="5" name="variable_stock[<?php echo $loop; ?>]" value="<?php if ( isset( $_stock ) ) echo esc_attr( $_stock ); ?>" step="any" />
</p>
<p class="form-row form-row-last">
<label><?php _e( 'Allow Backorders?', 'woocommerce' ); ?></label>
<select name="variable_backorders[<?php echo $loop; ?>]">
<?php
foreach ( $parent_data['backorder_options'] as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $key === $_backorders, true, false ) . '>' . esc_html( $value ) . '</option>';
}
?>
</select>
</p>
</div>
<div class="">
<p class="form-row form-row-full">
<label><?php _e( 'Stock status', 'woocommerce' ); ?> <a class="tips" data-tip="<?php esc_attr_e( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<select name="variable_stock_status[<?php echo $loop; ?>]">
<?php
foreach ( $parent_data['stock_status_options'] as $key => $value ) {
echo '<option value="' . esc_attr( $key === $_stock_status ? '' : $key ) . '" ' . selected( $key === $_stock_status, true, false ) . '>' . esc_html( $value ) . '</option>';
}
?>
</select>
</p>
</div>
<?php endif; ?>
<?php if ( wc_product_weight_enabled() || wc_product_dimensions_enabled() ) : ?>
<div>
<?php if ( wc_product_weight_enabled() ) : ?>
<p class="form-row hide_if_variation_virtual form-row-first">
<label><?php echo __( 'Weight', 'woocommerce' ) . ' (' . esc_html( get_option( 'woocommerce_weight_unit' ) ) . '):'; ?> <a class="tips" data-tip="<?php _e( 'Enter a weight for this variation or leave blank to use the parent product weight.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="text" size="5" name="variable_weight[<?php echo $loop; ?>]" value="<?php if ( isset( $_weight ) ) echo esc_attr( $_weight ); ?>" placeholder="<?php echo esc_attr( $parent_data['weight'] ); ?>" class="wc_input_decimal" />
</p>
<?php else : ?> <?php else : ?>
<input type="hidden" name="variable_sku[<?php echo $loop; ?>]" value="<?php if ( isset( $_sku ) ) echo esc_attr( $_sku ); ?>" /> <p>&nbsp;</p>
<?php endif; ?> <?php endif; ?>
</td> <?php if ( wc_product_dimensions_enabled() ) : ?>
<td class="data" rowspan="2"> <p class="form-row dimensions_field hide_if_variation_virtual form-row-last">
<table cellspacing="0" cellpadding="0" class="data_table"> <label for="product_length"><?php echo __( 'Dimensions (L&times;W&times;H)', 'woocommerce' ) . ' (' . esc_html( get_option( 'woocommerce_dimension_unit' ) ) . '):'; ?></label>
<tr class="variable_pricing"> <input id="product_length" class="input-text wc_input_decimal" size="6" type="text" name="variable_length[<?php echo $loop; ?>]" value="<?php if ( isset( $_length ) ) echo esc_attr( $_length ); ?>" placeholder="<?php echo esc_attr( $parent_data['length'] ); ?>" />
<td> <input class="input-text wc_input_decimal" size="6" type="text" name="variable_width[<?php echo $loop; ?>]" value="<?php if ( isset( $_width ) ) echo esc_attr( $_width ); ?>" placeholder="<?php echo esc_attr( $parent_data['width'] ); ?>" />
<label><?php echo __( 'Regular Price:', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')'; ?></label> <input class="input-text wc_input_decimal last" size="6" type="text" name="variable_height[<?php echo $loop; ?>]" value="<?php if ( isset( $_height ) ) echo esc_attr( $_height ); ?>" placeholder="<?php echo esc_attr( $parent_data['height'] ); ?>" />
<input type="text" size="5" name="variable_regular_price[<?php echo $loop; ?>]" value="<?php if ( isset( $_regular_price ) ) echo esc_attr( $_regular_price ); ?>" class="wc_input_price" placeholder="<?php _e( 'Variation price (required)', 'woocommerce' ); ?>" /> </p>
</td> <?php else : ?>
<td> <p>&nbsp;</p>
<label><?php echo __( 'Sale Price:', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')'; ?> <a href="#" class="sale_schedule"><?php _e( 'Schedule', 'woocommerce' ); ?></a><a href="#" class="cancel_sale_schedule" style="display:none"><?php _e( 'Cancel schedule', 'woocommerce' ); ?></a></label> <?php endif; ?>
<input type="text" size="5" name="variable_sale_price[<?php echo $loop; ?>]" value="<?php if ( isset( $_sale_price ) ) echo esc_attr( $_sale_price ); ?>" class="wc_input_price" /> </div>
</td> <?php endif; ?>
</tr> <div>
<p class="form-row hide_if_variation_virtual form-row-full"><label><?php _e( 'Shipping class:', 'woocommerce' ); ?></label> <?php
$args = array(
'taxonomy' => 'product_shipping_class',
'hide_empty' => 0,
'show_option_none' => __( 'Same as parent', 'woocommerce' ),
'name' => 'variable_shipping_class[' . $loop . ']',
'id' => '',
'selected' => isset( $shipping_class ) ? esc_attr( $shipping_class ) : '',
'echo' => 0
);
<tr class="sale_price_dates_fields" style="display:none"> echo wp_dropdown_categories( $args );
<td> ?></p>
<label><?php _e( 'Sale start date:', 'woocommerce' ) ?></label> <p class="form-row form-row-full">
<input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[<?php echo $loop; ?>]" value="<?php echo ! empty( $_sale_price_dates_from ) ? date_i18n( 'Y-m-d', $_sale_price_dates_from ) : ''; ?>" placeholder="<?php echo _x( 'From&hellip;', 'placeholder', 'woocommerce' ) ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" /> <?php if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) : ?>
</td> <label><?php _e( 'Tax class:', 'woocommerce' ); ?></label>
<td> <select name="variable_tax_class[<?php echo $loop; ?>]">
<label><?php _e( 'Sale end date:', 'woocommerce' ) ?></label> <option value="parent" <?php selected( is_null( $_tax_class ), true ); ?>><?php _e( 'Same as parent', 'woocommerce' ); ?></option>
<input type="text" name="variable_sale_price_dates_to[<?php echo $loop; ?>]" value="<?php echo ! empty( $_sale_price_dates_to ) ? date_i18n( 'Y-m-d', $_sale_price_dates_to ) : ''; ?>" placeholder="<?php echo _x('To&hellip;', 'placeholder', 'woocommerce') ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" /> <?php
</td> foreach ( $parent_data['tax_class_options'] as $key => $value )
</tr> echo '<option value="' . esc_attr( $key ) . '" ' . selected( $key === $_tax_class, true, false ) . '>' . esc_html( $value ) . '</option>';
?></select>
<?php if ( get_option( 'woocommerce_manage_stock' ) == 'yes' ) : ?> <?php endif; ?>
<tr class="show_if_variation_manage_stock"> </p>
<td> </div>
<label><?php _e( 'Stock Qty:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enter a quantity to enable stock management at variation level, or leave blank to use the parent product\'s options.', 'woocommerce' ); ?>" href="#">[?]</a></label> <div class="show_if_variation_downloadable" style="display:none">
<input type="number" size="5" name="variable_stock[<?php echo $loop; ?>]" value="<?php if ( isset( $_stock ) ) echo esc_attr( $_stock ); ?>" step="any" /> <div class="form-row form-row-full downloadable_files">
</td> <label><?php _e( 'Downloadable Files', 'woocommerce' ); ?>:</label>
<td> <table class="widefat">
<label><?php _e( 'Allow Backorders?', 'woocommerce' ); ?></label> <thead>
<select name="variable_backorders[<?php echo $loop; ?>]"> <div>
<?php <th><?php _e( 'Name', 'woocommerce' ); ?> <span class="tips" data-tip="<?php _e( 'This is the name of the download shown to the customer.', 'woocommerce' ); ?>">[?]</span></th>
foreach ( $parent_data['backorder_options'] as $key => $value ) { <th colspan="2"><?php _e( 'File URL', 'woocommerce' ); ?> <span class="tips" data-tip="<?php _e( 'This is the URL or absolute path to the file which customers will get access to.', 'woocommerce' ); ?>">[?]</span></th>
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $key === $_backorders, true, false ) . '>' . esc_html( $value ) . '</option>'; <th>&nbsp;</th>
} </div>
?> </thead>
</select> <tbody>
</td> <?php
</tr> if ( $_downloadable_files ) {
<tr class=""> foreach ( $_downloadable_files as $key => $file ) {
<td colspan="2"> if ( ! is_array( $file ) ) {
<label><?php _e( 'Stock status', 'woocommerce' ); ?> <a class="tips" data-tip="<?php esc_attr_e( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ); ?>" href="#">[?]</a></label> $file = array(
<select name="variable_stock_status[<?php echo $loop; ?>]"> 'file' => $file,
<?php 'name' => ''
foreach ( $parent_data['stock_status_options'] as $key => $value ) { );
echo '<option value="' . esc_attr( $key === $_stock_status ? '' : $key ) . '" ' . selected( $key === $_stock_status, true, false ) . '>' . esc_html( $value ) . '</option>'; }
} include( 'html-product-variation-download.php' );
?> }
</select> }
</td> ?>
</tr> </tbody>
<?php endif; ?> <tfoot>
<div>
<?php if ( wc_product_weight_enabled() || wc_product_dimensions_enabled() ) : ?> <th colspan="4">
<tr> <a href="#" class="button insert" data-row="<?php
<?php if ( wc_product_weight_enabled() ) : ?> $file = array(
<td class="hide_if_variation_virtual"> 'file' => '',
<label><?php echo __( 'Weight', 'woocommerce' ) . ' (' . esc_html( get_option( 'woocommerce_weight_unit' ) ) . '):'; ?> <a class="tips" data-tip="<?php _e( 'Enter a weight for this variation or leave blank to use the parent product weight.', 'woocommerce' ); ?>" href="#">[?]</a></label> 'name' => ''
<input type="text" size="5" name="variable_weight[<?php echo $loop; ?>]" value="<?php if ( isset( $_weight ) ) echo esc_attr( $_weight ); ?>" placeholder="<?php echo esc_attr( $parent_data['weight'] ); ?>" class="wc_input_decimal" /> );
</td> ob_start();
<?php else : ?> include( 'html-product-variation-download.php' );
<td>&nbsp;</td> echo esc_attr( ob_get_clean() );
<?php endif; ?> ?>"><?php _e( 'Add File', 'woocommerce' ); ?></a>
<?php if ( wc_product_dimensions_enabled() ) : ?> </th>
<td class="dimensions_field hide_if_variation_virtual"> </div>
<label for="product_length"><?php echo __( 'Dimensions (L&times;W&times;H)', 'woocommerce' ) . ' (' . esc_html( get_option( 'woocommerce_dimension_unit' ) ) . '):'; ?></label> </tfoot>
<input id="product_length" class="input-text wc_input_decimal" size="6" type="text" name="variable_length[<?php echo $loop; ?>]" value="<?php if ( isset( $_length ) ) echo esc_attr( $_length ); ?>" placeholder="<?php echo esc_attr( $parent_data['length'] ); ?>" />
<input class="input-text wc_input_decimal" size="6" type="text" name="variable_width[<?php echo $loop; ?>]" value="<?php if ( isset( $_width ) ) echo esc_attr( $_width ); ?>" placeholder="<?php echo esc_attr( $parent_data['width'] ); ?>" />
<input class="input-text wc_input_decimal last" size="6" type="text" name="variable_height[<?php echo $loop; ?>]" value="<?php if ( isset( $_height ) ) echo esc_attr( $_height ); ?>" placeholder="<?php echo esc_attr( $parent_data['height'] ); ?>" />
</td>
<?php else : ?>
<td>&nbsp;</td>
<?php endif; ?>
</tr>
<?php endif; ?>
<tr>
<td class="hide_if_variation_virtual"><label><?php _e( 'Shipping class:', 'woocommerce' ); ?></label> <?php
$args = array(
'taxonomy' => 'product_shipping_class',
'hide_empty' => 0,
'show_option_none' => __( 'Same as parent', 'woocommerce' ),
'name' => 'variable_shipping_class[' . $loop . ']',
'id' => '',
'selected' => isset( $shipping_class ) ? esc_attr( $shipping_class ) : '',
'echo' => 0
);
echo wp_dropdown_categories( $args );
?></td>
<td>
<?php if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) : ?>
<label><?php _e( 'Tax class:', 'woocommerce' ); ?></label>
<select name="variable_tax_class[<?php echo $loop; ?>]">
<option value="parent" <?php selected( is_null( $_tax_class ), true ); ?>><?php _e( 'Same as parent', 'woocommerce' ); ?></option>
<?php
foreach ( $parent_data['tax_class_options'] as $key => $value )
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $key === $_tax_class, true, false ) . '>' . esc_html( $value ) . '</option>';
?></select>
<?php endif; ?>
</td>
</tr>
<tr class="show_if_variation_downloadable" style="display:none">
<td colspan="2">
<div class="form-field downloadable_files">
<label><?php _e( 'Downloadable Files', 'woocommerce' ); ?>:</label>
<table class="widefat">
<thead>
<tr>
<th><?php _e( 'Name', 'woocommerce' ); ?> <span class="tips" data-tip="<?php _e( 'This is the name of the download shown to the customer.', 'woocommerce' ); ?>">[?]</span></th>
<th colspan="2"><?php _e( 'File URL', 'woocommerce' ); ?> <span class="tips" data-tip="<?php _e( 'This is the URL or absolute path to the file which customers will get access to.', 'woocommerce' ); ?>">[?]</span></th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
if ( $_downloadable_files ) {
foreach ( $_downloadable_files as $key => $file ) {
if ( ! is_array( $file ) ) {
$file = array(
'file' => $file,
'name' => ''
);
}
include( 'html-product-variation-download.php' );
}
}
?>
</tbody>
<tfoot>
<tr>
<th colspan="4">
<a href="#" class="button insert" data-row="<?php
$file = array(
'file' => '',
'name' => ''
);
ob_start();
include( 'html-product-variation-download.php' );
echo esc_attr( ob_get_clean() );
?>"><?php _e( 'Add File', 'woocommerce' ); ?></a>
</th>
</tr>
</tfoot>
</table>
</div>
</td>
</tr>
<tr class="show_if_variation_downloadable">
<td>
<div>
<label><?php _e( 'Download Limit:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Leave blank for unlimited re-downloads.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="number" size="5" name="variable_download_limit[<?php echo $loop; ?>]" value="<?php if ( isset( $_download_limit ) ) echo esc_attr( $_download_limit ); ?>" placeholder="<?php _e( 'Unlimited', 'woocommerce' ); ?>" step="1" min="0" />
</div>
</td>
<td>
<div>
<label><?php _e( 'Download Expiry:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="number" size="5" name="variable_download_expiry[<?php echo $loop; ?>]" value="<?php if ( isset( $_download_expiry ) ) echo esc_attr( $_download_expiry ); ?>" placeholder="<?php _e( 'Unlimited', 'woocommerce' ); ?>" step="1" min="0" />
</div>
</td>
</tr>
<?php do_action( 'woocommerce_product_after_variable_attributes', $loop, $variation_data, $variation ); ?>
</table> </table>
</td> </div>
</tr> </div>
<tr> <div class="show_if_variation_downloadable">
<td class="upload_image"> <p class="form-row form-row-first">
<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 ); ?>" /><span class="overlay"></span></a> <label><?php _e( 'Download Limit:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Leave blank for unlimited re-downloads.', 'woocommerce' ); ?>" href="#">[?]</a></label>
</td> <input type="number" size="5" name="variable_download_limit[<?php echo $loop; ?>]" value="<?php if ( isset( $_download_limit ) ) echo esc_attr( $_download_limit ); ?>" placeholder="<?php _e( 'Unlimited', 'woocommerce' ); ?>" step="1" min="0" />
<td class="options"> </p>
<label><input type="checkbox" class="checkbox" name="variable_enabled[<?php echo $loop; ?>]" <?php checked( $variation_post_status, 'publish' ); ?> /> <?php _e( 'Enabled', 'woocommerce' ); ?></label> <p class="form-row form-row-last">
<label><?php _e( 'Download Expiry:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<label><input type="checkbox" class="checkbox variable_is_downloadable" name="variable_is_downloadable[<?php echo $loop; ?>]" <?php checked( isset( $_downloadable ) ? $_downloadable : '', 'yes' ); ?> /> <?php _e( 'Downloadable', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enable this option if access is given to a downloadable file upon purchase of a product', 'woocommerce' ); ?>" href="#">[?]</a></label> <input type="number" size="5" name="variable_download_expiry[<?php echo $loop; ?>]" value="<?php if ( isset( $_download_expiry ) ) echo esc_attr( $_download_expiry ); ?>" placeholder="<?php _e( 'Unlimited', 'woocommerce' ); ?>" step="1" min="0" />
</p>
<label><input type="checkbox" class="checkbox variable_is_virtual" name="variable_is_virtual[<?php echo $loop; ?>]" <?php checked( isset( $_virtual ) ? $_virtual : '', 'yes' ); ?> /> <?php _e( 'Virtual', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enable this option if a product is not shipped or there is no shipping cost', 'woocommerce' ); ?>" href="#">[?]</a></label> </div>
<?php do_action( 'woocommerce_product_after_variable_attributes', $loop, $variation_data, $variation ); ?>
<?php if ( get_option( 'woocommerce_manage_stock' ) == 'yes' ) : ?> </div>
</div>
<label><input type="checkbox" class="checkbox variable_manage_stock" name="variable_manage_stock[<?php echo $loop; ?>]" <?php checked( isset( $_manage_stock ) ? $_manage_stock : '', 'yes' ); ?> /> <?php _e( 'Manage stock?', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enable this option to enable stock management at variation level', 'woocommerce' ); ?>" href="#">[?]</a></label>
<?php endif; ?>
<?php do_action( 'woocommerce_variation_options', $loop, $variation_data, $variation ); ?>
</td>
</tr>
</tbody>
</table>
</div> </div>