2014-07-17 20:17:54 +00:00
< ? php
2014-09-20 20:05:06 +00:00
2014-07-17 20:17:54 +00:00
if ( ! defined ( 'ABSPATH' ) ) {
exit ; // Exit if accessed directly
}
2014-07-19 04:08:02 +00:00
2014-08-12 11:54:41 +00:00
global $wpdb ;
2014-07-28 16:08:11 +00:00
// Get the payment gateway
$payment_gateway = wc_get_payment_gateway_by_order ( $order );
// Get line items
2014-09-01 15:35:04 +00:00
$line_items = $order -> get_items ( apply_filters ( 'woocommerce_admin_order_item_types' , 'line_item' ) );
$line_items_fee = $order -> get_items ( 'fee' );
$line_items_shipping = $order -> get_items ( 'shipping' );
2014-07-28 16:08:11 +00:00
2014-11-18 16:45:29 +00:00
if ( wc_tax_enabled () ) {
2014-07-19 04:08:02 +00:00
$order_taxes = $order -> get_taxes ();
2014-11-21 13:06:30 +00:00
$tax_classes = WC_Tax :: get_tax_classes ();
2014-07-19 04:08:02 +00:00
$classes_options = array ();
$classes_options [ '' ] = __ ( 'Standard' , 'woocommerce' );
2015-04-01 13:33:56 +00:00
if ( ! empty ( $tax_classes ) ) {
2014-07-19 04:08:02 +00:00
foreach ( $tax_classes as $class ) {
$classes_options [ sanitize_title ( $class ) ] = $class ;
}
}
2014-07-28 16:08:11 +00:00
// Older orders won't have line taxes so we need to handle them differently :(
2014-09-01 15:35:04 +00:00
$tax_data = '' ;
if ( $line_items ) {
$check_item = current ( $line_items );
$tax_data = maybe_unserialize ( isset ( $check_item [ 'line_tax_data' ] ) ? $check_item [ 'line_tax_data' ] : '' );
} elseif ( $line_items_shipping ) {
$check_item = current ( $line_items_shipping );
$tax_data = maybe_unserialize ( isset ( $check_item [ 'taxes' ] ) ? $check_item [ 'taxes' ] : '' );
} elseif ( $line_items_fee ) {
$check_item = current ( $line_items_fee );
$tax_data = maybe_unserialize ( isset ( $check_item [ 'line_tax_data' ] ) ? $check_item [ 'line_tax_data' ] : '' );
}
2014-07-28 16:08:11 +00:00
$legacy_order = ! empty ( $order_taxes ) && empty ( $tax_data ) && ! is_array ( $tax_data );
$show_tax_columns = ! $legacy_order || sizeof ( $order_taxes ) === 1 ;
}
2014-07-17 20:17:54 +00:00
?>
2014-07-18 20:24:34 +00:00
< div class = " woocommerce_order_items_wrapper wc-order-items-editable " >
2014-07-17 20:17:54 +00:00
< table cellpadding = " 0 " cellspacing = " 0 " class = " woocommerce_order_items " >
< thead >
< tr >
< th >< input type = " checkbox " class = " check-column " /></ th >
2014-11-26 15:37:06 +00:00
< th class = " item sortable " colspan = " 2 " data - sort = " string-ins " >< ? php _e ( 'Item' , 'woocommerce' ); ?> </th>
2014-07-17 20:17:54 +00:00
2015-04-22 02:13:55 +00:00
< ? php do_action ( 'woocommerce_admin_order_item_headers' , $order ); ?>
2014-07-17 20:17:54 +00:00
2014-11-26 15:37:06 +00:00
< th class = " item_cost sortable " data - sort = " float " >< ? php _e ( 'Cost' , 'woocommerce' ); ?> </th>
< th class = " quantity sortable " data - sort = " int " >< ? php _e ( 'Qty' , 'woocommerce' ); ?> </th>
< th class = " line_cost sortable " data - sort = " float " >< ? php _e ( 'Total' , 'woocommerce' ); ?> </th>
2014-07-17 20:17:54 +00:00
2014-07-19 04:08:02 +00:00
< ? php
2015-01-15 15:19:19 +00:00
if ( empty ( $legacy_order ) && ! empty ( $order_taxes ) ) :
2014-07-20 23:53:43 +00:00
foreach ( $order_taxes as $tax_id => $tax_item ) :
2014-07-19 04:08:02 +00:00
$tax_class = wc_get_tax_class_by_tax_id ( $tax_item [ 'rate_id' ] );
$tax_class_name = isset ( $classes_options [ $tax_class ] ) ? $classes_options [ $tax_class ] : __ ( 'Tax' , 'woocommerce' );
2014-07-22 10:54:59 +00:00
$column_label = ! empty ( $tax_item [ 'label' ] ) ? $tax_item [ 'label' ] : __ ( 'Tax' , 'woocommerce' );
2014-07-19 04:08:02 +00:00
?>
2014-07-22 10:54:59 +00:00
< th class = " line_tax tips " data - tip = " <?php
echo esc_attr ( $tax_item [ 'name' ] . ' (' . $tax_class_name . ')' );
?> ">
2014-07-22 10:56:52 +00:00
< ? php echo esc_attr ( $column_label ); ?>
2014-07-22 15:42:17 +00:00
< input type = " hidden " class = " order-tax-id " name = " order_taxes[<?php echo $tax_id ; ?>] " value = " <?php echo esc_attr( $tax_item['rate_id'] ); ?> " >
2014-07-22 10:56:52 +00:00
< a class = " delete-order-tax " href = " # " data - rate_id = " <?php echo $tax_id ; ?> " ></ a >
2014-07-20 23:53:43 +00:00
</ th >
2014-07-19 04:08:02 +00:00
< ? php
endforeach ;
endif ;
?>
2014-07-17 20:17:54 +00:00
< th class = " wc-order-edit-line-item " width = " 1% " >& nbsp ; </ th >
</ tr >
</ thead >
2014-07-22 13:18:11 +00:00
< tbody id = " order_line_items " >
< ? php
2014-07-28 16:08:11 +00:00
foreach ( $line_items as $item_id => $item ) {
2014-07-22 13:18:11 +00:00
$_product = $order -> get_product_from_item ( $item );
$item_meta = $order -> get_item_meta ( $item_id );
2014-07-22 15:13:35 +00:00
2014-07-22 13:18:11 +00:00
include ( 'html-order-item.php' );
2014-07-17 20:17:54 +00:00
2015-07-06 16:09:06 +00:00
do_action ( 'woocommerce_order_item_' . $item [ 'type' ] . '_html' , $item_id , $item , $order );
2014-07-22 13:18:11 +00:00
}
?>
</ tbody >
2014-07-22 13:42:12 +00:00
< tbody id = " order_shipping_line_items " >
2014-07-22 13:18:11 +00:00
< ? php
2014-07-22 13:42:12 +00:00
$shipping_methods = WC () -> shipping () ? WC () -> shipping -> load_shipping_methods () : array ();
2014-09-01 15:35:04 +00:00
foreach ( $line_items_shipping as $item_id => $item ) {
2014-07-22 13:42:12 +00:00
include ( 'html-order-shipping.php' );
2014-07-22 13:18:11 +00:00
}
?>
</ tbody >
2014-07-22 13:42:12 +00:00
< tbody id = " order_fee_line_items " >
2014-07-22 13:18:11 +00:00
< ? php
2014-09-01 15:35:04 +00:00
foreach ( $line_items_fee as $item_id => $item ) {
2014-07-22 13:42:12 +00:00
include ( 'html-order-fee.php' );
2014-07-22 13:18:11 +00:00
}
?>
</ tbody >
< tbody id = " order_refunds " >
< ? php
if ( $refunds = $order -> get_refunds () ) {
foreach ( $refunds as $refund ) {
include ( 'html-order-refund.php' );
2014-07-17 20:17:54 +00:00
}
2014-07-22 13:18:11 +00:00
}
?>
2014-07-17 20:17:54 +00:00
</ tbody >
</ table >
</ div >
2014-07-18 20:24:34 +00:00
< div class = " wc-order-data-row wc-order-totals-items wc-order-items-editable " >
2014-07-23 10:47:02 +00:00
< ? php
$coupons = $order -> get_items ( array ( 'coupon' ) );
if ( $coupons ) {
?>
< div class = " wc-used-coupons " >
< ul class = " wc_coupon_list " >< ? php
2014-12-09 16:06:34 +00:00
echo '<li><strong>' . __ ( 'Coupon(s) Used' , 'woocommerce' ) . '</strong></li>' ;
2014-07-23 10:47:02 +00:00
foreach ( $coupons as $item_id => $item ) {
$post_id = $wpdb -> get_var ( $wpdb -> prepare ( " SELECT ID FROM { $wpdb -> posts } WHERE post_title = %s AND post_type = 'shop_coupon' AND post_status = 'publish' LIMIT 1; " , $item [ 'name' ] ) );
$link = $post_id ? add_query_arg ( array ( 'post' => $post_id , 'action' => 'edit' ), admin_url ( 'post.php' ) ) : add_query_arg ( array ( 's' => $item [ 'name' ], 'post_status' => 'all' , 'post_type' => 'shop_coupon' ), admin_url ( 'edit.php' ) );
2014-12-09 16:06:34 +00:00
echo '<li class="code"><a href="' . esc_url ( $link ) . '" class="tips" data-tip="' . esc_attr ( wc_price ( $item [ 'discount_amount' ], array ( 'currency' => $order -> get_order_currency () ) ) ) . '"><span>' . esc_html ( $item [ 'name' ] ) . '</span></a></li>' ;
2014-07-23 10:47:02 +00:00
}
?> </ul>
</ div >
< ? php
}
?>
2014-07-17 21:17:42 +00:00
< table class = " wc-order-totals " >
2014-11-25 11:05:14 +00:00
< tr >
< td class = " label " >< ? php _e ( 'Discount' , 'woocommerce' ); ?> <span class="tips" data-tip="<?php _e( 'This is the total discount. Discounts are defined per line item.', 'woocommerce' ); ?>">[?]</span>:</td>
< td class = " total " >
< ? php echo wc_price ( $order -> get_total_discount (), array ( 'currency' => $order -> get_order_currency () ) ); ?>
</ td >
< td width = " 1% " ></ td >
</ tr >
< ? php do_action ( 'woocommerce_admin_order_totals_after_discount' , $order -> id ); ?>
2014-07-17 21:17:42 +00:00
< tr >
2014-07-18 23:27:10 +00:00
< td class = " label " >< ? php _e ( 'Shipping' , 'woocommerce' ); ?> <span class="tips" data-tip="<?php _e( 'This is the shipping and handling total costs for the order.', 'woocommerce' ); ?>">[?]</span>:</td>
2015-06-01 10:06:11 +00:00
< td class = " total " >< ? php
if ( ( $refunded = $order -> get_total_shipping_refunded () ) > 0 ) {
echo '<del>' . strip_tags ( wc_price ( $order -> get_total_shipping (), array ( 'currency' => $order -> get_order_currency () ) ) ) . '</del> <ins>' . wc_price ( $order -> get_total_shipping () - $refunded , array ( 'currency' => $order -> get_order_currency () ) ) . '</ins>' ;
} else {
echo wc_price ( $order -> get_total_shipping (), array ( 'currency' => $order -> get_order_currency () ) );
}
?> </td>
2014-07-18 20:24:34 +00:00
< td width = " 1% " ></ td >
2014-07-17 21:17:42 +00:00
</ tr >
2014-08-29 01:56:30 +00:00
< ? php do_action ( 'woocommerce_admin_order_totals_after_shipping' , $order -> id ); ?>
2014-11-18 16:45:29 +00:00
< ? php if ( wc_tax_enabled () ) : ?>
2014-07-28 16:08:11 +00:00
< ? php foreach ( $order -> get_tax_totals () as $code => $tax ) : ?>
< tr >
< td class = " label " >< ? php echo $tax -> label ; ?> :</td>
2015-06-01 10:06:11 +00:00
< td class = " total " >< ? php
if ( ( $refunded = $order -> get_total_tax_refunded_by_rate_id ( $tax -> rate_id ) ) > 0 ) {
echo '<del>' . strip_tags ( $tax -> formatted_amount ) . '</del> <ins>' . wc_price ( $tax -> amount - $refunded , array ( 'currency' => $order -> get_order_currency () ) ) . '</ins>' ;
} else {
echo $tax -> formatted_amount ;
}
?> </td>
2014-07-28 16:08:11 +00:00
< td width = " 1% " ></ td >
</ tr >
< ? php endforeach ; ?>
2014-07-17 20:17:54 +00:00
< ? php endif ; ?>
2014-08-29 01:56:30 +00:00
< ? php do_action ( 'woocommerce_admin_order_totals_after_tax' , $order -> id ); ?>
2014-07-17 21:17:42 +00:00
< tr >
< td class = " label " >< ? php _e ( 'Order Total' , 'woocommerce' ); ?> :</td>
< td class = " total " >
2014-11-27 10:04:14 +00:00
< div class = " view " >< ? php
if ( $order -> get_total_refunded () > 0 ) {
echo '<del>' . strip_tags ( $order -> get_formatted_order_total () ) . '</del> <ins>' . wc_price ( $order -> get_total () - $order -> get_total_refunded (), array ( 'currency' => $order -> get_order_currency () ) ) . '</ins>' ;
} else {
echo esc_html ( strip_tags ( $order -> get_formatted_order_total () ) );
}
?> </div>
2014-07-17 21:17:42 +00:00
< div class = " edit " style = " display: none; " >
< input type = " text " class = " wc_input_price " id = " _order_total " name = " _order_total " placeholder = " <?php echo wc_format_localized_price( 0 ); ?> " value = " <?php echo ( isset( $data['_order_total'] [0] ) ) ? esc_attr( wc_format_localized_price( $data['_order_total'] [0] ) ) : ''; ?> " />
< div class = " clear " ></ div >
</ div >
</ td >
2014-09-03 09:09:04 +00:00
< td >< ? php if ( $order -> is_editable () ) : ?> <div class="wc-order-edit-line-item-actions"><a class="edit-order-item" href="#"></a></div><?php endif; ?></td>
2014-07-17 21:17:42 +00:00
</ tr >
2014-08-29 01:56:30 +00:00
< ? php do_action ( 'woocommerce_admin_order_totals_after_total' , $order -> id ); ?>
2014-07-28 10:41:47 +00:00
< tr >
< td class = " label refunded-total " >< ? php _e ( 'Refunded' , 'woocommerce' ); ?> :</td>
2014-09-29 03:52:28 +00:00
< td class = " total refunded-total " >-< ? php echo wc_price ( $order -> get_total_refunded (), array ( 'currency' => $order -> get_order_currency () ) ); ?> </td>
2014-07-28 10:41:47 +00:00
< td width = " 1% " ></ td >
</ tr >
2014-08-29 01:56:30 +00:00
< ? php do_action ( 'woocommerce_admin_order_totals_after_refunded' , $order -> id ); ?>
2014-07-17 21:17:42 +00:00
</ table >
< div class = " clear " ></ div >
2014-07-17 20:17:54 +00:00
</ div >
< div class = " wc-order-data-row wc-order-bulk-actions " >
2014-07-18 20:24:34 +00:00
< p class = " bulk-actions " >
2014-07-17 20:17:54 +00:00
< select >
< option value = " " >< ? php _e ( 'Actions' , 'woocommerce' ); ?> </option>
2014-09-03 09:09:04 +00:00
< ? php if ( $order -> is_editable () ) : ?>
2014-07-22 19:25:37 +00:00
< optgroup label = " <?php _e( 'Edit', 'woocommerce' ); ?> " >
< option value = " delete " >< ? php _e ( 'Delete selected line item(s)' , 'woocommerce' ); ?> </option>
</ optgroup >
< ? php endif ; ?>
2014-07-17 20:17:54 +00:00
< optgroup label = " <?php _e( 'Stock Actions', 'woocommerce' ); ?> " >
< option value = " reduce_stock " >< ? php _e ( 'Reduce line item stock' , 'woocommerce' ); ?> </option>
< option value = " increase_stock " >< ? php _e ( 'Increase line item stock' , 'woocommerce' ); ?> </option>
</ optgroup >
</ select >
< button type = " button " class = " button do_bulk_action wc-reload " title = " <?php _e( 'Apply', 'woocommerce' ); ?> " >< span >< ? php _e ( 'Apply' , 'woocommerce' ); ?> </span></button>
</ p >
2014-07-18 20:24:34 +00:00
< p class = " add-items " >
2014-09-03 09:09:04 +00:00
< ? php if ( $order -> is_editable () ) : ?>
2014-07-22 19:25:37 +00:00
< button type = " button " class = " button add-line-item " >< ? php _e ( 'Add line item(s)' , 'woocommerce' ); ?> </button>
2014-09-18 10:32:25 +00:00
< ? php else : ?>
< span class = " description tips " data - tip = " <?php esc_attr_e( 'To edit this order change the status back to " Pending " ', 'woocommerce' ); ?> " >< ? php _e ( 'This order has been paid for and is no longer editable' , 'woocommerce' ); ?> </span>
2014-07-22 19:25:37 +00:00
< ? php endif ; ?>
2014-11-18 16:45:29 +00:00
< ? php if ( wc_tax_enabled () && $order -> is_editable () ) : ?>
2014-07-22 10:54:59 +00:00
< button type = " button " class = " button add-order-tax " >< ? php _e ( 'Add Tax' , 'woocommerce' ); ?> </button>
< ? php endif ; ?>
2014-08-29 05:04:51 +00:00
< ? php if ( ( $order -> get_total () - $order -> get_total_refunded () ) > 0 ) : ?>
< button type = " button " class = " button refund-items " >< ? php _e ( 'Refund' , 'woocommerce' ); ?> </button>
< ? php endif ; ?>
2014-09-25 00:41:13 +00:00
< ? php
// allow adding custom buttons
do_action ( 'woocommerce_order_item_add_action_buttons' , $order );
?>
2014-09-03 09:09:04 +00:00
< ? php if ( $order -> is_editable () ) : ?>
2014-09-25 00:41:13 +00:00
< button type = " button " class = " button button-primary calculate-tax-action " >< ? php _e ( 'Calculate Taxes' , 'woocommerce' ); ?> </button>
< button type = " button " class = " button button-primary calculate-action " >< ? php _e ( 'Calculate Total' , 'woocommerce' ); ?> </button>
2014-07-22 19:25:37 +00:00
< ? php endif ; ?>
2014-07-17 20:17:54 +00:00
</ p >
</ div >
< div class = " wc-order-data-row wc-order-add-item " style = " display:none; " >
< button type = " button " class = " button add-order-item " >< ? php _e ( 'Add product(s)' , 'woocommerce' ); ?> </button>
< button type = " button " class = " button add-order-fee " >< ? php _e ( 'Add fee' , 'woocommerce' ); ?> </button>
< button type = " button " class = " button add-order-shipping " >< ? php _e ( 'Add shipping cost' , 'woocommerce' ); ?> </button>
< button type = " button " class = " button cancel-action " >< ? php _e ( 'Cancel' , 'woocommerce' ); ?> </button>
< button type = " button " class = " button button-primary save-action " >< ? php _e ( 'Save' , 'woocommerce' ); ?> </button>
2014-09-18 16:05:42 +00:00
< ? php
// allow adding custom buttons
2014-09-19 15:05:25 +00:00
do_action ( 'woocommerce_order_item_add_line_buttons' , $order );
2014-09-18 16:05:42 +00:00
?>
2014-07-17 20:17:54 +00:00
</ div >
2014-08-29 05:04:51 +00:00
< ? php if ( ( $order -> get_total () - $order -> get_total_refunded () ) > 0 ) : ?>
2014-07-18 23:27:10 +00:00
< div class = " wc-order-data-row wc-order-refund-items " style = " display: none; " >
2014-07-17 21:17:42 +00:00
< table class = " wc-order-totals " >
2015-01-05 17:19:14 +00:00
< tr style = " display:none; " >
2014-07-17 21:17:42 +00:00
< td class = " label " >< label for = " restock_refunded_items " >< ? php _e ( 'Restock refunded items' , 'woocommerce' ); ?> :</label></td>
< td class = " total " >< input type = " checkbox " id = " restock_refunded_items " name = " restock_refunded_items " checked = " checked " /></ td >
</ tr >
< tr >
< td class = " label " >< ? php _e ( 'Amount already refunded' , 'woocommerce' ); ?> :</td>
2014-09-29 03:52:28 +00:00
< td class = " total " >-< ? php echo wc_price ( $order -> get_total_refunded (), array ( 'currency' => $order -> get_order_currency () ) ); ?> </td>
2014-07-17 21:17:42 +00:00
</ tr >
< tr >
< td class = " label " >< ? php _e ( 'Total available to refund' , 'woocommerce' ); ?> :</td>
2014-09-29 03:52:28 +00:00
< td class = " total " >< ? php echo wc_price ( $order -> get_total () - $order -> get_total_refunded (), array ( 'currency' => $order -> get_order_currency () ) ); ?> </td>
2014-07-17 21:17:42 +00:00
</ tr >
< tr >
< td class = " label " >< label for = " refund_amount " >< ? php _e ( 'Refund amount' , 'woocommerce' ); ?> :</label></td>
< td class = " total " >
< input type = " text " class = " text " id = " refund_amount " name = " refund_amount " class = " wc_input_price " />
< div class = " clear " ></ div >
</ td >
</ tr >
< tr >
< td class = " label " >< label for = " refund_reason " >< ? php _e ( 'Reason for refund (optional)' , 'woocommerce' ); ?> :</label></td>
< td class = " total " >
< input type = " text " class = " text " id = " refund_reason " name = " refund_reason " />
< div class = " clear " ></ div >
</ td >
</ tr >
</ table >
< div class = " clear " ></ div >
< div class = " refund-actions " >
2015-01-19 14:49:28 +00:00
< ? php
$refund_amount = '<span class="wc-order-refund-amount">' . wc_price ( 0 , array ( 'currency' => $order -> get_order_currency () ) ) . '</span>' ;
$gateway_supports_refunds = false !== $payment_gateway && $payment_gateway -> supports ( 'refunds' );
$gateway_name = false !== $payment_gateway ? ( ! empty ( $payment_gateway -> method_title ) ? $payment_gateway -> method_title : $payment_gateway -> get_title () ) : __ ( 'Payment Gateway' , 'woocommerce' );
?>
< button type = " button " class = " button <?php echo $gateway_supports_refunds ? 'button-primary do-api-refund' : 'tips disabled'; ?> " < ? php echo $gateway_supports_refunds ? '' : 'data-tip="' . esc_attr__ ( 'The payment gateway used to place this order does not support automatic refunds.' , 'woocommerce' ) . '"' ; ?> ><?php printf( _x( 'Refund %s via %s', 'Refund $amount', 'woocommerce' ), $refund_amount, $gateway_name ); ?></button>
< button type = " button " class = " button button-primary do-manual-refund tips " data - tip = " <?php esc_attr_e( 'You will need to manually issue a refund through your payment gateway after using this.', 'woocommerce' ); ?> " >< ? php printf ( _x ( 'Refund %s manually' , 'Refund $amount manually' , 'woocommerce' ), $refund_amount ); ?> </button>
2014-07-17 21:17:42 +00:00
< button type = " button " class = " button cancel-action " >< ? php _e ( 'Cancel' , 'woocommerce' ); ?> </button>
< div class = " clear " ></ div >
</ div >
2014-07-17 20:17:54 +00:00
</ div >
2014-08-29 05:04:51 +00:00
< ? php endif ; ?>
2014-07-17 20:17:54 +00:00
< script type = " text/template " id = " wc-modal-add-products " >
< div class = " wc-backbone-modal " >
< div class = " wc-backbone-modal-content " >
< section class = " wc-backbone-modal-main " role = " main " >
2015-01-02 13:58:57 +00:00
< header class = " wc-backbone-modal-header " >
< h1 >< ? php _e ( 'Add products' , 'woocommerce' ); ?> </h1>
2015-04-04 08:12:20 +00:00
< button class = " modal-close modal-close-link dashicons dashicons-no-alt " >
< span class = " screen-reader-text " > Close modal panel </ span >
</ button >
2014-07-17 20:17:54 +00:00
</ header >
< article >
2014-07-21 01:36:12 +00:00
< form action = " " method = " post " >
2015-01-12 17:11:01 +00:00
< input type = " hidden " id = " add_item_id " name = " add_order_items " class = " wc-product-search " style = " width: 100%; " data - placeholder = " <?php _e( 'Search for a product…', 'woocommerce' ); ?> " data - multiple = " true " />
2014-07-21 01:36:12 +00:00
</ form >
</ article >
< footer >
< div class = " inner " >
2015-01-02 13:58:57 +00:00
< button id = " btn-ok " class = " button button-primary button-large " >< ? php _e ( 'Add' , 'woocommerce' ); ?> </button>
2014-07-21 01:36:12 +00:00
</ div >
</ footer >
</ section >
</ div >
</ div >
2015-04-04 08:06:10 +00:00
< div class = " wc-backbone-modal-backdrop modal-close " ></ div >
2014-07-21 01:36:12 +00:00
</ script >
< script type = " text/template " id = " wc-modal-add-tax " >
< div class = " wc-backbone-modal " >
< div class = " wc-backbone-modal-content " >
< section class = " wc-backbone-modal-main " role = " main " >
2015-01-02 13:58:57 +00:00
< header class = " wc-backbone-modal-header " >
2014-07-23 10:30:06 +00:00
< h1 >< ? php _e ( 'Add tax' , 'woocommerce' ); ?> </h1>
2015-04-04 08:12:20 +00:00
< button class = " modal-close modal-close-link dashicons dashicons-no-alt " >
< span class = " screen-reader-text " > Close modal panel </ span >
</ button >
2014-07-21 01:36:12 +00:00
</ header >
< article >
< form action = " " method = " post " >
2014-07-23 10:30:06 +00:00
< table class = " widefat " >
< thead >
< tr >
< th >& nbsp ; </ th >
< th >< ? php _e ( 'Rate name' , 'woocommerce' ); ?> </th>
< th >< ? php _e ( 'Tax class' , 'woocommerce' ); ?> </th>
< th >< ? php _e ( 'Rate code' , 'woocommerce' ); ?> </th>
< th >< ? php _e ( 'Rate %' , 'woocommerce' ); ?> </th>
</ tr >
</ thead >
2014-07-24 20:33:26 +00:00
< ? php
$rates = $wpdb -> get_results ( " SELECT * FROM { $wpdb -> prefix } woocommerce_tax_rates ORDER BY tax_rate_name LIMIT 100 " );
2014-07-21 01:36:12 +00:00
2014-07-23 10:30:06 +00:00
foreach ( $rates as $rate ) {
echo '
< tr >
< td >< input type = " radio " id = " add_order_tax_' . absint( $rate->tax_rate_id ) . ' " name = " add_order_tax " value = " ' . absint( $rate->tax_rate_id ) . ' " /></ td >
< td >< label for = " add_order_tax_' . absint( $rate->tax_rate_id ) . ' " > ' . WC_Tax::get_rate_label( $rate ) . ' </ label ></ td >
< td > ' . ( isset( $classes_options[ $rate->tax_rate_class ] ) ? $classes_options[ $rate->tax_rate_class ] : ' - ' ) . ' </ td >
< td > ' . WC_Tax::get_rate_code( $rate ) . ' </ td >
< td > ' . WC_Tax::get_rate_percent( $rate ) . ' </ td >
</ tr >
' ;
}
?>
</ table >
< ? php if ( absint ( $wpdb -> get_var ( " SELECT COUNT(tax_rate_id) FROM { $wpdb -> prefix } woocommerce_tax_rates; " ) ) > 100 ) : ?>
< p >
< label for = " manual_tax_rate_id " >< ? php _e ( 'Or, enter tax rate ID:' , 'woocommerce' ); ?> </label><br/>
< input type = " number " name = " manual_tax_rate_id " id = " manual_tax_rate_id " step = " 1 " placeholder = " <?php _e( 'Optional', 'woocommerce' ); ?> " />
</ p >
< ? php endif ; ?>
2014-07-17 20:17:54 +00:00
</ form >
</ article >
< footer >
< div class = " inner " >
2015-01-02 13:58:57 +00:00
< button id = " btn-ok " class = " button button-primary button-large " >< ? php _e ( 'Add' , 'woocommerce' ); ?> </button>
2014-07-17 20:17:54 +00:00
</ div >
</ footer >
</ section >
</ div >
</ div >
2015-04-04 08:06:10 +00:00
< div class = " wc-backbone-modal-backdrop modal-close " ></ div >
2014-07-17 20:17:54 +00:00
</ script >