diff --git a/admin/post-types/product.php b/admin/post-types/product.php index 5feda939699..93d5f6ead35 100644 --- a/admin/post-types/product.php +++ b/admin/post-types/product.php @@ -63,20 +63,22 @@ function woocommerce_edit_product_columns($columns){ $columns["cb"] = ""; $columns["thumb"] = __("Image", 'woocommerce'); - $columns["title"] = __("Name", 'woocommerce'); - if( get_option('woocommerce_enable_sku', true) == 'yes' ) $columns["sku"] = __("ID", 'woocommerce'); + $columns["name"] = __("Name", 'woocommerce'); + + if (get_option('woocommerce_enable_sku', true) == 'yes') + $columns["sku"] = __("SKU", 'woocommerce'); + $columns["product_type"] = __("Type", 'woocommerce'); $columns["product_cat"] = __("Categories", 'woocommerce'); $columns["product_tags"] = __("Tags", 'woocommerce'); $columns["featured"] = __("Featured", 'woocommerce'); - if (get_option('woocommerce_manage_stock')=='yes') : + if (get_option('woocommerce_manage_stock')=='yes') $columns["is_in_stock"] = __("In Stock?", 'woocommerce'); - endif; $columns["price"] = __("Price", 'woocommerce'); - $columns["product_date"] = __("Date", 'woocommerce'); + $columns["date"] = __("Date", 'woocommerce'); return $columns; } @@ -85,11 +87,11 @@ function woocommerce_edit_product_columns($columns){ /** * Custom Columns for Products page **/ -add_action('manage_product_posts_custom_column', 'woocommerce_custom_product_columns', 2); +add_action('manage_product_posts_custom_column', 'woocommerce_custom_product_columns', 2 ); -function woocommerce_custom_product_columns($column) { +function woocommerce_custom_product_columns( $column ) { global $post, $woocommerce; - $product = new Woocommerce_Product($post->ID); + $product = new WC_Product($post->ID); switch ($column) { case "thumb" : @@ -97,6 +99,79 @@ function woocommerce_custom_product_columns($column) { echo get_the_post_thumbnail($post->ID, 'shop_thumbnail'); endif; break; + case "name" : + $edit_link = get_edit_post_link( $post->ID ); + $title = _draft_or_post_title(); + $post_type_object = get_post_type_object( $post->post_type ); + $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID ); + + echo '' . $title.''; + + _post_states( $post ); + + echo ''; + + if ( $post->post_parent > 0 ) + echo '  ← '. get_the_title($post->post_parent) .''; + + // Get actions + $actions = array(); + + $actions['id'] = 'ID: #' . $post->ID; + + if ( $can_edit_post && 'trash' != $post->post_status ) { + $actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . ''; + } + if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) { + if ( 'trash' == $post->post_status ) + $actions['untrash'] = "ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore' ) . ""; + elseif ( EMPTY_TRASH_DAYS ) + $actions['trash'] = "" . __( 'Trash' ) . ""; + if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) + $actions['delete'] = "" . __( 'Delete Permanently' ) . ""; + } + if ( $post_type_object->public ) { + if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) { + if ( $can_edit_post ) + $actions['view'] = '' . __( 'Preview' ) . ''; + } elseif ( 'trash' != $post->post_status ) { + $actions['view'] = '' . __( 'View' ) . ''; + } + } + $actions = apply_filters( 'post_row_actions', $actions, $post ); + + echo '
'; + + $i = 0; + $action_count = sizeof($actions); + + foreach ( $actions as $action => $link ) { + ++$i; + ( $i == $action_count ) ? $sep = '' : $sep = ' | '; + echo "$link$sep"; + } + echo '
'; + + get_inline_data( $post ); + + break; + case "sku" : + echo $product->get_sku(); + break; + case "product_type" : + if( $product->product_type == 'grouped' ): + echo __('Grouped', 'woocommerce'); + elseif ( $product->product_type == 'external' ): + echo __('External/Affiliate', 'woocommerce'); + elseif ( $product->product_type == 'simple' ): + echo __('Simple', 'woocommerce'); + elseif ( $product->product_type == 'variable' ): + echo __('Variable', 'woocommerce'); + else: + // Assuming that we have other types in future + echo ucwords($product->product_type); + endif; + break; case "price": echo $product->get_price_html(); break; @@ -106,89 +181,23 @@ function woocommerce_custom_product_columns($column) { case "product_tags" : if (!$terms = get_the_term_list($post->ID, 'product_tag', '', ', ','')) echo ''; else echo $terms; break; - case "sku" : - if ( $sku = get_post_meta( $post->ID, '_sku', true )) : - echo '#'.$post->ID.' - SKU: ' . $sku; - else : - echo '#'.$post->ID; - endif; - break; case "featured" : $url = wp_nonce_url( admin_url('admin-ajax.php?action=woocommerce-feature-product&product_id=' . $post->ID), 'woocommerce-feature-product' ); echo ''; - if ($product->is_featured()) echo 'yes'; - else echo 'no'; + if ($product->is_featured()) echo 'yes'; + else echo 'no'; echo ''; break; case "is_in_stock" : if ( !$product->is_type( 'grouped' ) && $product->is_in_stock() ) : - echo 'yes '; + echo 'yes '; else : - echo 'no '; + echo 'no '; endif; if ( $product->managing_stock() ) : - echo $product->get_total_stock().__(' in stock', 'woocommerce'); + echo '× ' . $product->get_total_stock(); endif; break; - case "product_type" : - - // Its was dynamic but did not support the translations - if( $product->product_type == 'grouped' ): - echo __('Grouped product', 'woocommerce'); - elseif ( $product->product_type == 'external' ): - echo __('External/Affiliate product', 'woocommerce'); - elseif ( $product->product_type == 'simple' ): - echo __('Simple product', 'woocommerce'); - elseif ( $product->product_type == 'variable' ): - echo __('Variable', 'woocommerce'); - else: - // Assuming that we have other types in future - echo ucwords($product->product_type); - endif; - - break; - case "product_date" : - if ( '0000-00-00 00:00:00' == $post->post_date ) : - $t_time = $h_time = __( 'Unpublished', 'woocommerce' ); - $time_diff = 0; - else : - $t_time = get_the_time( __( 'Y/m/d g:i:s A', 'woocommerce' ) ); - $m_time = $post->post_date; - $time = get_post_time( 'G', true, $post ); - - $time_diff = time() - $time; - - if ( $time_diff > 0 && $time_diff < 24*60*60 ) - $h_time = sprintf( __( '%s ago', 'woocommerce' ), human_time_diff( $time ) ); - else - $h_time = mysql2date( __( 'Y/m/d', 'woocommerce' ), $m_time ); - endif; - - echo '' . apply_filters( 'post_date_column_time', $h_time, $post ) . '
'; - - if ( 'publish' == $post->post_status ) : - _e( 'Published', 'woocommerce' ); - elseif ( 'future' == $post->post_status ) : - if ( $time_diff > 0 ) : - echo '' . __( 'Missed schedule', 'woocommerce' ) . ''; - else : - _e( 'Scheduled', 'woocommerce' ); - endif; - else : - _e( 'Last Modified', 'woocommerce' ); - endif; - - /** - * show hidden visible product on colum Date - * Assuming that we have only show and hidden status - */ - if ( $product->visibility == 'hidden' ) : - echo '
'. __('Hidden', 'woocommerce'); - else: - echo '
'. __('Visible', 'woocommerce'); - endif; - - break; } } @@ -205,7 +214,7 @@ function woocommerce_custom_product_sort($columns) { 'price' => 'price', 'featured' => 'featured', 'sku' => 'sku', - 'product_date' => 'date' + 'name' => 'title' ); return wp_parse_args($custom, $columns); } diff --git a/admin/post-types/shop_order.php b/admin/post-types/shop_order.php index 9a459dbf3f3..d979e8a7bc5 100644 --- a/admin/post-types/shop_order.php +++ b/admin/post-types/shop_order.php @@ -37,7 +37,7 @@ add_action('manage_shop_order_posts_custom_column', 'woocommerce_custom_order_co function woocommerce_custom_order_columns($column) { global $post; - $order = new Woocommerce_Order( $post->ID ); + $order = new WC_Order( $post->ID ); switch ($column) { case "order_status" : diff --git a/admin/post-types/writepanels/writepanel-order_data.php b/admin/post-types/writepanels/writepanel-order_data.php index b138aaf9ba1..99ec7629ce4 100644 --- a/admin/post-types/writepanels/writepanel-order_data.php +++ b/admin/post-types/writepanels/writepanel-order_data.php @@ -20,7 +20,7 @@ function woocommerce_order_data_meta_box($post) { $thepostid = $post->ID; - $order = new Woocommerce_Order( $thepostid ); + $order = new WC_Order( $thepostid ); wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' ); @@ -260,9 +260,9 @@ function woocommerce_order_items_meta_box($post) { 0 && isset($order_items[0]['id'])) foreach ($order_items as $item) : if (isset($item['variation_id']) && $item['variation_id'] > 0) : - $_product = new Woocommerce_Product_Variation( $item['variation_id'] ); + $_product = new WC_Product_Variation( $item['variation_id'] ); else : - $_product = new Woocommerce_Product( $item['id'] ); + $_product = new WC_Product( $item['id'] ); endif; // Totals - Backwards Compatibility @@ -318,7 +318,7 @@ function woocommerce_order_items_meta_box($post) { $meta_value = $meta; endif; - echo ''; + echo ''; endforeach; endif; ?> @@ -460,6 +460,7 @@ function woocommerce_order_actions_meta_box($post) { * Displays the order totals meta box */ function woocommerce_order_totals_meta_box($post) { + global $woocommerce; $data = get_post_custom( $post->ID ); ?> @@ -505,7 +506,45 @@ function woocommerce_order_totals_meta_box($post) {
-

+

[?]

+
+ 0) : + foreach ($taxes as $tax) : + ?> +
+

+ + +

+

+ +

+

+ + +

+

+ + +

+ × +
+
+ +
+

+
+
+
+

-
-

[?]

- -

-
-

- +
__('Out of stock', 'woocommerce') ) ) ); - // manage stock - woocommerce_wp_checkbox( array( 'id' => '_manage_stock', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Manage stock?', 'woocommerce') ) ); + if (get_option('woocommerce_manage_stock')=='yes') { - do_action('woocommerce_product_options_stock'); + // manage stock + woocommerce_wp_checkbox( array( 'id' => '_manage_stock', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Manage stock?', 'woocommerce') ) ); + + do_action('woocommerce_product_options_stock'); + + echo '
'; + + // Stock + woocommerce_wp_text_input( array( 'id' => '_stock', 'label' => __('Stock Qty', 'woocommerce') ) ); + + // Backorders? + woocommerce_wp_select( array( 'id' => '_backorders', 'label' => __('Allow Backorders?', 'woocommerce'), 'options' => array( + 'no' => __('Do not allow', 'woocommerce'), + 'notify' => __('Allow, but notify customer', 'woocommerce'), + 'yes' => __('Allow', 'woocommerce') + ) ) ); - echo '
'; + do_action('woocommerce_product_options_stock_fields'); + + echo '
'; - // Stock - woocommerce_wp_text_input( array( 'id' => '_stock', 'label' => __('Stock Qty', 'woocommerce') ) ); - - // Backorders? - woocommerce_wp_select( array( 'id' => '_backorders', 'label' => __('Allow Backorders?', 'woocommerce'), 'options' => array( - 'no' => __('Do not allow', 'woocommerce'), - 'notify' => __('Allow, but notify customer', 'woocommerce'), - 'yes' => __('Allow', 'woocommerce') - ) ) ); - - do_action('woocommerce_product_options_stock_fields'); - - echo '
'; + } ?>
- +
@@ -386,7 +390,7 @@ function woocommerce_product_data_box() { if (sizeof($posts_in)>0) : $args = array( 'post_type' => 'product', - 'post_status' => 'publish', + 'post_status' => 'any', 'numberposts' => -1, 'orderby' => 'title', 'order' => 'asc', diff --git a/admin/woocommerce-admin-dashboard.php b/admin/woocommerce-admin-dashboard.php index ae068ff628d..212ab03a27c 100644 --- a/admin/woocommerce-admin-dashboard.php +++ b/admin/woocommerce-admin-dashboard.php @@ -125,7 +125,7 @@ function woocommmerce_dashboard_recent_orders() { echo '