options
4 days ago
template
1 month ago
confirm.php
1 month ago
element.php
1 month ago
error.php
1 month ago
evaluate.php
1 month ago
evaluate_variations.php
1 month ago
filters.php
1 month ago
full-preview-modal.php
1 month ago
index.php
1 month ago
options.php
1 month ago
preview.php
1 month ago
preview_images.php
1 month ago
preview_prices.php
1 month ago
preview_taxonomies.php
1 month ago
process-complete.php
1 month ago
process.php
1 month ago
tag.php
1 month ago
template.php
1 month ago
warning.php
1 month ago
process.php
516 lines
| 1 | <?php if ( ! defined( 'ABSPATH' ) ) exit; // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals ?> |
| 2 | <h2 class="wpallimport-wp-notices"></h2> |
| 3 | |
| 4 | <div class="inner-content wpallimport-step-6 wpallimport-wrapper"> |
| 5 | |
| 6 | <div class="wpallimport-header"> |
| 7 | <div class="wpallimport-logo"></div> |
| 8 | <div class="wpallimport-title"> |
| 9 | <h2><?php esc_html_e('Confirm & Run', 'wp-all-import'); ?></h2> |
| 10 | </div> |
| 11 | <?php echo wp_kses_post( apply_filters('wpallimport_links_block', '') );?> |
| 12 | |
| 13 | <div class="clear"></div> |
| 14 | <?php |
| 15 | |
| 16 | function echoProcessingStep1($update_previous) { |
| 17 | ?> |
| 18 | <div class="processing_step_1"> |
| 19 | <div class="clear"></div> |
| 20 | |
| 21 | <div class="step_description"> |
| 22 | <h2><?php echo wp_kses( __('Import <span id="status">in Progress</span>', 'wp-all-import'), array('span' => array('id' => array())) ) ?></h2> |
| 23 | <h3 id="process_notice"><?php esc_html_e('Importing may take some time. Please do not close your browser or refresh the page until the process is complete.', 'wp-all-import'); ?></h3> |
| 24 | </div> |
| 25 | <div id="processbar" class="rad30"> |
| 26 | <div class="rad30"></div> |
| 27 | <span id="center_progress"><span id="percents_count">0</span>%</span> |
| 28 | </div> |
| 29 | <div id="import_progress"> |
| 30 | <span id="left_progress"><?php esc_html_e('Time Elapsed', 'wp-all-import');?> <span id="then">00:00:00</span></span> |
| 31 | <span id="right_progress"> |
| 32 | <div class="progress_processed"> |
| 33 | <span><?php esc_html_e('Processed', 'wp-all-import');?> <span class="processed_count"><?php echo esc_html($update_previous->created + $update_previous->updated + $update_previous->skipped); ?></span> <?php esc_html_e('of', 'wp-all-import');?> <span id="of"><?php echo esc_html($update_previous->count); ?></span> <?php esc_html_e('records', 'wp-all-import');?></span> |
| 34 | </div> |
| 35 | <div class="progress_details"> |
| 36 | <span class="progress_details_item created_count" <?php if (empty($update_previous->created)): ?>style="display:none;"<?php endif; ?>> |
| 37 | <?php esc_html_e('Created','wp-all-import');?> <span class="created_records_count"><?php echo esc_html($update_previous->created); ?></span> |
| 38 | </span> |
| 39 | <span class="progress_details_item deleted_count" <?php if (empty($update_previous->created)): ?>style="display:none;"<?php endif; ?>> |
| 40 | <?php esc_html_e('Deleted','wp-all-import');?> <span class="deleted_records_count"><?php echo esc_html($update_previous->deleted); ?></span> |
| 41 | </span> |
| 42 | <span class="progress_details_item updated_count" <?php if (empty($update_previous->created)): ?>style="display:none;"<?php endif; ?>> |
| 43 | <?php esc_html_e('Updated','wp-all-import');?> <span class="updated_records_count"><?php echo esc_html($update_previous->updated); ?></span> |
| 44 | </span> |
| 45 | <span class="progress_details_item skipped_count" <?php if (empty($update_previous->skipped)): ?>style="display:none;"<?php endif; ?>> |
| 46 | <?php esc_html_e('Skipped','wp-all-import');?> <span class="skipped_records_count"><?php echo esc_html($update_previous->skipped); ?></span> |
| 47 | </span> |
| 48 | </div> |
| 49 | </span> |
| 50 | </div> |
| 51 | </div> |
| 52 | <?php |
| 53 | } |
| 54 | |
| 55 | if (function_exists('\WPAI\Breakdance\echoPromoCard')) { |
| 56 | ?> |
| 57 | <div class='promo-card-and-processing-step-1-wrapper'> |
| 58 | <?php |
| 59 | \WPAI\Breakdance\echoPromoCard(); |
| 60 | echoProcessingStep1($update_previous); |
| 61 | ?> |
| 62 | </div> |
| 63 | <?php |
| 64 | } else { |
| 65 | echoProcessingStep1($update_previous); |
| 66 | } |
| 67 | |
| 68 | ?> |
| 69 | |
| 70 | <?php $custom_type = get_post_type_object( PMXI_Plugin::$session->options['custom_type'] ); ?> |
| 71 | |
| 72 | <div id="import_finished"> |
| 73 | <h1><?php esc_html_e('Import Complete!', 'wp-all-import'); ?></h1> |
| 74 | <div class="wpallimport-content-section wpallimport-complete-statistics"> |
| 75 | <?php /* translators: see placeholders in the string below */ ?> |
| 76 | <p><?php echo wp_kses( sprintf(__('All <b>%1$s</b> records from <b>%2$s</b> were successfully processed.', 'wp-all-import'), '<span class="processed_count"></span>', esc_html((PMXI_Plugin::$session->source['type'] != 'url') ? basename(PMXI_Plugin::$session->source['path']) : PMXI_Plugin::$session->source['path'])), array('b' => array(), 'span' => array('class' => array())) ); ?></p> |
| 77 | <p class="wpallimport-complete-details"> |
| 78 | <?php esc_html_e('WP All Import', 'wp-all-import'); ?> |
| 79 | <?php /* translators: see placeholders in the string below */ ?> |
| 80 | <span class="created_count complete-details-item" style="display: none;"><?php echo wp_kses( sprintf(__('created <b>%s</b> new records','wp-all-import'), '<span class="created_records_count"></span>'), array('b' => array(), 'span' => array('class' => array())) );?></span><span class="updated_count complete-details-item" style="display: none;"><?php echo wp_kses( sprintf(__('updated <b>%s</b> records','wp-all-import'), '<span class="updated_records_count"></span>'), array('b' => array(), 'span' => array('class' => array())) );?></span><span class="deleted_count complete-details-item" style="display: none;"><?php echo wp_kses( sprintf(__('deleted <b>%s</b> records','wp-all-import'), '<span class="deleted_records_count"></span>'), array('b' => array(), 'span' => array('class' => array())) );?></span><span class="skipped_count complete-details-item" style="display: none;"><?php echo wp_kses( sprintf(__('skipped <b>%s</b> records','wp-all-import'), '<span class="skipped_records_count"></span>'), array('b' => array(), 'span' => array('class' => array())) );?></span> |
| 81 | </p> |
| 82 | <?php if (!empty($update_previous->options['is_selective_hashing'])): ?> |
| 83 | <p class="wpallimport-skipped-notice"> |
| 84 | <?php /* translators: see placeholders in the string below */ ?> |
| 85 | <b><span class="skipped_by_hash_records_count"></span></b> <?php echo wp_kses( sprintf(__('records were skipped because their data in <b>%s</b> hasn\'t changed.', 'wp-all-import'), esc_html((PMXI_Plugin::$session->source['type'] != 'url') ? basename(PMXI_Plugin::$session->source['path']) : PMXI_Plugin::$session->source['path'])), array('b' => array()) ); ?><br/><a href="<?php echo esc_url(add_query_arg(array('id' => $update_previous->id, 'page' => 'pmxi-admin-manage', 'action' => 'disable_skip_posts'), $this->baseUrl)); ?>"><?php esc_html_e('Run this import again without skipping records ›', 'wp-all-import'); ?></a> |
| 86 | </p> |
| 87 | <?php endif; ?> |
| 88 | </div> |
| 89 | <div class="wpallimport-content-section wpallimport-console wpallimport-complete-warning"> |
| 90 | <h3><?php esc_html_e('Duplicate records detected during import', 'wp-all-import'); ?><a href="#help" class="wpallimport-help" title="<?php esc_attr_e('The unique identifier is how WP All Import tells two items in your import file apart. If it is the same for two items, then the first item will be overwritten when the second is imported.', 'wp-all-import') ?>">?</a></h3> |
| 91 | <h4> |
| 92 | <?php /* translators: see placeholders in the string below */ ?> |
| 93 | <?php echo wp_kses( sprintf(__('The file you are importing has %1$s records, but WP All Import only created <span class="inserted_count"></span> %2$s. It detected the other records in your file as duplicates. This could be because they actually are duplicates or it could be because your Unique Identifier is not unique for each record.<br><br>If your import file has no duplicates and you want to import all %3$s records, you should delete everything that was just imported and then edit your Unique Identifier so it\'s unique for each item.', 'wp-all-import'), esc_html($update_previous->count), esc_html($custom_type->labels->name), esc_html($update_previous->count)), array('span' => array('class' => array()), 'br' => array()) ); ?> |
| 94 | </h4> |
| 95 | <input type="button" class="button wpallimport-large-button wpallimport-delete-and-edit" rel="<?php echo esc_url(add_query_arg(array('id' => $update_previous->id, 'page' => 'pmxi-admin-manage', 'action' => 'delete_and_edit', '_wpnonce_delete-and-edit' => wp_create_nonce('delete-and-edit')), $this->baseUrl)); ?>" value="<?php esc_attr_e('Delete & Edit', 'wp-all-import'); ?>"/> |
| 96 | </div> |
| 97 | <div class="wpallimport-content-section wpallimport-console wpallimport-orders-complete-warning"> |
| 98 | <?php /* translators: see placeholders in the string below */ ?> |
| 99 | <h3><?php echo wp_kses( sprintf(__('<span class="skipped_records_count">%s</span> orders were skipped during this import', 'wp-all-import'), esc_html($update_previous->skipped)), array('span' => array('class' => array())) ); ?></h3> |
| 100 | <h4> |
| 101 | <?php /* translators: see placeholders in the string below */ ?> |
| 102 | <?php echo wp_kses( sprintf(__('WP All Import is unable to import an order when it cannot match the products or customer specified. <a href="%s" style="margin: 0;">See the import log</a> for a list of which orders were skipped and why.', 'wp-all-import'), esc_url(add_query_arg(array('id' => $update_previous->id, 'page' => 'pmxi-admin-history', 'action' => 'log', 'history_id' => PMXI_Plugin::$session->history_id, '_wpnonce' => wp_create_nonce( '_wpnonce-download_log' )), $this->baseUrl))), array('a' => array('href' => array(), 'style' => array())) ); ?> |
| 103 | </h4> |
| 104 | <input type="button" class="button wpallimport-large-button wpallimport-delete-and-edit" rel="<?php echo esc_url(add_query_arg(array('id' => $update_previous->id, 'page' => 'pmxi-admin-manage', 'action' => 'delete_and_edit', '_wpnonce_delete-and-edit' => wp_create_nonce('delete-and-edit')), $this->baseUrl)); ?>" value="<?php esc_attr_e('Delete & Edit', 'wp-all-import'); ?>"/> |
| 105 | </div> |
| 106 | <?php /* translators: see placeholders in the string below */ ?> |
| 107 | <!-- <h3 class="wpallimport-complete-success">--><?php //printf(__('WP All Import successfully imported your file <span>%s</span> into your WordPress installation!','wp-all-import'), (PMXI_Plugin::$session->source['type'] != 'url') ? basename(PMXI_Plugin::$session->source['path']) : PMXI_Plugin::$session->source['path'])?><!--</h3> --> |
| 108 | <?php if ($ajax_processing): ?> |
| 109 | <?php /* translators: see placeholders in the string below */ ?> |
| 110 | <p class="wpallimport-log-details"><?php echo wp_kses( sprintf(__('There were <span class="wpallimport-errors-count">%1$s</span> errors and <span class="wpallimport-warnings-count">%2$s</span> warnings in this import. You can see these in the import log.', 'wp-all-import'), 0, 0), array('span' => array('class' => array())) ); ?></p> |
| 111 | <?php elseif ((int) PMXI_Plugin::$session->errors or (int) PMXI_Plugin::$session->warnings): ?> |
| 112 | <?php /* translators: see placeholders in the string below */ ?> |
| 113 | <p class="wpallimport-log-details" style="display:block;"><?php echo wp_kses( sprintf(__('There were <span class="wpallimport-errors-count">%1$s</span> errors and <span class="wpallimport-warnings-count">%2$s</span> warnings in this import. You can see these in the import log.', 'wp-all-import'), esc_html(PMXI_Plugin::$session->errors), esc_html(PMXI_Plugin::$session->warnings)), array('span' => array('class' => array())) ); ?></p> |
| 114 | <?php endif; ?> |
| 115 | <hr> |
| 116 | <a href="<?php echo esc_url(add_query_arg(array('id' => $update_previous->id, 'page' => 'pmxi-admin-history'), $this->baseUrl)); ?>" id="download_log"><?php esc_html_e('View Logs','wp-all-import');?></a> |
| 117 | <a href="<?php echo esc_url(add_query_arg(array('page' => 'pmxi-admin-manage'), remove_query_arg(array('id','page'), $this->baseUrl))); ?>" id="manage_imports"><?php esc_html_e('Manage Imports', 'wp-all-import') ?></a> |
| 118 | </div> |
| 119 | |
| 120 | </div> |
| 121 | |
| 122 | <div class="wpallimport-content-section wpallimport-speed-up-notify"> |
| 123 | <button class="notice-dismiss dismiss-speed-up-notify" type="button"> |
| 124 | <span class="screen-reader-text"><?php esc_html_e('Hide this notice.', 'wp-all-import'); ?></span> |
| 125 | </button> |
| 126 | <div class="wpallimport-notify-wrapper"> |
| 127 | <div class="found_records speedup"> |
| 128 | <h3><?php esc_html_e('Want to speed up your import?', 'wp-all-import');?></h3> |
| 129 | <h4><?php esc_html_e("Check out our guide on increasing import speed.", "wp-all-import"); ?></h4> |
| 130 | </div> |
| 131 | </div> |
| 132 | <a class="button wpallimport-large-button wpallimport-speed-up-notify-read-more" href="http://www.wpallimport.com/documentation/troubleshooting/slow-imports/?utm_source=import-plugin-free&utm_medium=error&utm_campaign=slow-imports" target="_blank"><?php esc_html_e('Read More', 'wp-all-import');?></a> |
| 133 | <span><?php esc_html_e('opens in new tab', 'wp-all-import'); ?></span> |
| 134 | </div> |
| 135 | |
| 136 | <div class="wpallimport-modal-message rad4"> |
| 137 | |
| 138 | <div class="wpallimport-content-section" style="display:block; position: relative;"> |
| 139 | <div class="wpallimport-notify-wrapper"> |
| 140 | <div class="found_records terminated"> |
| 141 | <h3><?php esc_html_e('Your server terminated the import process', 'wp-all-import');?></h3> |
| 142 | <?php /* translators: see placeholders in the string below */ ?> |
| 143 | <h4 style="width: 77%; line-height: 25px;"><?php echo wp_kses( sprintf(__("<a href='%s' target='_blank'>Read more</a> about how to prevent this from happening again.", "wp-all-import"), esc_url("http://www.wpallimport.com/documentation/troubleshooting/terminated-imports/?utm_source=import-plugin-free&utm_medium=error&utm_campaign=termination")), array('a' => array('href' => array(), 'target' => array())) ); ?></h4> |
| 144 | </div> |
| 145 | </div> |
| 146 | <input type="submit" id="wpallimport-try-again" style="position: absolute; top: 30%; right: 10px; display: block; padding-top: 1px;" value="<?php esc_attr_e('Continue Import','wp-all-import');?>" class="button wpallimport-large-button"> |
| 147 | <?php /* translators: see placeholders in the string below */ ?> |
| 148 | <span class="wp_all_import_restart_import"><?php echo wp_kses( sprintf(__("with <span id='wpallimport-new-records-per-iteration'>%s</span> records per iteration", 'wp-all-import'), esc_html((ceil($update_previous->options['records_per_request']/2)) ? ceil($update_previous->options['records_per_request']/2) : 1)), array('span' => array('id' => array())) ); ?></span> |
| 149 | </div> |
| 150 | |
| 151 | </div> |
| 152 | |
| 153 | <fieldset id="logwrapper"> |
| 154 | <legend><?php esc_html_e('Log','wp-all-import');?></legend> |
| 155 | <div id="loglist"></div> |
| 156 | </fieldset> |
| 157 | |
| 158 | <input type="hidden" class="count_failures" value="0"/> |
| 159 | <input type="hidden" class="records_per_request" value="<?php echo esc_attr($update_previous->options['records_per_request']); ?>"/> |
| 160 | <span id="wpallimport-error-terminated" style="display:none;"> |
| 161 | <div class="wpallimport-content-section" style="display:block; position: relative;"> |
| 162 | <div class="wpallimport-notify-wrapper"> |
| 163 | <div class="found_records terminated" style="background-position: 0px 50% !important;"> |
| 164 | <h3><?php esc_html_e('Your server terminated the import process', 'wp-all-import');?></h3> |
| 165 | <h4 style="width: 78%; line-height: 25px;"><?php esc_html_e("Ask your host to check your server's error log. They will be able to determine why your server is terminating the import process.", "wp-all-import"); ?></h4> |
| 166 | </div> |
| 167 | </div> |
| 168 | <a style="position: absolute; top: 35%; right: 10px; display: block; padding-top: 1px;" class="button wpallimport-large-button" href="http://www.wpallimport.com/documentation/troubleshooting/terminated-imports/?utm_source=import-plugin-free&utm_medium=error&utm_campaign=docs" target="_blank"><?php esc_html_e('Read More', 'wp-all-import');?></a> |
| 169 | </div> |
| 170 | </span> |
| 171 | |
| 172 | <div class="wpallimport-display-columns wpallimport-margin-top-forty"> |
| 173 | <?php echo wp_kses_post( apply_filters('wpallimport_footer', '') ); ?> |
| 174 | </div> |
| 175 | |
| 176 | </div> |
| 177 | |
| 178 | <script type="text/javascript"> |
| 179 | //<![CDATA[ |
| 180 | (function($){ |
| 181 | |
| 182 | window.onbeforeunload = function () { |
| 183 | return 'WARNING:\nImport process in under way, leaving the page will interrupt\nthe operation and most likely to cause leftovers in posts.'; |
| 184 | }; |
| 185 | |
| 186 | var odd = false; |
| 187 | var interval; |
| 188 | |
| 189 | function write_log(){ |
| 190 | |
| 191 | $('.progress-msg').each(function(i){ |
| 192 | |
| 193 | if ($('#loglist').find('p').length > 350) $('#loglist').html(''); |
| 194 | |
| 195 | <?php if ( ! $ajax_processing ): ?> |
| 196 | if ($(this).find('.processing_info').length) { |
| 197 | $('.created_records_count').html($(this).find('.created_count').html()); |
| 198 | $('.updated_records_count').html($(this).find('.updated_count').html()); |
| 199 | $('#percents_count').html($(this).find('.percents_count').html()); |
| 200 | } |
| 201 | <?php endif; ?> |
| 202 | |
| 203 | if ( ! $(this).find('.processing_info').length ){ |
| 204 | $('#loglist').append('<p ' + ((odd) ? 'class="odd"' : 'class="even"') + '>' + $(this).html() + '</p>'); |
| 205 | odd = !odd; |
| 206 | } |
| 207 | $(this).remove(); |
| 208 | }); |
| 209 | } |
| 210 | |
| 211 | $('.dismiss-speed-up-notify').click(function(e){ |
| 212 | e.preventDefault(); |
| 213 | $.post('admin.php?page=pmxi-admin-settings&action=dismiss_speed_up', {dismiss: true, |
| 214 | security: wp_all_import_security }, function (data) {}, 'html'); |
| 215 | $('.wpallimport-speed-up-notify').addClass('dont_show_again').slideUp(); |
| 216 | }); |
| 217 | |
| 218 | $('.wpallimport-speed-up-notify-read-more').click(function(e){ |
| 219 | e.preventDefault(); |
| 220 | $.post('admin.php?page=pmxi-admin-settings&action=dismiss_speed_up', {dismiss: true, |
| 221 | security: wp_all_import_security }, function (data) {}, 'html'); |
| 222 | $('.wpallimport-speed-up-notify').addClass('dont_show_again').slideUp(); |
| 223 | window.open($(this).attr('href'), '_blank'); |
| 224 | }); |
| 225 | |
| 226 | $('#status').each(function () { |
| 227 | |
| 228 | var then = $('#then'); |
| 229 | let start_date = new Date().getTime(), |
| 230 | elapsed = '0.0'; |
| 231 | |
| 232 | update = function(){ |
| 233 | |
| 234 | let offset = new Date().getTime() - start_date; |
| 235 | |
| 236 | elapsed = Math.floor(offset / 100) / 10; |
| 237 | |
| 238 | // Format seconds into elapsed time string. |
| 239 | let fm = [ |
| 240 | /*Math.floor(elapsed / 60 / 60 / 24), // DAYS*/ |
| 241 | Math.floor(elapsed / 60 / 60) % 24, // HOURS |
| 242 | Math.floor(elapsed / 60) % 60, // MINUTES |
| 243 | Math.floor(elapsed % 60) // SECONDS |
| 244 | ]; |
| 245 | elapsed = $.map(fm, function(v, i) { return ((v < 10) ? '0' : '') + v; }).join(':'); |
| 246 | |
| 247 | /*var duration = wpai_moment.duration({'seconds' : 1}); |
| 248 | start_date.add(duration);*/ |
| 249 | |
| 250 | if ($('#process_notice').is(':visible') && ! $('.wpallimport-modal-message').is(':visible')){ |
| 251 | then.html(elapsed); |
| 252 | } |
| 253 | }; |
| 254 | update(); |
| 255 | setInterval(update, 1000); |
| 256 | |
| 257 | var records_per_request = $('.records_per_request').val(); |
| 258 | var execution_time = 0; |
| 259 | |
| 260 | var $this = $(this); |
| 261 | interval = setInterval(function () { |
| 262 | |
| 263 | write_log(); |
| 264 | |
| 265 | var percents = $('#percents_count').html(); |
| 266 | $('#processbar div').css({'width': ((parseInt(percents) > 100 || percents == undefined) ? 100 : percents) + '%'}); |
| 267 | |
| 268 | execution_time++; |
| 269 | |
| 270 | if ( execution_time == 300 && parseInt(percents) < 10 && ! $('.wpallimport-speed-up-notify').hasClass('dont_show_again') && ! $('.wpallimport-modal-message').is(':visible')) |
| 271 | { |
| 272 | $('.wpallimport-speed-up-notify').show(); |
| 273 | } |
| 274 | |
| 275 | }, 1000); |
| 276 | |
| 277 | $('#processbar').css({'visibility':'visible'}); |
| 278 | |
| 279 | <?php if ( $ajax_processing ): ?> |
| 280 | |
| 281 | var import_id = '<?php echo intval($update_previous->id); ?>'; |
| 282 | |
| 283 | function parse_element(failures){ |
| 284 | |
| 285 | $.get('admin.php?page=pmxi-admin-import&action=process&id=' + import_id + '&failures=' + failures + '&_wpnonce=' + wp_all_import_security, {}, function (data) { |
| 286 | |
| 287 | // response with error |
| 288 | if (data != null && typeof data.created != "undefined"){ |
| 289 | |
| 290 | $('.wpallimport-modal-message').hide(); |
| 291 | $('.created_records_count').html(data.created); |
| 292 | if (parseInt(data.created)) { |
| 293 | $('.created_count').show(); |
| 294 | } |
| 295 | $('.inserted_count').html(data.created); |
| 296 | $('.updated_records_count').html(data.updated); |
| 297 | if (parseInt(data.updated)) { |
| 298 | $('.updated_count').show(); |
| 299 | } |
| 300 | $('.skipped_records_count').html(data.skipped); |
| 301 | $('.skipped_by_hash_records_count').html(data.skipped_by_hash); |
| 302 | if (parseInt(data.skipped)) { |
| 303 | $('.skipped_count').show(); |
| 304 | } |
| 305 | $('.deleted_records_count').html(data.deleted); |
| 306 | if (parseInt(data.deleted)) { |
| 307 | $('.deleted_count').show(); |
| 308 | } |
| 309 | $('.processed_count').html(parseInt(data.created) + parseInt(data.updated) + parseInt(data.skipped)); |
| 310 | $('#warnings').html(data.warnings); |
| 311 | $('#errors').html(data.errors); |
| 312 | $('#percents_count').html(data.percentage); |
| 313 | $('#processbar div').css({'width': data.percentage + '%'}); |
| 314 | |
| 315 | records_per_request = data.records_per_request; |
| 316 | |
| 317 | if ( data.done ){ |
| 318 | clearInterval(update); |
| 319 | clearInterval(interval); |
| 320 | |
| 321 | setTimeout(function() { |
| 322 | |
| 323 | $('#loglist').append(data.log); |
| 324 | $('#process_notice').hide(); |
| 325 | $('.processing_step_1').hide(); |
| 326 | |
| 327 | // detect broken auto-created Unique ID and notify user |
| 328 | <?php if ( $this->isWizard and $update_previous->options['wizard_type'] == 'new' and ! $update_previous->options['deligate']): ?> |
| 329 | if ( data.imported != data.created ) |
| 330 | { |
| 331 | $('.wpallimport-complete-warning').show(); |
| 332 | } |
| 333 | <?php endif; ?> |
| 334 | |
| 335 | <?php if ( ! $update_previous->options['deligate'] and ! empty($update_previous->options['custom_type']) and $update_previous->options['custom_type'] == 'shop_order' and empty($update_previous->options['is_import_specified'])): ?> |
| 336 | if ( data.skipped > 0 ) |
| 337 | { |
| 338 | $('.wpallimport-orders-complete-warning').show(); |
| 339 | } |
| 340 | <?php endif; ?> |
| 341 | |
| 342 | if (data.skipped > 0 && parseInt(data.skipped) === parseInt(data.skipped_by_hash)) { |
| 343 | $('.wpallimport-complete-details').hide(); |
| 344 | } |
| 345 | if (parseInt(data.skipped_by_hash) > 0) { |
| 346 | $('.wpallimport-skipped-notice').show(); |
| 347 | } |
| 348 | |
| 349 | $('.promo-card-and-processing-step-1-wrapper').hide(); |
| 350 | |
| 351 | $('#import_finished').show('fast', function() { |
| 352 | let items = $('.wpallimport-complete-details .complete-details-item:visible'); |
| 353 | if (items.length > 1) { |
| 354 | for (let i = 0; i < items.length - 2; i++) { |
| 355 | items[i].append(', '); |
| 356 | } |
| 357 | items.last().prepend(', and '); |
| 358 | } |
| 359 | items.last().append('.'); |
| 360 | }); |
| 361 | |
| 362 | if ( parseInt(data.errors) || parseInt(data.warnings)){ |
| 363 | $('.wpallimport-log-details').find('.wpallimport-errors-count').html(data.errors); |
| 364 | $('.wpallimport-log-details').find('.wpallimport-warnings-count').html(data.warnings); |
| 365 | $('.wpallimport-log-details').show(); |
| 366 | } |
| 367 | |
| 368 | }, 1000); |
| 369 | } |
| 370 | else |
| 371 | { |
| 372 | $('#loglist').append(data.log); |
| 373 | parse_element(0); |
| 374 | } |
| 375 | |
| 376 | write_log(); |
| 377 | |
| 378 | } else { |
| 379 | var count_failures = parseInt($('.count_failures').val()); |
| 380 | count_failures++; |
| 381 | $('.count_failures').val(count_failures); |
| 382 | |
| 383 | if (data != null && typeof data != 'undefined' && typeof data.log != 'undefined'){ |
| 384 | $('#loglist').append(data.log); |
| 385 | write_log(); |
| 386 | } |
| 387 | |
| 388 | if (data != null && typeof data != 'undefined' && parseInt(data.records_per_request)){ |
| 389 | records_per_request = data.records_per_request; |
| 390 | } |
| 391 | |
| 392 | if (count_failures > 4 || records_per_request < 2){ |
| 393 | $('#process_notice').hide(); |
| 394 | $('.wpallimport-modal-message').html($('#wpallimport-error-terminated').html()).show(); |
| 395 | var errorMessage = "Import failed, please check logs"; |
| 396 | if (data != null && typeof data != 'undefined' && typeof data.responseText != 'undefined'){ |
| 397 | errorMessage = data.responseText; |
| 398 | } |
| 399 | $('#status').html('Error ' + '<span class="pmxi_error_msg">' + errorMessage + '</span>'); |
| 400 | |
| 401 | clearInterval(update); |
| 402 | window.onbeforeunload = false; |
| 403 | |
| 404 | var request = { |
| 405 | action:'import_failed', |
| 406 | id: '<?php echo intval($update_previous->id); ?>', |
| 407 | security: wp_all_import_security |
| 408 | }; |
| 409 | |
| 410 | $.ajax({ |
| 411 | type: 'POST', |
| 412 | url: ajaxurl, |
| 413 | data: request, |
| 414 | success: function(response) { |
| 415 | |
| 416 | }, |
| 417 | error: function(request) { |
| 418 | |
| 419 | }, |
| 420 | dataType: "json" |
| 421 | }); |
| 422 | |
| 423 | } |
| 424 | else{ |
| 425 | $('#wpallimport-records-per-iteration').html(records_per_request); |
| 426 | $('#wpallimport-new-records-per-iteration').html(Math.ceil(parseInt(records_per_request)/2)); |
| 427 | records_per_request = Math.ceil(parseInt(records_per_request)/2); |
| 428 | $('.wpallimport-modal-message').show(); |
| 429 | //parse_element(1); |
| 430 | } |
| 431 | return; |
| 432 | } |
| 433 | |
| 434 | }, 'json').fail(function(data) { |
| 435 | |
| 436 | var count_failures = parseInt($('.count_failures').val()); |
| 437 | count_failures++; |
| 438 | $('.count_failures').val(count_failures); |
| 439 | |
| 440 | if (count_failures > 4 || records_per_request < 2 ){ |
| 441 | $('#process_notice').hide(); |
| 442 | $('.wpallimport-modal-message').html($('#wpallimport-error-terminated').html()).show(); |
| 443 | |
| 444 | if (data != null && typeof data != 'undefined'){ |
| 445 | $('#status').html('Error ' + '<span class="pmxi_error_msg">' + data.responseText + '</span>'); |
| 446 | } |
| 447 | else{ |
| 448 | $('#status').html('Error'); |
| 449 | } |
| 450 | clearInterval(update); |
| 451 | window.onbeforeunload = false; |
| 452 | |
| 453 | var request = { |
| 454 | action:'import_failed', |
| 455 | id: '<?php echo intval($update_previous->id); ?>', |
| 456 | security: wp_all_import_security |
| 457 | }; |
| 458 | |
| 459 | $.ajax({ |
| 460 | type: 'POST', |
| 461 | url: ajaxurl, |
| 462 | data: request, |
| 463 | success: function(response) { |
| 464 | |
| 465 | }, |
| 466 | error: function(request) { |
| 467 | |
| 468 | }, |
| 469 | dataType: "json" |
| 470 | }); |
| 471 | } |
| 472 | else{ |
| 473 | $('#wpallimport-records-per-iteration').html(records_per_request); |
| 474 | $('#wpallimport-new-records-per-iteration').html(Math.ceil(parseInt(records_per_request)/2)); |
| 475 | records_per_request = Math.ceil(parseInt(records_per_request)/2); |
| 476 | $('.wpallimport-modal-message').show(); |
| 477 | //parse_element(1); |
| 478 | } |
| 479 | }); |
| 480 | } |
| 481 | |
| 482 | $('#wpallimport-try-again').click(function(e){ |
| 483 | e.preventDefault(); |
| 484 | parse_element(1); |
| 485 | $('.wpallimport-modal-message').hide(); |
| 486 | }); |
| 487 | |
| 488 | $('#processbar').css({'visibility':'visible'}); |
| 489 | |
| 490 | parse_element(0); |
| 491 | |
| 492 | <?php else: ?> |
| 493 | |
| 494 | complete = function(){ |
| 495 | if ($('#status').html() == 'Complete'){ |
| 496 | setTimeout(function() { |
| 497 | $('#process_notice').hide(); |
| 498 | $('.processing_step_1').hide(); |
| 499 | $('#import_finished').fadeIn(); |
| 500 | }, 1000); |
| 501 | clearInterval(update); |
| 502 | clearInterval(complete); |
| 503 | } |
| 504 | }; |
| 505 | setInterval(complete, 1000); |
| 506 | complete(); |
| 507 | |
| 508 | <?php endif; ?> |
| 509 | |
| 510 | }); |
| 511 | |
| 512 | })(jQuery); |
| 513 | |
| 514 | //]]> |
| 515 | </script> |
| 516 |