woocommerce/assets/js/admin/wc-product-import.min.js

1 line
1.4 KiB
JavaScript
Raw Normal View History

2017-06-19 11:49:34 +00:00
!function(t,i){var p=function(t){this.$form=t,this.xhr=!1,this.mapping=wc_product_import_params.mapping,this.position=0,this.file=wc_product_import_params.file,this.update_existing=wc_product_import_params.update_existing,this.delimiter=wc_product_import_params.delimiter,this.security=wc_product_import_params.import_nonce,this.imported=0,this.failed=0,this.updated=0,this.skipped=0,this.$form.find(".woocommerce-importer-progress").val(0),this.run_import=this.run_import.bind(this),this.run_import()};p.prototype.run_import=function(){var p=this;t.ajax({type:"POST",url:ajaxurl,data:{action:"woocommerce_do_ajax_product_import",position:p.position,mapping:p.mapping,file:p.file,update_existing:p.update_existing,delimiter:p.delimiter,security:p.security},dataType:"json",success:function(t){t.success&&(p.position=t.data.position,p.imported+=t.data.imported,p.failed+=t.data.failed,p.updated+=t.data.updated,p.skipped+=t.data.skipped,p.$form.find(".woocommerce-importer-progress").val(t.data.percentage),"done"===t.data.position?i.location=t.data.url+"&products-imported="+parseInt(p.imported,10)+"&products-failed="+parseInt(p.failed,10)+"&products-updated="+parseInt(p.updated,10)+"&products-skipped="+parseInt(p.skipped,10):p.run_import())}}).fail(function(t){i.console.log(t)})},t.fn.wc_product_importer=function(){return new p(this),this},t(".woocommerce-importer").wc_product_importer()}(jQuery,window);