From 0a71c4498d5746c1ad80917a6def922b65bd404b Mon Sep 17 00:00:00 2001 From: claudiosmweb Date: Mon, 14 Jul 2014 17:04:23 -0300 Subject: [PATCH] moved the coupons to order items metabox --- .../class-wc-meta-box-order-items.php | 7 ++- .../class-wc-meta-box-order-totals.php | 19 -------- .../meta-boxes/views/html-order-coupon.php | 44 +++++++++++++++++++ 3 files changed, 49 insertions(+), 21 deletions(-) create mode 100644 includes/admin/meta-boxes/views/html-order-coupon.php diff --git a/includes/admin/meta-boxes/class-wc-meta-box-order-items.php b/includes/admin/meta-boxes/class-wc-meta-box-order-items.php index 79db4f01827..3c42ed6295d 100644 --- a/includes/admin/meta-boxes/class-wc-meta-box-order-items.php +++ b/includes/admin/meta-boxes/class-wc-meta-box-order-items.php @@ -57,7 +57,7 @@ class WC_Meta_Box_Order_Items { get_items( apply_filters( 'woocommerce_admin_order_item_types', array( 'line_item', 'fee', 'shipping' ) ) ); + $order_items = $order->get_items( apply_filters( 'woocommerce_admin_order_item_types', array( 'line_item', 'fee', 'shipping', 'coupon' ) ) ); $shipping_methods = WC()->shipping() ? WC()->shipping->load_shipping_methods() : array(); foreach ( $order_items as $item_id => $item ) { @@ -75,6 +75,9 @@ class WC_Meta_Box_Order_Items { case 'shipping' : include( 'views/html-order-shipping.php' ); break; + case 'coupon' : + include( 'views/html-order-coupon.php' ); + break; } do_action( 'woocommerce_order_item_' . $item['type'] . '_html', $item_id, $item ); @@ -105,7 +108,7 @@ class WC_Meta_Box_Order_Items {
  • : - -get_total() ); ?> + get_total() ); ?>
  • diff --git a/includes/admin/meta-boxes/class-wc-meta-box-order-totals.php b/includes/admin/meta-boxes/class-wc-meta-box-order-totals.php index 8b6bd2a272b..70c06c7b8e7 100644 --- a/includes/admin/meta-boxes/class-wc-meta-box-order-totals.php +++ b/includes/admin/meta-boxes/class-wc-meta-box-order-totals.php @@ -83,25 +83,6 @@ class WC_Meta_Box_Order_Totals { ?>" /> get_items( array( 'coupon' ) ); - - if ( $coupons ) { - ?> -
    - -
    - get_refunds() ) { ?>
    diff --git a/includes/admin/meta-boxes/views/html-order-coupon.php b/includes/admin/meta-boxes/views/html-order-coupon.php new file mode 100644 index 00000000000..5900211cc62 --- /dev/null +++ b/includes/admin/meta-boxes/views/html-order-coupon.php @@ -0,0 +1,44 @@ + + + + + + + +
    + 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'] ) ); + + $coupon_url = $coupon_id ? add_query_arg( array( 'post' => $coupon_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' ) ); + + echo '' . esc_html( $item['name'] ). ''; + ?> +
    + + + + + + + + + 1 + + +
    + +
    + + + + + + + + + +