Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Projects
Groups
Snippets
Sign up now
Login
Sign in
Toggle navigation
Menu
Open sidebar
WooCommerce
Advanced Order Numbers for WooCommerce
Commits
8c00ea49
Commit
8c00ea49
authored
Apr 14, 2015
by
Reinhold Kainhofer
Browse files
Make the order list sortable by the order number rather than the order ID
parent
44921923
Changes
1
Hide whitespace changes
Inline
Side-by-side
woocommerce-advanced-ordernumbers.php
View file @
8c00ea49
...
...
@@ -116,6 +116,9 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
// The checkout page assumes all subpages are payment gateways, so we have to override this:
add_action
(
'woocommerce_settings_checkout'
,
array
(
$this
,
'output'
)
);
add_action
(
'woocommerce_settings_save_checkout'
,
array
(
$this
,
'save'
)
);
// Sort the order list in the backend by order number rather than ID, make sure this is called LAST so we modify the defaults passed as arguments
add_filter
(
'manage_edit-shop_order_sortable_columns'
,
array
(
$this
,
'modify_order_column_sortkey'
),
9999
);
// register filters
add_filter
(
"plugin_action_links_
$plugin
"
,
array
(
&
$this
,
'plugin_settings_link'
));
...
...
@@ -157,6 +160,17 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
$fields
[]
=
$this
->
ordernumber_meta
;
return
$fields
;
}
/**
* Sort the order list's "Order" column by our post meta rather than by ID
*/
public
function
modify_order_column_sortkey
(
$columns
)
{
$custom
=
array
(
'order_title'
=>
$this
->
ordernumber_meta
,
);
// Use the passed columns as "default", so effectively, only the order_title will be changed:
return
wp_parse_args
(
$custom
,
$columns
);
}
/**
* Counter handling (simple loading/storing counters), storing them as options
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment