Fixed number of processing orders display
Reported in http://wordpress.org/support/topic/number-of-processing-orders-missing-from-left-panel Cannot use wc_get_order_type() before wc_register_order_type() @mikejolley
This commit is contained in:
parent
8464ad0b17
commit
6a0d5ebf0c
|
@ -5,10 +5,12 @@
|
|||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.1.0
|
||||
* @version 2.2.3
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'WC_Admin_Menus' ) ) :
|
||||
|
||||
|
@ -42,10 +44,11 @@ class WC_Admin_Menus {
|
|||
public function admin_menu() {
|
||||
global $menu;
|
||||
|
||||
if ( current_user_can( 'manage_woocommerce' ) )
|
||||
if ( current_user_can( 'manage_woocommerce' ) ) {
|
||||
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' );
|
||||
}
|
||||
|
||||
$main_page = add_menu_page( __( 'WooCommerce', 'woocommerce' ), __( 'WooCommerce', 'woocommerce' ), 'manage_woocommerce', 'woocommerce' , null, null, '55.5' );
|
||||
$main_page = add_menu_page( __( 'WooCommerce', 'woocommerce' ), __( 'WooCommerce', 'woocommerce' ), 'manage_woocommerce', 'woocommerce', null, null, '55.5' );
|
||||
|
||||
add_submenu_page( 'edit.php?post_type=product', __( 'Attributes', 'woocommerce' ), __( 'Attributes', 'woocommerce' ), 'manage_product_terms', 'product_attributes', array( $this, 'attributes_page' ) );
|
||||
}
|
||||
|
@ -92,7 +95,6 @@ class WC_Admin_Menus {
|
|||
/**
|
||||
* Highlights the correct top level admin menu item for post type add screens.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function menu_highlight() {
|
||||
|
@ -121,19 +123,16 @@ class WC_Admin_Menus {
|
|||
unset( $submenu['woocommerce'][1] );
|
||||
}
|
||||
|
||||
// Sort out Orders menu when on the top level
|
||||
if ( ! current_user_can( 'manage_woocommerce' ) ) {
|
||||
foreach ( $menu as $key => $menu_item ) {
|
||||
if ( strpos( $menu_item[0], _x('Orders', 'Admin menu name', 'woocommerce') ) === 0 ) {
|
||||
if ( current_user_can( 'manage_woocommerce' ) ) {
|
||||
foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
|
||||
if ( 0 === strpos( $menu_item[0], _x( 'Orders', 'Admin menu name', 'woocommerce' ) ) ) {
|
||||
|
||||
$menu_name = _x('Orders', 'Admin menu name', 'woocommerce');
|
||||
$menu_name_count = '';
|
||||
$menu_name = _x( 'Orders', 'Admin menu name', 'woocommerce' );
|
||||
if ( $order_count = wc_processing_order_count() ) {
|
||||
$menu_name_count = " <span class='awaiting-mod update-plugins count-$order_count'><span class='processing-count'>" . number_format_i18n( $order_count ) . "</span></span>" ;
|
||||
$menu_name .= ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n( $order_count ) . '</span></span>';
|
||||
}
|
||||
|
||||
$menu[$key][0] = $menu_name . $menu_name_count;
|
||||
$submenu['edit.php?post_type=shop_order'][5][0] = $menu_name;
|
||||
$submenu['woocommerce'][ $key ] [0] = $menu_name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -157,26 +156,27 @@ class WC_Admin_Menus {
|
|||
$woocommerce_product = array_search( 'edit.php?post_type=product', $menu_order );
|
||||
|
||||
// Loop through menu order and do some rearranging
|
||||
foreach ( $menu_order as $index => $item ) :
|
||||
foreach ( $menu_order as $index => $item ) {
|
||||
|
||||
if ( ( ( 'woocommerce' ) == $item ) ) :
|
||||
if ( ( ( 'woocommerce' ) == $item ) ) {
|
||||
$woocommerce_menu_order[] = 'separator-woocommerce';
|
||||
$woocommerce_menu_order[] = $item;
|
||||
$woocommerce_menu_order[] = 'edit.php?post_type=product';
|
||||
unset( $menu_order[$woocommerce_separator] );
|
||||
unset( $menu_order[$woocommerce_product] );
|
||||
elseif ( !in_array( $item, array( 'separator-woocommerce' ) ) ) :
|
||||
} elseif ( !in_array( $item, array( 'separator-woocommerce' ) ) ) {
|
||||
$woocommerce_menu_order[] = $item;
|
||||
endif;
|
||||
}
|
||||
|
||||
endforeach;
|
||||
}
|
||||
|
||||
// Return order
|
||||
return $woocommerce_menu_order;
|
||||
}
|
||||
|
||||
/**
|
||||
* custom_menu_order
|
||||
* Custom menu order
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function custom_menu_order() {
|
||||
|
|
|
@ -266,12 +266,6 @@ class WC_Post_types {
|
|||
)
|
||||
);
|
||||
|
||||
$menu_name = _x( 'Orders', 'Admin menu name', 'woocommerce' );
|
||||
|
||||
if ( $order_count = wc_processing_order_count() ) {
|
||||
$menu_name .= ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n( $order_count ) . '</span></span>';
|
||||
}
|
||||
|
||||
wc_register_order_type(
|
||||
'shop_order',
|
||||
apply_filters( 'woocommerce_register_post_type_shop_order',
|
||||
|
@ -290,7 +284,7 @@ class WC_Post_types {
|
|||
'not_found' => __( 'No Orders found', 'woocommerce' ),
|
||||
'not_found_in_trash' => __( 'No Orders found in trash', 'woocommerce' ),
|
||||
'parent' => __( 'Parent Orders', 'woocommerce' ),
|
||||
'menu_name' => $menu_name
|
||||
'menu_name' => _x( 'Orders', 'Admin menu name', 'woocommerce' )
|
||||
),
|
||||
'description' => __( 'This is where store orders are stored.', 'woocommerce' ),
|
||||
'public' => false,
|
||||
|
|
|
@ -143,6 +143,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Fix - Number format when calculate the line items tax.
|
||||
* Fix - Language update/install in Multisites.
|
||||
* Fix - "Set product image" media gallery title in non-product post type.
|
||||
* Fix - Number of processing orders in WooCommerce > Orders menu.
|
||||
* Tweak - Display of locale information on system status page.
|
||||
* Tweak - Removed postcode for Bahamas.
|
||||
* Tweak - In system status, show path to template file override.
|
||||
|
|
Loading…
Reference in New Issue