diff --git a/assets/js/admin/meta-boxes.js b/assets/js/admin/meta-boxes.js index a71efa573dc..a1893118796 100644 --- a/assets/js/admin/meta-boxes.js +++ b/assets/js/admin/meta-boxes.js @@ -196,6 +196,26 @@ jQuery( function($){ return terms; }); + jQuery("select.ajax_chosen_select_downloadable_products_and_variations").ajaxChosen({ + method: 'GET', + url: woocommerce_admin_meta_boxes.ajax_url, + dataType: 'json', + afterTypeDelay: 100, + data: { + action: 'woocommerce_json_search_downloadable_products_and_variations', + security: woocommerce_admin_meta_boxes.search_products_nonce + } + }, function (data) { + + var terms = {}; + + $.each(data, function (i, val) { + terms[i] = val; + }); + + return terms; + }); + // ORDERS jQuery('#woocommerce-order-actions input, #woocommerce-order-actions a').click(function(){ window.onbeforeunload = ''; diff --git a/includes/admin/post-types/meta-boxes/class-wc-meta-box-order-downloads.php b/includes/admin/post-types/meta-boxes/class-wc-meta-box-order-downloads.php index 58e4eb0594f..c72043250f3 100644 --- a/includes/admin/post-types/meta-boxes/class-wc-meta-box-order-downloads.php +++ b/includes/admin/post-types/meta-boxes/class-wc-meta-box-order-downloads.php @@ -53,35 +53,7 @@ class WC_Meta_Box_Order_Downloads {
- - +
@@ -98,15 +70,15 @@ class WC_Meta_Box_Order_Downloads { jQuery('.order_download_permissions').on('click', 'button.grant_access', function(){ - var product = jQuery('select.grant_access_id').val(); + var products = jQuery('select#grant_access_id').val(); - if (!product) return; + if (!products) return; jQuery('.order_download_permissions').block({ message: null, overlayCSS: { background: '#fff url(plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } }); var data = { action: 'woocommerce_grant_access_to_download', - product_id: product, + product_ids: products, loop: jQuery('.order_download_permissions .wc-metabox').size(), order_id: 'ID; ?>', security: '' diff --git a/includes/admin/post-types/meta-boxes/views/html-order-download-permission.php b/includes/admin/post-types/meta-boxes/views/html-order-download-permission.php index 935c2b0a808..81e86b92195 100644 --- a/includes/admin/post-types/meta-boxes/views/html-order-download-permission.php +++ b/includes/admin/post-types/meta-boxes/views/html-order-download-permission.php @@ -6,7 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly - id ) . ' — ' . apply_filters( 'woocommerce_admin_download_permissions_title', $product->get_title(), $download->product_id, $download->order_id, $download->order_key, $download->download_id ) . ' — ' . sprintf( __( 'File %d: %s', 'woocommerce' ), $file_count, wc_get_filename_from_url( $product->get_file_download_path( $download->download_id ) ) ) . ' — ' . sprintf( _n('Downloaded %s time', 'Downloaded %s times', absint( $download->download_count ), 'woocommerce'), absint( $download->download_count ) ); ?> + id ) . ' — ' . apply_filters( 'woocommerce_admin_download_permissions_title', $product->get_title(), $download->product_id, $download->order_id, $download->order_key, $download->download_id ) . ' — ' . sprintf( __( '%s: %s', 'woocommerce' ), $file_count, wc_get_filename_from_url( $product->get_file_download_path( $download->download_id ) ) ) . ' — ' . sprintf( _n('Downloaded %s time', 'Downloaded %s times', absint( $download->download_count ), 'woocommerce'), absint( $download->download_count ) ); ?>