woocommerce/includes/admin/importers/views/html-csv-import-done.php

105 lines
2.9 KiB
PHP
Raw Normal View History

2017-05-19 12:25:03 +00:00
<?php
/**
* Admin View: Importer - Done!
*
* @package WooCommerce\Admin\Importers
2017-05-19 12:25:03 +00:00
*/
2017-05-19 12:25:03 +00:00
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="wc-progress-form-content woocommerce-importer">
<section class="woocommerce-importer-done">
<?php
$results = array();
2017-05-23 14:05:32 +00:00
if ( 0 < $imported ) {
$results[] = sprintf(
/* translators: %d: products count */
_n( '%s product imported', '%s products imported', $imported, 'woocommerce' ),
'<strong>' . number_format_i18n( $imported ) . '</strong>'
);
}
2017-05-23 14:05:32 +00:00
if ( 0 < $updated ) {
$results[] = sprintf(
/* translators: %d: products count */
_n( '%s product updated', '%s products updated', $updated, 'woocommerce' ),
'<strong>' . number_format_i18n( $updated ) . '</strong>'
);
}
2017-05-23 14:05:32 +00:00
if ( 0 < $skipped ) {
$results[] = sprintf(
/* translators: %d: products count */
_n( '%s product was skipped', '%s products were skipped', $skipped, 'woocommerce' ),
'<strong>' . number_format_i18n( $skipped ) . '</strong>'
);
}
2017-05-19 12:25:03 +00:00
if ( 0 < $failed ) {
$results [] = sprintf(
/* translators: %d: products count */
_n( 'Failed to import %s product', 'Failed to import %s products', $failed, 'woocommerce' ),
'<strong>' . number_format_i18n( $failed ) . '</strong>'
);
}
2017-05-19 12:25:03 +00:00
if ( 0 < $failed || 0 < $skipped ) {
$results[] = '<a href="#" class="woocommerce-importer-done-view-errors">' . __( 'View import log', 'woocommerce' ) . '</a>';
}
2017-05-23 14:05:32 +00:00
if ( ! empty( $file_name ) ) {
$results[] = sprintf(
/* translators: %s: File name */
__( 'File uploaded: %s', 'woocommerce' ),
'<strong>' . $file_name . '</strong>'
);
}
/* translators: %d: import results */
echo wp_kses_post( __( 'Import complete!', 'woocommerce' ) . ' ' . implode( '. ', $results ) );
2017-05-19 12:25:03 +00:00
?>
</section>
2017-05-23 14:05:32 +00:00
<section class="wc-importer-error-log" style="display:none">
<table class="widefat wc-importer-error-log-table">
<thead>
<tr>
<th><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
<th><?php esc_html_e( 'Reason for failure', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php
if ( count( $errors ) ) {
foreach ( $errors as $error ) {
if ( ! is_wp_error( $error ) ) {
continue;
2017-05-23 14:05:32 +00:00
}
$error_data = $error->get_error_data();
?>
<tr>
<th><code><?php echo esc_html( $error_data['row'] ); ?></code></th>
<td><?php echo esc_html( $error->get_error_message() ); ?></td>
</tr>
<?php
2017-05-23 14:05:32 +00:00
}
}
2017-05-23 14:05:32 +00:00
?>
</tbody>
</table>
</section>
<script type="text/javascript">
jQuery(function() {
jQuery( '.woocommerce-importer-done-view-errors' ).on( 'click', function() {
jQuery( '.wc-importer-error-log' ).slideToggle();
return false;
} );
} );
</script>
2017-05-19 12:25:03 +00:00
<div class="wc-actions">
<a class="button button-primary" href="<?php echo esc_url( admin_url( 'edit.php?post_type=product' ) ); ?>"><?php esc_html_e( 'View products', 'woocommerce' ); ?></a>
</div>
</div>