2012-11-27 16:22:47 +00:00
|
|
|
<?php
|
2014-06-11 18:31:54 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit; // Exit if accessed directly
|
|
|
|
}
|
2012-10-19 14:05:23 +00:00
|
|
|
?>
|
2014-06-11 18:31:54 +00:00
|
|
|
|
2014-06-25 07:36:11 +00:00
|
|
|
<tr class="item <?php echo apply_filters( 'woocommerce_admin_html_order_item_class', ( ! empty( $class ) ? $class : '' ), $item ); ?>" data-order_item_id="<?php echo $item_id; ?>">
|
2012-11-10 09:14:20 +00:00
|
|
|
<td class="check-column"><input type="checkbox" /></td>
|
2012-10-19 14:05:23 +00:00
|
|
|
<td class="thumb">
|
2013-04-05 12:44:33 +00:00
|
|
|
<?php if ( $_product ) : ?>
|
|
|
|
<a href="<?php echo esc_url( admin_url( 'post.php?post=' . absint( $_product->id ) . '&action=edit' ) ); ?>" class="tips" data-tip="<?php
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2013-04-05 12:44:33 +00:00
|
|
|
echo '<strong>' . __( 'Product ID:', 'woocommerce' ) . '</strong> ' . absint( $item['product_id'] );
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2014-07-02 12:58:10 +00:00
|
|
|
if ( $item['variation_id'] && 'product_variation' === get_post_type( $item['variation_id'] ) ) {
|
2013-04-05 12:44:33 +00:00
|
|
|
echo '<br/><strong>' . __( 'Variation ID:', 'woocommerce' ) . '</strong> ' . absint( $item['variation_id'] );
|
2014-07-02 12:58:10 +00:00
|
|
|
} elseif ( $item['variation_id'] ) {
|
|
|
|
echo '<br/><strong>' . __( 'Variation ID:', 'woocommerce' ) . '</strong> ' . absint( $item['variation_id'] ) . ' (' . __( 'No longer exists', 'woocommerce' ) . ')';
|
2014-06-11 18:31:54 +00:00
|
|
|
}
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2014-06-11 18:31:54 +00:00
|
|
|
if ( $_product && $_product->get_sku() ) {
|
2013-04-05 12:44:33 +00:00
|
|
|
echo '<br/><strong>' . __( 'Product SKU:', 'woocommerce' ).'</strong> ' . esc_html( $_product->get_sku() );
|
2014-06-11 18:31:54 +00:00
|
|
|
}
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2014-06-11 18:31:54 +00:00
|
|
|
if ( $_product && isset( $_product->variation_data ) ) {
|
2014-03-20 15:47:52 +00:00
|
|
|
echo '<br/>' . wc_get_formatted_variation( $_product->variation_data, true );
|
2014-06-11 18:31:54 +00:00
|
|
|
}
|
2014-03-20 15:47:52 +00:00
|
|
|
|
2013-04-05 12:44:33 +00:00
|
|
|
?>"><?php echo $_product->get_image( 'shop_thumbnail', array( 'title' => '' ) ); ?></a>
|
|
|
|
<?php else : ?>
|
2013-11-25 13:56:59 +00:00
|
|
|
<?php echo wc_placeholder_img( 'shop_thumbnail' ); ?>
|
2013-04-05 12:44:33 +00:00
|
|
|
<?php endif; ?>
|
2012-10-19 14:05:23 +00:00
|
|
|
</td>
|
|
|
|
<td class="name">
|
|
|
|
|
2014-06-11 18:31:54 +00:00
|
|
|
<?php echo ( $_product && $_product->get_sku() ) ? esc_html( $_product->get_sku() ) . ' – ' : ''; ?>
|
2013-04-05 12:44:33 +00:00
|
|
|
|
|
|
|
<?php if ( $_product ) : ?>
|
2014-06-11 18:31:54 +00:00
|
|
|
<a target="_blank" href="<?php echo esc_url( admin_url( 'post.php?post=' . absint( $_product->id ) . '&action=edit' ) ); ?>">
|
2013-04-05 12:44:33 +00:00
|
|
|
<?php echo esc_html( $item['name'] ); ?>
|
|
|
|
</a>
|
|
|
|
<?php else : ?>
|
|
|
|
<?php echo esc_html( $item['name'] ); ?>
|
|
|
|
<?php endif; ?>
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2012-11-09 21:15:15 +00:00
|
|
|
<input type="hidden" class="order_item_id" name="order_item_id[]" value="<?php echo esc_attr( $item_id ); ?>" />
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2013-08-15 15:49:09 +00:00
|
|
|
<div class="view">
|
2012-10-19 14:05:23 +00:00
|
|
|
<?php
|
2014-06-11 18:18:33 +00:00
|
|
|
global $wpdb;
|
|
|
|
|
2013-08-15 15:49:09 +00:00
|
|
|
if ( $metadata = $order->has_meta( $item_id ) ) {
|
|
|
|
echo '<table cellspacing="0" class="display_meta">';
|
2012-10-23 16:41:42 +00:00
|
|
|
foreach ( $metadata as $meta ) {
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2012-10-23 16:41:42 +00:00
|
|
|
// Skip hidden core fields
|
2012-11-27 16:22:47 +00:00
|
|
|
if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array(
|
2012-10-23 16:41:42 +00:00
|
|
|
'_qty',
|
|
|
|
'_tax_class',
|
|
|
|
'_product_id',
|
|
|
|
'_variation_id',
|
|
|
|
'_line_subtotal',
|
|
|
|
'_line_subtotal_tax',
|
|
|
|
'_line_total',
|
2012-12-11 13:56:30 +00:00
|
|
|
'_line_tax',
|
2014-03-20 15:47:52 +00:00
|
|
|
) ) ) ) {
|
|
|
|
continue;
|
|
|
|
}
|
2012-11-27 16:22:47 +00:00
|
|
|
|
2013-04-16 14:50:09 +00:00
|
|
|
// Skip serialised meta
|
2014-03-20 15:47:52 +00:00
|
|
|
if ( is_serialized( $meta['meta_value'] ) ) {
|
2013-04-16 14:50:09 +00:00
|
|
|
continue;
|
2014-03-20 15:47:52 +00:00
|
|
|
}
|
2012-10-23 16:41:42 +00:00
|
|
|
|
2014-06-11 18:18:33 +00:00
|
|
|
// Get attribute data
|
|
|
|
if ( taxonomy_exists( $meta['meta_key'] ) ) {
|
|
|
|
$term = get_term_by( 'slug', $meta['meta_value'], $meta['meta_key'] );
|
|
|
|
$attribute_name = str_replace( 'pa_', '', wc_clean( $meta['meta_key'] ) );
|
|
|
|
$attribute = $wpdb->get_var(
|
|
|
|
$wpdb->prepare( "
|
|
|
|
SELECT attribute_label
|
|
|
|
FROM {$wpdb->prefix}woocommerce_attribute_taxonomies
|
|
|
|
WHERE attribute_name = %s;
|
|
|
|
",
|
|
|
|
$attribute_name
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$meta['meta_key'] = ( ! is_wp_error( $attribute ) && $attribute ) ? $attribute : $attribute_name;
|
2014-06-11 18:46:41 +00:00
|
|
|
$meta['meta_value'] = ( isset( $term->name ) ) ? $term->name : $meta['meta_value'];
|
2014-06-11 18:18:33 +00:00
|
|
|
}
|
|
|
|
|
2014-03-19 15:54:26 +00:00
|
|
|
echo '<tr><th>' . wp_kses_post( urldecode( $meta['meta_key'] ) ) . ':</th><td>' . wp_kses_post( wpautop( urldecode( $meta['meta_value'] ) ) ) . '</td></tr>';
|
2012-10-19 14:05:23 +00:00
|
|
|
}
|
2013-08-15 15:49:09 +00:00
|
|
|
echo '</table>';
|
2012-10-19 14:05:23 +00:00
|
|
|
}
|
|
|
|
?>
|
2013-08-15 15:49:09 +00:00
|
|
|
</div>
|
|
|
|
<div class="edit" style="display:none">
|
|
|
|
<table class="meta" cellspacing="0">
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
|
|
<td colspan="4"><button class="add_order_item_meta button"><?php _e( 'Add meta', 'woocommerce' ); ?></button></td>
|
|
|
|
</tr>
|
|
|
|
</tfoot>
|
|
|
|
<tbody class="meta_items">
|
|
|
|
<?php
|
|
|
|
if ( $metadata = $order->has_meta( $item_id )) {
|
|
|
|
foreach ( $metadata as $meta ) {
|
|
|
|
|
|
|
|
// Skip hidden core fields
|
|
|
|
if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array(
|
|
|
|
'_qty',
|
|
|
|
'_tax_class',
|
|
|
|
'_product_id',
|
|
|
|
'_variation_id',
|
|
|
|
'_line_subtotal',
|
|
|
|
'_line_subtotal_tax',
|
|
|
|
'_line_total',
|
|
|
|
'_line_tax',
|
2014-03-20 15:47:52 +00:00
|
|
|
) ) ) ) {
|
|
|
|
continue;
|
|
|
|
}
|
2013-08-15 15:49:09 +00:00
|
|
|
|
|
|
|
// Skip serialised meta
|
2014-03-20 15:47:52 +00:00
|
|
|
if ( is_serialized( $meta['meta_value'] ) ) {
|
2013-08-15 15:49:09 +00:00
|
|
|
continue;
|
2014-03-20 15:47:52 +00:00
|
|
|
}
|
2013-08-15 15:49:09 +00:00
|
|
|
|
2014-03-19 15:54:26 +00:00
|
|
|
$meta['meta_key'] = urldecode( $meta['meta_key'] );
|
2013-08-15 15:49:09 +00:00
|
|
|
$meta['meta_value'] = esc_textarea( urldecode( $meta['meta_value'] ) ); // using a <textarea />
|
|
|
|
$meta['meta_id'] = absint( $meta['meta_id'] );
|
|
|
|
|
2013-11-20 19:11:59 +00:00
|
|
|
echo '<tr data-meta_id="' . esc_attr( $meta['meta_id'] ) . '">
|
2013-11-08 17:03:40 +00:00
|
|
|
<td>
|
2013-11-20 19:11:59 +00:00
|
|
|
<input type="text" name="meta_key[' . $meta['meta_id'] . ']" value="' . esc_attr( $meta['meta_key'] ) . '" />
|
2013-11-08 17:03:40 +00:00
|
|
|
<textarea name="meta_value[' . $meta['meta_id'] . ']">' . $meta['meta_value'] . '</textarea>
|
|
|
|
</td>
|
2013-08-15 15:49:09 +00:00
|
|
|
<td width="1%"><button class="remove_order_item_meta button">×</button></td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2012-10-19 14:05:23 +00:00
|
|
|
</td>
|
|
|
|
|
2012-10-23 16:41:42 +00:00
|
|
|
<?php do_action( 'woocommerce_admin_order_item_values', $_product, $item, absint( $item_id ) ); ?>
|
2012-10-19 14:05:23 +00:00
|
|
|
|
2014-06-11 18:31:54 +00:00
|
|
|
<?php if ( 'yes' == get_option( 'woocommerce_calc_taxes' ) ) :
|
2013-10-04 14:21:06 +00:00
|
|
|
$tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option('woocommerce_tax_classes' ) ) ) );
|
|
|
|
$classes_options = array();
|
|
|
|
$classes_options[''] = __( 'Standard', 'woocommerce' );
|
|
|
|
|
2014-06-11 18:47:13 +00:00
|
|
|
if ( $tax_classes ) {
|
|
|
|
foreach ( $tax_classes as $class ) {
|
2013-10-04 14:21:06 +00:00
|
|
|
$classes_options[ sanitize_title( $class ) ] = $class;
|
2014-06-11 18:47:13 +00:00
|
|
|
}
|
|
|
|
}
|
2013-10-04 14:21:06 +00:00
|
|
|
?>
|
|
|
|
<td class="tax_class" width="1%">
|
|
|
|
<div class="view">
|
2013-08-15 15:49:09 +00:00
|
|
|
<?php
|
2013-10-04 14:21:06 +00:00
|
|
|
$item_value = isset( $item['tax_class'] ) ? sanitize_title( $item['tax_class'] ) : '';
|
|
|
|
echo $classes_options[ $item_value ];
|
2013-08-15 15:49:09 +00:00
|
|
|
?>
|
2013-10-04 14:21:06 +00:00
|
|
|
</div>
|
|
|
|
<div class="edit" style="display:none">
|
|
|
|
<select class="tax_class" name="order_item_tax_class[<?php echo absint( $item_id ); ?>]" title="<?php _e( 'Tax class', 'woocommerce' ); ?>">
|
|
|
|
<?php
|
|
|
|
$item_value = isset( $item['tax_class'] ) ? sanitize_title( $item['tax_class'] ) : '';
|
|
|
|
|
|
|
|
foreach ( $classes_options as $value => $name )
|
|
|
|
echo '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $item_value, false ) . '>' . esc_html( $name ) . '</option>';
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</td>
|
2014-06-11 18:31:54 +00:00
|
|
|
<?php endif; ?>
|
2013-01-11 11:29:13 +00:00
|
|
|
|
2012-10-19 14:05:23 +00:00
|
|
|
<td class="quantity" width="1%">
|
2013-08-15 15:49:09 +00:00
|
|
|
<div class="view">
|
2014-06-11 18:31:54 +00:00
|
|
|
<?php echo ( isset( $item['qty'] ) ) ? esc_html( $item['qty'] ) : ''; ?>
|
2013-08-15 15:49:09 +00:00
|
|
|
</div>
|
|
|
|
<div class="edit" style="display:none">
|
|
|
|
<input type="number" step="<?php echo apply_filters( 'woocommerce_quantity_input_step', '1', $_product ); ?>" min="0" autocomplete="off" name="order_item_qty[<?php echo absint( $item_id ); ?>]" placeholder="0" value="<?php echo esc_attr( $item['qty'] ); ?>" size="4" class="quantity" />
|
|
|
|
</div>
|
2012-10-19 14:05:23 +00:00
|
|
|
</td>
|
|
|
|
|
2012-11-09 21:15:15 +00:00
|
|
|
<td class="line_cost" width="1%">
|
2013-08-15 15:49:09 +00:00
|
|
|
<div class="view">
|
2013-08-16 15:43:26 +00:00
|
|
|
<?php
|
|
|
|
if ( isset( $item['line_total'] ) ) {
|
2014-06-11 18:31:54 +00:00
|
|
|
if ( isset( $item['line_subtotal'] ) && $item['line_subtotal'] != $item['line_total'] ) {
|
|
|
|
echo '<del>' . wc_price( $item['line_subtotal'] ) . '</del> ';
|
|
|
|
}
|
2013-08-16 15:43:26 +00:00
|
|
|
|
2013-11-25 13:34:21 +00:00
|
|
|
echo wc_price( $item['line_total'] );
|
2013-08-16 15:43:26 +00:00
|
|
|
}
|
|
|
|
?>
|
2013-08-15 15:49:09 +00:00
|
|
|
</div>
|
|
|
|
<div class="edit" style="display:none">
|
2014-06-11 18:31:54 +00:00
|
|
|
<span class="subtotal"><label><?php _e( 'Subtotal', 'woocommerce' ); ?>: <a class="tips" data-tip="<?php _e( 'Before pre-tax discounts.', 'woocommerce' ); ?>" href="#">[?]</a> <input type="text" name="line_subtotal[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $item['line_subtotal'] ) ) ? esc_attr( wc_format_localized_price( $item['line_subtotal'] ) ) : ''; ?>" class="line_subtotal wc_input_price" /></label></span>
|
2013-08-16 16:00:49 +00:00
|
|
|
|
2014-06-11 18:31:54 +00:00
|
|
|
<label><?php _e( 'Total', 'woocommerce' ); ?>: <a class="tips" data-tip="<?php _e( 'After pre-tax discounts.', 'woocommerce' ); ?>" href="#">[?]</a> <input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $item['line_total'] ) ) ? esc_attr( wc_format_localized_price( $item['line_total'] ) ) : ''; ?>" class="line_total wc_input_price" /></label>
|
2013-08-15 15:49:09 +00:00
|
|
|
</div>
|
2012-10-19 14:05:23 +00:00
|
|
|
</td>
|
|
|
|
|
2014-06-11 18:31:54 +00:00
|
|
|
<?php if ( 'yes' == get_option( 'woocommerce_calc_taxes' ) ) : ?>
|
2013-01-11 11:29:13 +00:00
|
|
|
|
2012-11-09 21:15:15 +00:00
|
|
|
<td class="line_tax" width="1%">
|
2013-08-15 15:49:09 +00:00
|
|
|
<div class="view">
|
2013-08-16 15:43:26 +00:00
|
|
|
<?php
|
|
|
|
if ( isset( $item['line_tax'] ) ) {
|
2014-06-11 18:31:54 +00:00
|
|
|
if ( isset( $item['line_subtotal_tax'] ) && $item['line_subtotal_tax'] != $item['line_tax'] ) {
|
|
|
|
echo '<del>' . wc_price( wc_round_tax_total( $item['line_subtotal_tax'] ) ) . '</del> ';
|
|
|
|
}
|
2013-08-16 15:43:26 +00:00
|
|
|
|
2013-11-25 13:34:21 +00:00
|
|
|
echo wc_price( wc_round_tax_total( $item['line_tax'] ) );
|
2013-08-16 15:43:26 +00:00
|
|
|
}
|
|
|
|
?>
|
2013-08-15 15:49:09 +00:00
|
|
|
</div>
|
|
|
|
<div class="edit" style="display:none">
|
2014-06-11 18:31:54 +00:00
|
|
|
<span class="subtotal"><input type="text" name="line_subtotal_tax[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $item['line_subtotal_tax'] ) ) ? esc_attr( wc_format_localized_price( $item['line_subtotal_tax'] ) ) : ''; ?>" class="line_subtotal_tax wc_input_price" /></span>
|
2013-08-16 16:00:49 +00:00
|
|
|
|
2014-06-11 18:31:54 +00:00
|
|
|
<input type="text" name="line_tax[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $item['line_tax'] ) ) ? esc_attr( wc_format_localized_price( $item['line_tax'] ) ) : ''; ?>" class="line_tax wc_input_price" />
|
2013-08-15 15:49:09 +00:00
|
|
|
</div>
|
2012-10-19 14:05:23 +00:00
|
|
|
</td>
|
|
|
|
|
2013-01-11 11:29:13 +00:00
|
|
|
<?php endif; ?>
|
|
|
|
|
2013-08-15 15:49:09 +00:00
|
|
|
<td>
|
2014-06-11 20:05:09 +00:00
|
|
|
<a class="edit_order_item" href="#"><img src="<?php echo WC()->plugin_url(); ?>/assets/images/icons/edit.png" alt="<?php _e( 'Edit', 'woocommerce' ); ?>" width="14" /></a>
|
2013-08-15 15:49:09 +00:00
|
|
|
</td>
|
|
|
|
|
2014-06-11 18:18:33 +00:00
|
|
|
</tr>
|