SKU sorting in admin

This commit is contained in:
Mike Jolley 2012-02-21 11:07:59 +00:00
parent 429e7ea1f3
commit 2ea44118ee
3 changed files with 6 additions and 2 deletions

View File

@ -280,7 +280,8 @@ function woocommerce_custom_product_orderby( $vars ) {
endif;
if ( 'sku' == $vars['orderby'] ) :
$vars = array_merge( $vars, array(
'orderby' => 'id'
'meta_key' => '_sku',
'orderby' => 'meta_value'
) );
endif;
endif;

View File

@ -514,7 +514,9 @@ function woocommerce_process_product_meta( $post_id, $post ) {
// Unique SKU
$sku = get_post_meta($post_id, '_sku', true);
$new_sku = esc_html(stripslashes( $_POST['_sku'] ));
if ($new_sku!==$sku) :
if ($new_sku=='') :
update_post_meta( $post_id, '_sku', '' );
elseif ($new_sku!==$sku) :
if ($new_sku && !empty($new_sku)) :
if (
$wpdb->get_var($wpdb->prepare("

View File

@ -145,6 +145,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Bulk edit products
* Added basic API for payment gateways to hook into (for IPN etc)
* Added Bulgarian translation
* Fixed SKU sort in admin
= 1.4.4 - 18/02/2012 =
* Fix for remove coupon links after ajax update of shipping