Showed filename when product CSV import is finished - issue #24266
This commit is contained in:
parent
23afdd3d5f
commit
fa4e55bca3
|
@ -58,7 +58,8 @@
|
||||||
$this.$form.find('.woocommerce-importer-progress').val( response.data.percentage );
|
$this.$form.find('.woocommerce-importer-progress').val( response.data.percentage );
|
||||||
|
|
||||||
if ( 'done' === response.data.position ) {
|
if ( 'done' === response.data.position ) {
|
||||||
window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 );
|
var file_name = wc_product_import_params.file.split('/').pop();
|
||||||
|
window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 )+'&file-name='+file_name;
|
||||||
} else {
|
} else {
|
||||||
$this.run_import();
|
$this.run_import();
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,11 +455,12 @@ class WC_Product_CSV_Importer_Controller {
|
||||||
*/
|
*/
|
||||||
protected function done() {
|
protected function done() {
|
||||||
check_admin_referer( 'woocommerce-csv-importer' );
|
check_admin_referer( 'woocommerce-csv-importer' );
|
||||||
$imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0;
|
$imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0;
|
||||||
$updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0;
|
$updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0;
|
||||||
$failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0;
|
$failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0;
|
||||||
$skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0;
|
$skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0;
|
||||||
$errors = array_filter( (array) get_user_option( 'product_import_error_log' ) );
|
$file_name = isset( $_GET['file-name'] ) ? sanitize_text_field( wp_unslash( $_GET['file-name'] ) ) : '';
|
||||||
|
$errors = array_filter( (array) get_user_option( 'product_import_error_log' ) );
|
||||||
|
|
||||||
include_once dirname( __FILE__ ) . '/views/html-csv-import-done.php';
|
include_once dirname( __FILE__ ) . '/views/html-csv-import-done.php';
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,14 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
$results[] = '<a href="#" class="woocommerce-importer-done-view-errors">' . __( 'View import log', 'woocommerce' ) . '</a>';
|
$results[] = '<a href="#" class="woocommerce-importer-done-view-errors">' . __( 'View import log', 'woocommerce' ) . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $file_name ) ) {
|
||||||
|
$results[] = sprintf(
|
||||||
|
/* translators: %s: File name */
|
||||||
|
__( 'File uploaded: %s', 'woocommerce' ),
|
||||||
|
'<strong>' . $file_name . '</strong>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/* translators: %d: import results */
|
/* translators: %d: import results */
|
||||||
echo wp_kses_post( __( 'Import complete!', 'woocommerce' ) . ' ' . implode( '. ', $results ) );
|
echo wp_kses_post( __( 'Import complete!', 'woocommerce' ) . ' ' . implode( '. ', $results ) );
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue