Product Import Export for WooCommerce - Version 2.2.2

Version Description

2022-07-05 = * Enhancement: Export to CSV option to Bulk Action drop-down menu in WC Product listing page. * Enhancement: Import progress screen improvements. * WooCommerce 6.6 Tested OK.

Download this release

Release Info

Developer webtoffee
Plugin Icon 128x128 Product Import Export for WooCommerce
Version 2.2.2
Comparing to
See all releases

Code changes from version 2.2.1 to 2.2.2

admin/class-wt-import-export-for-woo-admin.php CHANGED
@@ -465,7 +465,7 @@ class Wt_Import_Export_For_Woo_Admin_Basic {
465
 
466
  public function tools_wtexport_text(){
467
 
468
- echo "<p><b>" . sprintf( __( 'Export WooCommerce products, product categories, product tags and product reviews in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export' ) ) . "</b></p>";
469
 
470
  if( !is_plugin_active( 'users-customers-import-export-for-wp-woocommerce/users-customers-import-export-for-wp-woocommerce.php' ) ){
471
  echo "<p><b>" . sprintf(
@@ -474,7 +474,7 @@ class Wt_Import_Export_For_Woo_Admin_Basic {
474
  admin_url('plugin-install.php?tab=plugin-information&plugin=users-customers-import-export-for-wp-woocommerce')
475
  ) . "</b></p>";
476
  }else{
477
- echo "<p><b>" . sprintf( __( 'Export Users and WooCommerce customers in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export' ) ) . "</b></p>";
478
  }
479
 
480
  if( !is_plugin_active( 'order-import-export-for-woocommerce/order-import-export-for-woocommerce.php' ) ){
@@ -484,7 +484,7 @@ class Wt_Import_Export_For_Woo_Admin_Basic {
484
  admin_url('plugin-install.php?tab=plugin-information&plugin=order-import-export-for-woocommerce')
485
  ) . "</b></p>";
486
  }else{
487
- echo "<p><b>" . sprintf( __( 'Export WooCommerce orders and coupons in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export' ) ) . "</b></p>";
488
  }
489
 
490
  }
465
 
466
  public function tools_wtexport_text(){
467
 
468
+ echo "<p><b>" . sprintf( __( 'Export WooCommerce products, product categories, product tags and product reviews in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export&wt_to_export=product' ) ) . "</b></p>";
469
 
470
  if( !is_plugin_active( 'users-customers-import-export-for-wp-woocommerce/users-customers-import-export-for-wp-woocommerce.php' ) ){
471
  echo "<p><b>" . sprintf(
474
  admin_url('plugin-install.php?tab=plugin-information&plugin=users-customers-import-export-for-wp-woocommerce')
475
  ) . "</b></p>";
476
  }else{
477
+ echo "<p><b>" . sprintf( __( 'Export Users and WooCommerce customers in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export&wt_to_export=user' ) ) . "</b></p>";
478
  }
479
 
480
  if( !is_plugin_active( 'order-import-export-for-woocommerce/order-import-export-for-woocommerce.php' ) ){
484
  admin_url('plugin-install.php?tab=plugin-information&plugin=order-import-export-for-woocommerce')
485
  ) . "</b></p>";
486
  }else{
487
+ echo "<p><b>" . sprintf( __( 'Export WooCommerce orders and coupons in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export&wt_to_export=order' ) ) . "</b></p>";
488
  }
489
 
490
  }
admin/css/wt-import-export-for-woo-admin.css CHANGED
@@ -241,6 +241,158 @@ span.wt_iew_mapping_field_val::after {
241
  /* popup */
242
  .wt_iew_overlay{ position:fixed; z-index:100000000; width:100%; height:100%; background-color:rgba(0,0,0,.5); left:0px; top:0px; display:none;}
243
  .wt_iew_popup{position:fixed; z-index:100000001; background:#fff; border:solid 1px #eee; text-align:center; box-shadow:0px 2px 5px #333; left:50%; display:none;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  .wt_iew_popup_hd{display:inline-block; width:100%; box-sizing:border-box; font-weight:bold; background-color:#f3f3f3; height:40px; text-align:left; line-height:40px; padding:0px 20px;}
245
  .wt_iew_popup_close{float:right; width:40px; height:40px; text-align:right; line-height:40px; cursor:pointer;}
246
  .wt_iew_popup_footer{width:100%; text-align:right; margin-top:10px;}
241
  /* popup */
242
  .wt_iew_overlay{ position:fixed; z-index:100000000; width:100%; height:100%; background-color:rgba(0,0,0,.5); left:0px; top:0px; display:none;}
243
  .wt_iew_popup{position:fixed; z-index:100000001; background:#fff; border:solid 1px #eee; text-align:center; box-shadow:0px 2px 5px #333; left:50%; display:none;}
244
+
245
+
246
+
247
+
248
+ .wt_iew_import_progress_wrap{
249
+ position: fixed;
250
+ overflow: scroll;
251
+ display: none;
252
+ top: 15px;
253
+ left: 50%;
254
+ width: 100%;
255
+ /*max-width: 580px;*/
256
+ height: 700px;
257
+ margin-left: -260px;
258
+ background: #ffffff;
259
+ border-radius: 3px;
260
+ z-index: 100000001;
261
+ box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25);
262
+ }
263
+ .wt_iew_import_progress_wrap.open {
264
+ display: flex;
265
+ flex-direction: column;
266
+ }
267
+ .wt_iew_import_progress_content{
268
+ height: 100%;
269
+ overflow-y: auto;
270
+ /*padding: 10px;*/
271
+ }
272
+ .wt_iew_import_progress_header{
273
+ padding: 15px;
274
+ top: 15px;
275
+ border-radius: 3px 3px 0 0;
276
+ }
277
+ .wt_iew_import_progress_wrap th, .wt_iew_import_progress_wrap td{text-align: center}
278
+ .wt_iew_import_progress{border: none !important;}
279
+
280
+
281
+
282
+
283
+
284
+ .wt_iew_import_progress table, .wt_iew_import_progress td {
285
+ border-collapse: collapse;
286
+ /*border: 1px solid #000;*/
287
+ }
288
+
289
+ .wt_iew_import_progress thead {
290
+ display: table; /* to take the same width as tr */
291
+ width: 100%;
292
+ }
293
+
294
+ .wt_iew_import_progress tbody {
295
+ display: block; /* to enable vertical scrolling */
296
+ max-height: 430px; /* e.g. */
297
+ overflow-y: scroll; /* keeps the scrollbar even if it doesn't need it; display purpose */
298
+ }
299
+
300
+ .wt_iew_import_progress th, .wt_iew_import_progress td {
301
+ /*width: 33.33%;*/
302
+ /* to enable "word-break: break-all" */
303
+ padding: 5px;
304
+ word-break: break-all; /* 4. */
305
+ }
306
+
307
+ .wt_iew_import_progress tr {
308
+ display: table; /* display purpose; th's border */
309
+ width: 100%;
310
+ box-sizing: border-box; /* because of the border (Chrome needs this line, but not FF) */
311
+ }
312
+
313
+ .wt_iew_import_progress td {
314
+ text-align: center;
315
+ border-bottom: none;
316
+ border-left: none;
317
+ }
318
+
319
+ progress {
320
+ height: 30px;
321
+ border-radius: 30px;
322
+ width:100%;
323
+ }
324
+ progress[value]::-webkit-progress-bar {
325
+ background-color: #EDEDED;
326
+ border-radius: 40px;
327
+ }
328
+ progress[value]::-moz-progress-bar {
329
+ background-color: #008000;
330
+ border-radius: 40px;
331
+ }
332
+ progress[value]::-webkit-progress-value {
333
+ border-radius: 40px;
334
+ background-color:#008000;
335
+ }
336
+
337
+ .wt-iew-import-result-row {
338
+ display: table;
339
+ width: 100%; /*Optional*/
340
+ table-layout: fixed; /*Optional*/
341
+ border-spacing: 10px; /*Optional*/
342
+ }
343
+ .wt-iew-import-result-column {
344
+ display: table-cell;
345
+ padding-bottom: 20px;
346
+ }
347
+ .wt-iew-import-completed .dashicons-yes:before{color: green;}
348
+
349
+ #wt_iew_import_progress .dashicons-dismiss:before {color: red;}
350
+ #wt_iew_import_progress .dashicons-yes-alt:before {color: green;}
351
+
352
+ .wt_iew_view_imported_items:focus, .wt_iew_view_imported_items:visited{
353
+ outline: none !important;
354
+ box-shadow: none !important;
355
+ }
356
+
357
+ .progressa {
358
+ border-radius: 50px !important;
359
+ line-height: 36px;
360
+ font-size: 14px;
361
+ overflow: hidden;
362
+ margin-bottom: 45px;
363
+ background-color: #dadada80;
364
+ border-radius: 4px;
365
+ -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
366
+ box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
367
+ line-height: 30px;
368
+ height: 40px;
369
+ font-size: 14px;
370
+ /*border: 3px solid transparent;*/
371
+ margin-left:25px;
372
+ width:95%;
373
+ }
374
+ .progressab {
375
+ /*background-image: -webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);
376
+ background-image: -o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);
377
+ */
378
+ -webkit-background-size: 40px 40px;
379
+ background-size: 40px 40px;
380
+ -webkit-transition: width .25s ease,height .25s ease,font-size .25s ease;
381
+ -moz-transition: width .25s ease,height .25s ease,font-size .25s ease;
382
+ -ms-transition: width .25s ease,height .25s ease,font-size .25s ease;
383
+ -o-transition: width .25s ease,height .25s ease,font-size .25s ease;
384
+ transition: width .25s ease,height .25s ease,font-size .25s ease;
385
+ width: 0;
386
+ color: #fff;
387
+ text-align: center;
388
+ font-family: 'Open Sans',sans-serif !important;
389
+ animation: progress-bar-stripes 2s linear infinite reverse;
390
+ }
391
+
392
+
393
+
394
+
395
+
396
  .wt_iew_popup_hd{display:inline-block; width:100%; box-sizing:border-box; font-weight:bold; background-color:#f3f3f3; height:40px; text-align:left; line-height:40px; padding:0px 20px;}
397
  .wt_iew_popup_close{float:right; width:40px; height:40px; text-align:right; line-height:40px; cursor:pointer;}
398
  .wt_iew_popup_footer{width:100%; text-align:right; margin-top:10px;}
admin/js/wt-import-export-for-woo-admin.js CHANGED
@@ -268,6 +268,15 @@ wt_iew_popup={
268
  popup_elm.find('.wt_iew_popup_body').css({'max-height':ph+'px','overflow':'auto'});
269
  jQuery('.wt_iew_overlay').show();
270
  },
 
 
 
 
 
 
 
 
 
271
  hidePopup:function()
272
  {
273
  jQuery('.wt_iew_popup_close').click();
@@ -280,7 +289,7 @@ wt_iew_popup={
280
  wt_iew_popup.hidePopup();
281
  }
282
  });
283
- jQuery('.wt_iew_popup_close, .wt_iew_popup_cancel').unbind('click').click(function(){
284
  jQuery('.wt_iew_overlay, .wt_iew_popup').hide();
285
  });
286
  }
268
  popup_elm.find('.wt_iew_popup_body').css({'max-height':ph+'px','overflow':'auto'});
269
  jQuery('.wt_iew_overlay').show();
270
  },
271
+ showimportPopup:function(popup_elm)
272
+ {
273
+ var pw=popup_elm.outerWidth();
274
+ var wh=jQuery(window).height();
275
+ var ph=wh-150;
276
+ popup_elm.css({'margin-left':((pw/2)*-1),'display':'block','top':'50px'});
277
+ popup_elm.find('.wt_iew_popup_body').css({'max-height':ph+'px','overflow':'auto'});
278
+ jQuery('.wt_iew_overlay').show();
279
+ },
280
  hidePopup:function()
281
  {
282
  jQuery('.wt_iew_popup_close').click();
289
  wt_iew_popup.hidePopup();
290
  }
291
  });
292
+ jQuery('.wt_iew_popup_close, .wt_iew_popup_cancel, .wt_iew_popup_close_btn').unbind('click').click(function(){
293
  jQuery('.wt_iew_overlay, .wt_iew_popup').hide();
294
  });
295
  }
admin/modules/export/assets/js/main.js CHANGED
@@ -5,7 +5,7 @@ var wt_iew_basic_export=(function( $ ) {
5
  ajax_data:{},
6
  selected_template:0,
7
  selected_template_name:'',
8
- to_export:'product',
9
  to_export_title:'',
10
  export_method:'',
11
  current_step:'',
@@ -631,6 +631,9 @@ var wt_iew_basic_export=(function( $ ) {
631
  if(this.to_export!="" && this.to_export_title=='')
632
  {
633
  $('[name="wt_iew_export_post_type"]').val(this.to_export);
 
 
 
634
  this.to_export_title=$('[name="wt_iew_export_post_type"] option:selected').text();
635
  }
636
  $('.wt_iew_step_head_post_type_name').html(this.to_export_title);
5
  ajax_data:{},
6
  selected_template:0,
7
  selected_template_name:'',
8
+ to_export:( wt_iew_export_basic_params.to_export !== '' ) ? wt_iew_export_basic_params.to_export : 'product',
9
  to_export_title:'',
10
  export_method:'',
11
  current_step:'',
631
  if(this.to_export!="" && this.to_export_title=='')
632
  {
633
  $('[name="wt_iew_export_post_type"]').val(this.to_export);
634
+ if(wt_iew_export_basic_params.to_export !== ''){
635
+ $('[name="wt_iew_export_post_type"]').trigger('change');
636
+ }
637
  this.to_export_title=$('[name="wt_iew_export_post_type"] option:selected').text();
638
  }
639
  $('.wt_iew_step_head_post_type_name').html(this.to_export_title);
admin/modules/export/export.php CHANGED
@@ -303,7 +303,7 @@ class Wt_Import_Export_For_Woo_Basic_Export
303
  'sele_vals'=>Wt_Iew_IE_Basic_Helper::_get_csv_delimiters(),
304
  'help_text'=>__( 'Separator for differentiating the columns in the CSV file. Assumes ‘,’ by default.' ),
305
  'validation_rule'=>array('type'=>'skip'),
306
- 'after_form_field'=>'<input type="text" class="wt_iew_custom_delimiter" name="wt_iew_delimiter" value="'.$delimiter_default.'" />',
307
  )
308
  );
309
 
@@ -378,7 +378,7 @@ class Wt_Import_Export_For_Woo_Basic_Export
378
  'item_type'=>'',
379
  'steps'=>$this->steps,
380
  'rerun_id'=>$this->rerun_id,
381
- 'to_export'=>$this->to_export,
382
  'export_method'=>$this->export_method,
383
  'msgs'=>array(
384
  'choosed_template'=>__('Choosed template: '),
303
  'sele_vals'=>Wt_Iew_IE_Basic_Helper::_get_csv_delimiters(),
304
  'help_text'=>__( 'Separator for differentiating the columns in the CSV file. Assumes ‘,’ by default.' ),
305
  'validation_rule'=>array('type'=>'skip'),
306
+ 'after_form_field'=>'<input type="text" class="wt_iew_custom_delimiter" name="wt_iew_delimiter" value="'.$delimiter_default.'" maxlength = "1" />',
307
  )
308
  );
309
 
378
  'item_type'=>'',
379
  'steps'=>$this->steps,
380
  'rerun_id'=>$this->rerun_id,
381
+ 'to_export'=> isset( $_GET['wt_to_export'] ) ? sanitize_text_field( $_GET['wt_to_export'] ) : $this->to_export,
382
  'export_method'=>$this->export_method,
383
  'msgs'=>array(
384
  'choosed_template'=>__('Choosed template: '),
admin/modules/history/assets/js/main.js CHANGED
@@ -11,21 +11,22 @@ var wt_iew_basic_history=(function( $ ) {
11
  },
12
  reg_view_log:function()
13
  {
14
- jQuery(document).on('click', ".wt_iew_view_log_btn", function(){
15
- wt_iew_basic_history.show_log_popup();
16
- var history_id=$(this).attr('data-history-id');
17
- if(history_id>0)
18
- {
19
- wt_iew_basic_history.log_offset=0;
20
- wt_iew_basic_history.load_page(history_id);
21
- }else
22
- {
23
- var log_file=$(this).attr('data-log-file');
24
- if(log_file!="")
25
- {
26
- wt_iew_basic_history.view_raw_log(log_file);
27
- }
28
- }
 
29
  });
30
  },
31
  view_raw_log:function(log_file)
11
  },
12
  reg_view_log:function()
13
  {
14
+ jQuery(document).on('click', ".wt_iew_view_log_btn", function(){
15
+ jQuery('.wt_iew_overlay, .wt_iew_popup').hide();
16
+ wt_iew_basic_history.show_log_popup();
17
+ var history_id=$(this).attr('data-history-id');
18
+ if(history_id>0)
19
+ {
20
+ wt_iew_basic_history.log_offset=0;
21
+ wt_iew_basic_history.load_page(history_id);
22
+ }else
23
+ {
24
+ var log_file=$(this).attr('data-log-file');
25
+ if(log_file!="")
26
+ {
27
+ wt_iew_basic_history.view_raw_log(log_file);
28
+ }
29
+ }
30
  });
31
  },
32
  view_raw_log:function(log_file)
admin/modules/import/assets/js/main.js CHANGED
@@ -20,8 +20,10 @@ var wt_iew_basic_import=(function( $ ) {
20
  local_import_file:'',
21
  url_import_file:'',
22
  on_rerun:false,
 
23
  rerun_id:0,
24
  import_delimiter:',',
 
25
  Set:function()
26
  {
27
  this.step_keys=Object.keys(wt_iew_import_basic_params.steps);
@@ -263,7 +265,7 @@ var wt_iew_basic_import=(function( $ ) {
263
  {
264
  wt_iew_basic_import.set_import_progress_info(wt_iew_import_basic_params.msgs.processing_file);
265
  }
266
- $.ajax({
267
  type: 'POST',
268
  url:wt_iew_basic_params.ajax_url,
269
  data:this.ajax_data,
@@ -284,31 +286,103 @@ var wt_iew_basic_import=(function( $ ) {
284
 
285
  }else if(action=='import')
286
  {
 
 
287
  if(data.finished==1)
288
  {
289
- wt_iew_basic_import.temp_import_file='';
290
- wt_iew_notify_msg.success(wt_iew_basic_params.msgs.success);
291
- wt_iew_basic_import.set_import_progress_info(data.msg);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  }
293
  else
294
  {
295
- wt_iew_basic_import.set_import_progress_info(data.msg);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  wt_iew_basic_import.ajax_data['offset']=data.new_offset;
297
  wt_iew_basic_import.ajax_data['import_id']=data.import_id;
298
  wt_iew_basic_import.ajax_data['total_records']=data.total_records;
299
  wt_iew_basic_import.ajax_data['offset_count']=data.offset_count;
300
-
301
  wt_iew_basic_import.ajax_data['total_success']=data.total_success;
302
  wt_iew_basic_import.ajax_data['total_failed']=data.total_failed;
303
  wt_iew_basic_import.do_nonstep_action(action);
304
  }
 
305
  }else if(action=='download')
306
- {
307
  wt_iew_basic_import.set_import_progress_info(data.msg);
308
  wt_iew_basic_import.ajax_data['import_id']=data.import_id;
309
  wt_iew_basic_import.ajax_data['total_records']=data.total_records;
310
  if(data.finished==3)/* finished file processing */
311
  {
 
 
 
 
 
 
 
 
 
 
312
  wt_iew_basic_import.ajax_data['offset']=0;
313
  wt_iew_basic_import.ajax_data['offset_count']=0;
314
  wt_iew_basic_import.ajax_data['import_action']='import';
@@ -374,6 +448,34 @@ var wt_iew_basic_import=(function( $ ) {
374
  }
375
  });
376
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  reg_button_actions:function()
378
  {
379
  $('.wt_iew_import_action_btn').unbind('click').click(function(e){
@@ -412,6 +514,19 @@ var wt_iew_basic_import=(function( $ ) {
412
  wt_iew_basic_import.nonstep_actions(action);
413
  }
414
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  },
416
  get_file_from:function()
417
  {
20
  local_import_file:'',
21
  url_import_file:'',
22
  on_rerun:false,
23
+ import_finished:false,
24
  rerun_id:0,
25
  import_delimiter:',',
26
+ import_start_time:0,
27
  Set:function()
28
  {
29
  this.step_keys=Object.keys(wt_iew_import_basic_params.steps);
265
  {
266
  wt_iew_basic_import.set_import_progress_info(wt_iew_import_basic_params.msgs.processing_file);
267
  }
268
+ wt_iew_basic_import.import_ajax_xhr = $.ajax({
269
  type: 'POST',
270
  url:wt_iew_basic_params.ajax_url,
271
  data:this.ajax_data,
286
 
287
  }else if(action=='import')
288
  {
289
+ {
290
+
291
  if(data.finished==1)
292
  {
293
+ wt_iew_basic_import.temp_import_file='';
294
+ let [firstKey] = Object.keys(data.log_data);
295
+ if(data.log_data[firstKey].post_link){
296
+
297
+ wt_iew_basic_import.show_import_popup();
298
+ $('.wt_iew_import_progress_wrap').addClass('open');
299
+
300
+ var newk = 0;
301
+ $.each(data.log_data, function (j) {
302
+ var status_icon = (data.log_data[j].status == true ) ? 'yes-alt' : 'dismiss';
303
+ var item_name = (data.log_data[j].post_link.edit_url) ? '<a href="'+data.log_data[j].post_link.edit_url+'" target="_blank">'+data.log_data[j].post_link.title+'</a>' : data.log_data[j].post_link.title;
304
+ $('#wt_iew_import_progress tbody').append( '<tr id="row-' + data.log_data[j].row + '" class="' + data.log_data[j].status + '"><td style="width:15%"><span class="result" title="' + data.log_data[j].row + '">' + data.log_data[j].row + '</span></td><td style="width:20%" class="row">' + item_name + '</td><td style="width:50%">' + data.log_data[j].message + '</td><td style="width:20%" class="reason"><span class="dashicons dashicons-'+status_icon+'"></span></td></tr>' );
305
+ newk = j;
306
+ });
307
+ //$('.wt-iew-importer-progress').val(data.total_percent);
308
+ var elm = document.getElementsByClassName('progressab')[0];
309
+ elm.style.width = 100+"%";
310
+ document.getElementById('row-' + ( newk )).scrollIntoView(false);
311
+ $('.progressa').hide();
312
+
313
+ $('#wt-iew-import-results-total-count').html((data.total_success + data.total_failed));
314
+ $('#wt-iew-import-results-imported-count').html(data.total_success);
315
+ $('#wt-iew-import-results-failed-count').html(data.total_failed);
316
+
317
+ $('.wt-iew-import-completed').show();
318
+ var time_taken = new Date().getTime() - wt_iew_basic_import.import_start_time;
319
+ time_taken = (time_taken/1000); // convert to seconds
320
+ $('#wt-iew-import-time-taken').html(wt_iew_basic_import.toHHMMSS(time_taken));
321
+ $('.wt-iew-import-time').show();
322
+ $('.wt_iew_view_log_btn').attr('data-log-file', data.log_file);
323
+ $('.wt_iew_view_log_btn').show();
324
+ $('.wt_iew_view_imported_items').attr('href', wt_iew_import_basic_params.addons[wt_iew_basic_import.to_import].page_link);
325
+ $('.wt_iew_view_imported_items').text(wt_iew_import_basic_params.addons[wt_iew_basic_import.to_import].text);
326
+ $('.wt_iew_view_imported_items').show();
327
+ $('.wt_iew_popup_close_btn').show();
328
+ $('.wt_iew_popup_cancel_btn').hide();
329
+ }else{
330
+ wt_iew_notify_msg.success(wt_iew_basic_params.msgs.success, false);
331
+ wt_iew_basic_import.set_import_progress_info(data.msg);
332
+ }
333
+ wt_iew_basic_import.import_finished = true;
334
  }
335
  else
336
  {
337
+ let [firstKey] = Object.keys(data.log_data);
338
+ if(data.log_data[firstKey].post_link){
339
+ wt_iew_basic_import.show_import_popup();
340
+ $('.wt_iew_import_progress_wrap').addClass('open');
341
+ var newk = 0;
342
+ $.each(data.log_data, function (j) {
343
+ var status_icon = (data.log_data[j].status == true ) ? 'yes-alt' : 'dismiss';
344
+ var item_name = (data.log_data[j].post_link.edit_url) ? '<a href="'+data.log_data[j].post_link.edit_url+'" target="_blank">'+data.log_data[j].post_link.title+'</a>' : data.log_data[j].post_link.title;
345
+ $('#wt_iew_import_progress tbody').append( '<tr id="row-' + data.log_data[j].row + '" class="' + data.log_data[j].status + '"><td style="width:15%"><span class="result" title="' + data.log_data[j].row + '">' + data.log_data[j].row + '</span></td><td style="width:20%" class="row">' + item_name + '</td><td style="width:50%">' + data.log_data[j].message + '</td><td style="width:20%" class="reason"><span class="dashicons dashicons-'+status_icon+'"></span></td></tr>' );
346
+ newk = j;
347
+ });
348
+
349
+ var progressval = data.total_percent;
350
+ var elm = document.getElementsByClassName('progressab')[0];
351
+ elm.style.width = progressval+"%";
352
+
353
+ elm.innerText = progressval+"%";
354
+ elm.style.backgroundColor = '#5FBA89';
355
+ //$('.wt-iew-importer-progress').val(data.total_percent);
356
+ document.getElementById('row-' + ( newk )).scrollIntoView({block: 'end', behavior: 'smooth'});
357
+ }else{
358
+ wt_iew_basic_import.set_import_progress_info(data.msg);
359
+ }
360
  wt_iew_basic_import.ajax_data['offset']=data.new_offset;
361
  wt_iew_basic_import.ajax_data['import_id']=data.import_id;
362
  wt_iew_basic_import.ajax_data['total_records']=data.total_records;
363
  wt_iew_basic_import.ajax_data['offset_count']=data.offset_count;
 
364
  wt_iew_basic_import.ajax_data['total_success']=data.total_success;
365
  wt_iew_basic_import.ajax_data['total_failed']=data.total_failed;
366
  wt_iew_basic_import.do_nonstep_action(action);
367
  }
368
+ }
369
  }else if(action=='download')
370
+ {
371
  wt_iew_basic_import.set_import_progress_info(data.msg);
372
  wt_iew_basic_import.ajax_data['import_id']=data.import_id;
373
  wt_iew_basic_import.ajax_data['total_records']=data.total_records;
374
  if(data.finished==3)/* finished file processing */
375
  {
376
+ wt_iew_basic_import.import_start_time = new Date().getTime();
377
+ $("#wt_iew_import_progress_tbody").empty();
378
+ //$('#import-start-area').hide();
379
+ $('.progressa').show();
380
+ $('.wt-iew-import-completed').hide();
381
+ $('.wt-iew-import-time').hide();
382
+ $('.wt_iew_popup_close_btn').hide();
383
+ $('.wt_iew_view_imported_items').hide();
384
+ $('.wt_iew_view_log_btn').hide();
385
+ $('.wt_iew_popup_cancel_btn').show();
386
  wt_iew_basic_import.ajax_data['offset']=0;
387
  wt_iew_basic_import.ajax_data['offset_count']=0;
388
  wt_iew_basic_import.ajax_data['import_action']='import';
448
  }
449
  });
450
  },
451
+ show_import_popup:function()
452
+ {
453
+ var pop_elm=$('.wt_iew_import_progress_wrap');
454
+ var ww=$(window).width();
455
+ pop_w=(ww<1300 ? ww : 1300)-200;
456
+ pop_w=(pop_w<200 ? 200 : pop_w);
457
+ pop_elm.width(pop_w);
458
+
459
+ wh=$(window).height();
460
+ pop_h=(wh>=400 ? (wh-200) : wh);
461
+ $('.wt_iew_import_progress').css({'max-height':pop_h+'px','overflow':'auto'});
462
+ wt_iew_popup.showimportPopup(pop_elm);
463
+ pop_elm.css({'display':'flex'});
464
+ },
465
+ toHHMMSS:function(sec_taken){
466
+ var sec_num = parseInt(sec_taken, 10); // don't forget the second param
467
+ var hours = Math.floor(sec_num / 3600);
468
+ var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
469
+ var seconds = sec_num - (hours * 3600) - (minutes * 60);
470
+ if(seconds === 0){
471
+ seconds = 1;
472
+ }
473
+
474
+ if (hours < 10) {hours = "0"+hours;}
475
+ if (minutes < 10) {minutes = "0"+minutes;}
476
+ if (seconds < 10) {seconds = "0"+seconds;}
477
+ return hours + ':' + minutes + ':' + seconds;
478
+ },
479
  reg_button_actions:function()
480
  {
481
  $('.wt_iew_import_action_btn').unbind('click').click(function(e){
514
  wt_iew_basic_import.nonstep_actions(action);
515
  }
516
  });
517
+ $('.wt_iew_popup_cancel_btn').unbind('click').click(function(e){
518
+ if ( confirm( "Are you sure to stop the import?" ) == true ) {
519
+ var temp_err_message = wt_iew_basic_params.msgs.error;
520
+ wt_iew_basic_params.msgs.error = 'Import cancelled';
521
+ wt_iew_basic_import.import_ajax_xhr.abort();
522
+ wt_iew_basic_params.msgs.error = temp_err_message;
523
+ var progressval = 1;
524
+ var elm = document.getElementsByClassName('progressab')[0];
525
+ elm.style.width = progressval+"%";
526
+ elm.innerText = progressval+"%";
527
+ jQuery('.wt_iew_overlay, .wt_iew_popup').hide();
528
+ }
529
+ });
530
  },
531
  get_file_from:function()
532
  {
admin/modules/import/import.php CHANGED
@@ -405,6 +405,40 @@ class Wt_Import_Export_For_Woo_Basic_Import
405
  'upload_done'=>sprintf(__('%s Done.'), '<span class="dashicons dashicons-yes-alt" style="color:#3fa847;"></span>'),
406
  'remove'=>__('Remove'),
407
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
  );
409
  wp_localize_script($this->module_id, 'wt_iew_import_basic_params', $params);
410
 
@@ -940,6 +974,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
940
  /* checking action is finshed */
941
  $is_last_offset=false;
942
  $new_offset=$input_data['offset']; //increase the offset
 
943
  if($new_offset>=$total_records) //finished
944
  {
945
  $is_last_offset=true;
@@ -970,7 +1005,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
970
  );
971
 
972
  $import_response=apply_filters('wt_iew_importer_do_import_basic', $input_data['data_arr'], $to_process, $step, $form_data, $this->selected_template_data, $this->import_method, $offset_count, $is_last_offset);
973
-
974
  /**
975
  * Writing import log to file
976
  */
@@ -1016,6 +1051,14 @@ class Wt_Import_Export_For_Woo_Basic_Import
1016
  $log_summary_msg=$this->generate_log_summary($out, $is_last_offset);
1017
 
1018
  $out['finished']=1; //finished
 
 
 
 
 
 
 
 
1019
  $out['msg']=$log_summary_msg;
1020
 
1021
  /* updating finished status */
405
  'upload_done'=>sprintf(__('%s Done.'), '<span class="dashicons dashicons-yes-alt" style="color:#3fa847;"></span>'),
406
  'remove'=>__('Remove'),
407
  ),
408
+ 'addons' => array(
409
+ 'product' => array(
410
+ 'text' => __( 'View Products' ),
411
+ 'page_link' => admin_url('edit.php?post_type=product')
412
+ ),
413
+ 'product_categories' => array(
414
+ 'text' => __( 'View Product categories' ),
415
+ 'page_link' => admin_url('edit-tags.php?taxonomy=product_cat&post_type=product')
416
+ ),
417
+ 'product_tags' => array(
418
+ 'text' => __( 'View Product tags' ),
419
+ 'page_link' => admin_url('edit-tags.php?taxonomy=product_tag&post_type=product')
420
+ ),
421
+ 'product_review' => array(
422
+ 'text' => __( 'View Product reviews' ),
423
+ 'page_link' => admin_url('edit-comments.php')
424
+ ),
425
+ 'order' => array(
426
+ 'text' => __( 'View Orders' ),
427
+ 'page_link' => admin_url('edit.php?post_type=shop_order')
428
+ ),
429
+ 'coupon' => array(
430
+ 'text' => __( 'View Coupons' ),
431
+ 'page_link' => admin_url('edit.php?post_type=shop_coupon')
432
+ ),
433
+ 'user' => array(
434
+ 'text' => __( 'View Users' ),
435
+ 'page_link' => admin_url('users.php')
436
+ ),
437
+ 'subscription' => array(
438
+ 'text' => __( 'View Subscriptions' ),
439
+ 'page_link' => admin_url('edit.php?post_type=shop_subscription')
440
+ )
441
+ )
442
  );
443
  wp_localize_script($this->module_id, 'wt_iew_import_basic_params', $params);
444
 
974
  /* checking action is finshed */
975
  $is_last_offset=false;
976
  $new_offset=$input_data['offset']; //increase the offset
977
+ $out['total_percent']= ceil(($new_offset/$total_records)*100);
978
  if($new_offset>=$total_records) //finished
979
  {
980
  $is_last_offset=true;
1005
  );
1006
 
1007
  $import_response=apply_filters('wt_iew_importer_do_import_basic', $input_data['data_arr'], $to_process, $step, $form_data, $this->selected_template_data, $this->import_method, $offset_count, $is_last_offset);
1008
+ $out['log_data'] = $import_response['log_data'];
1009
  /**
1010
  * Writing import log to file
1011
  */
1051
  $log_summary_msg=$this->generate_log_summary($out, $is_last_offset);
1052
 
1053
  $out['finished']=1; //finished
1054
+ $log_file_name = '';
1055
+ $log_path=Wt_Import_Export_For_Woo_Basic_Log::$log_dir;
1056
+ $log_files = glob($log_path.'/'.$out['history_id'].'_*'.'.log');
1057
+ if(is_array($log_files) && count($log_files)>0)
1058
+ {
1059
+ $log_file_name=basename($log_files[0]);
1060
+ }
1061
+ $out['log_file'] = $log_file_name;
1062
  $out['msg']=$log_summary_msg;
1063
 
1064
  /* updating finished status */
admin/modules/import/views/main.php CHANGED
@@ -31,6 +31,60 @@ select[name=wt_iew_file_from]{visibility: hidden;}
31
 
32
  </div>
33
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  <?php
35
  Wt_Iew_IE_Basic_Helper::debug_panel($this->module_base);
36
  ?>
31
 
32
  </div>
33
  </div>
34
+
35
+ <div class="wt_iew_import_progress_wrap wt_iew_popup">
36
+ <div class="wt_iew_popup_hd wt_iew_import_progress_header">
37
+ <span style="line-height:40px;" class="dashicons dashicons-media-text"></span>
38
+ <span class="wt_iew_popup_hd_label"><?php _e('Import progress');?></span>
39
+ <div class="wt_iew_popup_close">X</div>
40
+ </div>
41
+ <div class="wt_iew_import_progress_content" style="max-height:620px;overflow: auto;">
42
+ <table id="wt_iew_import_progress" class="widefat_importer widefat wt_iew_import_progress wp-list-table fixed striped history_list_tb log_list_tb">
43
+ <thead>
44
+ <tr>
45
+ <th style="width:15%" class="row"><?php _e( 'Row' ); ?></th>
46
+ <th style="width:20%"><?php _e( 'Item' ); ?></th>
47
+ <th style="width:50%"><?php _e( 'Message' ); ?></th>
48
+ <th style="width:20%" class="reason"><?php _e( 'Status' ); ?></th>
49
+ </tr>
50
+ </thead>
51
+ <tbody id="wt_iew_import_progress_tbody"></tbody>
52
+ </table>
53
+ </div>
54
+ <br/>
55
+ <div id="wt_iew_import_progress_end"></div>
56
+ <div class="progressa">
57
+ <div class="progressab" style="background-color: rgb(178, 222, 75);width:5px; "></div>
58
+ </div>
59
+
60
+ <div class="wt-iew-import-completed" style="display:none;border-top: 1px outset;">
61
+ <h3><?php _e('Import Completed'); ?><span style="color:green" class="dashicons dashicons-yes-alt"></span></h3>
62
+ <div class="wt-iew-import-results">
63
+ <div class="wt-iew-import-result-row">
64
+ <div class="wt-iew-import-results-total wt-iew-import-result-column"><?php _e('Total records identified'); ?>:<span id="wt-iew-import-results-total-count"></span></div>
65
+ <div style="color:green" class="wt-iew-import-results-imported wt-iew-import-result-column"><?php _e('Imported successfully'); ?>:<span id="wt-iew-import-results-imported-count"></span></div>
66
+ <div style="color:red" class="wt-iew-import-results-failed wt-iew-import-result-column"><?php _e('Failed/Skipped'); ?>:<span id="wt-iew-import-results-failed-count"></span></div>
67
+ </div>
68
+ </div>
69
+ </div>
70
+
71
+
72
+ <div class="wt-iew-plugin-toolbar bottom" style="padding:5px;margin-left:-10px;">
73
+ <div style="float: left">
74
+ <div class="wt-iew-import-time" style="display:none;padding-left: 40px;margin-top:10px;" ><?php _e( 'Time taken to complete' );?>:<span id="wt-iew-import-time-taken"></span></div>
75
+ </div>
76
+ <div style="float:right;">
77
+ <div style="float:right;">
78
+ <a target="_blank" href="#" class="button button-primary wt_iew_view_imported_items" data-log-file="" style="display:none" type="button" style="margin-right:10px;"><?php _e( 'View Item' );?></a>
79
+ <button class="button button-primary wt_iew_view_log_btn" data-log-file="" style="display:none" type="button" style="margin-right:10px;"><?php _e( 'View Log' );?></button>
80
+ <button class="button button-primary wt_iew_popup_cancel_btn" type="button" style="margin-right:10px;"><?php _e( 'Cancel' );?></button>
81
+ <button class="button button-primary wt_iew_popup_close_btn" style="display:none" type="button" style="margin-right:10px;"><?php _e( 'Close' );?></button>
82
+ </div>
83
+ </div>
84
+ </div>
85
+ </div>
86
+
87
+
88
  <?php
89
  Wt_Iew_IE_Basic_Helper::debug_panel($this->module_base);
90
  ?>
admin/modules/product/export/class-wt-prodimpexpcsv-basic-exporter.php ADDED
@@ -0,0 +1,722 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('WPINC')) {
4
+ exit;
5
+ }
6
+
7
+ class Wt_Import_Export_For_Woo_Basic_Product_Bulk_Export {
8
+
9
+ /**
10
+ * Product Exporter
11
+ */
12
+ public static function do_export($post_type = 'product', $prod_ids = array()) {
13
+
14
+ global $wpdb;
15
+
16
+ $delimiter = !empty($_POST['delimiter']) ? $_POST['delimiter'] : ','; // WPCS: CSRF ok, input var ok.
17
+
18
+ $csv_columns = include_once( __DIR__ . '/../data/data-product-post-columns.php' );
19
+ $csv_columns = array_combine(array_keys($csv_columns), array_keys($csv_columns));
20
+ $standard_meta_columns = array_keys(array_slice($csv_columns, 12));
21
+ $csv_columns = self::wt_iew_get_product_columns($csv_columns);
22
+ $user_columns_name = !empty($_POST['columns_name']) ? wc_clean($_POST['columns_name']) : $csv_columns;
23
+ $export_columns = !empty($_POST['columns']) ? wc_clean($_POST['columns']) : array();
24
+
25
+
26
+ $product_taxonomies = self::wt_get_product_ptaxonomies();
27
+
28
+ $include_hidden_meta = apply_filters('wt_iew_product_bulk_export_include_hidden_meta', true);
29
+ $export_children_sku = true;
30
+ $export_shortcodes = true;
31
+ $export_images_zip = false;
32
+
33
+ $wpdb->hide_errors();
34
+ @set_time_limit(0);
35
+ if (function_exists('apache_setenv'))
36
+ @apache_setenv('no-gzip', 1);
37
+
38
+ @ini_set('zlib.output_compression', 0);
39
+ @ob_end_clean(); // to prevent issue that unidentified characters when opened in MS-Excel in some servers
40
+
41
+
42
+
43
+ $file_name = apply_filters('wt_iew_product_bulk_export_product_filename', 'product_export_' . date('Y-m-d-h-i-s') . '.csv');
44
+ header('Content-Type: text/csv; charset=UTF-8');
45
+ header('Content-Disposition: attachment; filename=' . $file_name);
46
+ header('Pragma: no-cache');
47
+ header('Expires: 0');
48
+
49
+ $fp = fopen('php://output', 'w');
50
+
51
+
52
+
53
+ $found_pattributes = self::get_all_product_attributes('product');
54
+ $found_attributes = array_unique($found_pattributes);
55
+
56
+ $found_attributes = apply_filters('wt_iew_product_bulk_export_attribute_data', $found_attributes);
57
+
58
+ // Variable to hold the CSV data we're exporting
59
+ $row = array();
60
+
61
+ // Export header rows
62
+ foreach ($csv_columns as $column => $value) {
63
+
64
+ if (!isset($user_columns_name[$column])) {
65
+
66
+ continue;
67
+ }
68
+ if (!$export_columns || in_array($value, $export_columns) || in_array($column, $export_columns)) {
69
+
70
+ if ('meta' == $column) {
71
+ // foreach ($found_product_meta as $product_meta) {
72
+ // $row[] = 'meta:' . self::format_data($product_meta);
73
+ // }
74
+ continue;
75
+ }
76
+
77
+ if ('attributes' == $column) {
78
+ foreach ($found_attributes as $attribute) {
79
+ $row[] = 'attribute:' . self::format_data($attribute);
80
+ $row[] = 'attribute_data:' . self::format_data($attribute);
81
+ $row[] = 'attribute_default:' . self::format_data($attribute);
82
+ }
83
+ continue;
84
+ }
85
+
86
+ $temp_head = esc_attr($user_columns_name[$column]);
87
+ if (strpos($temp_head, 'yoast') === false) {
88
+ $temp_head = ltrim($temp_head, '_');
89
+ }
90
+
91
+ $row[] = $temp_head;
92
+ }
93
+ }
94
+
95
+ $row = apply_filters('wt_iew_alter_product_bulk_export_csv_columns', $row);
96
+ $row = array_map('Wt_Import_Export_For_Woo_Basic_Product_Bulk_Export::wrap_column', $row);
97
+
98
+ fwrite($fp, implode($delimiter, $row) . "\n");
99
+ $header_row = $row;
100
+ unset($row);
101
+
102
+ $csv_columns = self::wt_array_walk($csv_columns, 'meta:'); // Remove string 'meta:' from keys and values, YOAST support
103
+ $export_columns = self::wt_array_walk($export_columns, 'meta:'); // Remove string 'meta:' from keys and values, YOAST support
104
+
105
+
106
+ ini_set('max_execution_time', -1);
107
+ ini_set('memory_limit', -1);
108
+
109
+
110
+ $args = array(
111
+ 'type' => array( 'external', 'grouped', 'simple'),
112
+ 'include' => $prod_ids,
113
+ 'return' => 'ids',
114
+ 'limit' => 999
115
+ );
116
+ $products = wc_get_products( $args );
117
+ $posts_in = array();
118
+ foreach ($products as $value) {
119
+ array_push($posts_in, $value);
120
+ }
121
+
122
+ $product_args = $result_products = array();
123
+ if ($products) {
124
+ $product_args['post__in'] = array_values($posts_in);
125
+ $product_args['post_type'] = 'product';
126
+ $product_args['numberposts'] = 999;
127
+
128
+
129
+
130
+ $product_args = apply_filters('wt_iew_product_bulk_export_args', $product_args);
131
+ $result_products = get_posts($product_args);
132
+ }
133
+
134
+ // Loop products
135
+ foreach ($result_products as $product) {
136
+ if ($product->post_parent == 0)
137
+ $product->post_parent = '';
138
+ $row = array();
139
+
140
+ // Pre-process data
141
+ $meta_data = get_post_custom($product->ID);
142
+
143
+ $product->meta = new stdClass;
144
+ $product->attributes = new stdClass;
145
+ // Meta data
146
+
147
+ foreach ($meta_data as $meta => $value) {
148
+
149
+ if (!$meta) {
150
+ continue;
151
+ }
152
+
153
+ if (!$include_hidden_meta && !in_array($meta, array_keys($csv_columns)) ) { //skipping _wc_
154
+ continue;
155
+ }
156
+
157
+ $meta_value = maybe_unserialize(maybe_unserialize($value[0]));
158
+
159
+ if (is_array($meta_value)) {
160
+ $meta_value = json_encode($meta_value);
161
+ }
162
+
163
+ if (strstr($meta, 'attribute_pa_')) {
164
+ if ($meta_value) {
165
+ $get_name_by_slug = get_term_by('slug', $meta_value, str_replace('attribute_', '', $meta));
166
+ if ($get_name_by_slug) {
167
+ $product->meta->$meta = self::format_export_meta($get_name_by_slug->name, $meta);
168
+ } else {
169
+ $product->meta->$meta = self::format_export_meta($meta_value, $meta);
170
+ }
171
+ } else {
172
+ $product->meta->$meta = self::format_export_meta($meta_value, $meta);
173
+ }
174
+ } else {
175
+ $formatted_mdata = self::format_export_meta($meta_value, $meta );
176
+ $clean_meta_key = ltrim($meta, '_');
177
+ if(in_array($clean_meta_key, $standard_meta_columns)){
178
+ $meta = $clean_meta_key;
179
+ }
180
+ $product->meta->$meta = $formatted_mdata;
181
+ }
182
+ }
183
+
184
+ // Product attributes
185
+ if (isset($meta_data['_product_attributes'][0])) {
186
+
187
+ $attributes = maybe_unserialize(maybe_unserialize($meta_data['_product_attributes'][0]));
188
+ if (!empty($attributes) && is_array($attributes)) {
189
+ foreach ($attributes as $key => $attribute) {
190
+ if (!$key) {
191
+ continue;
192
+ }
193
+ if ($attribute['is_taxonomy'] == 1) {
194
+ $terms = wp_get_post_terms($product->ID, $attribute['name'], array("fields" => "names"));
195
+ if (!is_wp_error($terms)) {
196
+ $attribute_value = implode('|', $terms);
197
+ } else {
198
+ $attribute_value = '';
199
+ }
200
+ } else {
201
+ if (empty($attribute['name'])) {
202
+ continue;
203
+ }
204
+ $key = $attribute['name'];
205
+ $attribute_value = $attribute['value'];
206
+ }
207
+
208
+ if (!isset($attribute['position'])) {
209
+ $attribute['position'] = 0;
210
+ }
211
+ if (!isset($attribute['is_visible'])) {
212
+ $attribute['is_visible'] = 0;
213
+ }
214
+ if (!isset($attribute['is_variation'])) {
215
+ $attribute['is_variation'] = 0;
216
+ }
217
+
218
+ $attribute_data = $attribute['position'] . '|' . $attribute['is_visible'] . '|' . $attribute['is_variation'];
219
+ $_default_attributes = isset($meta_data['_default_attributes'][0]) ? maybe_unserialize(maybe_unserialize($meta_data['_default_attributes'][0])) : '';
220
+
221
+ if (is_array($_default_attributes)) {
222
+ // $_default_attribute = isset($_default_attributes[$key]) ? $_default_attributes[$key] : '';
223
+ $_default_attribute = isset($_default_attributes[strtolower($key)]) ? $_default_attributes[strtolower($key)] : ''; // default_attribute key always in lowercase
224
+ } else {
225
+ $_default_attribute = '';
226
+ }
227
+
228
+ $product->attributes->$key = array(
229
+ 'value' => $attribute_value,
230
+ 'data' => $attribute_data,
231
+ 'default' => $_default_attribute
232
+ );
233
+ }
234
+ }
235
+ }
236
+
237
+ foreach ($csv_columns as $column => $value) {
238
+ if (!$export_columns || in_array($value, $export_columns) || in_array($column, $export_columns)) {
239
+ if ('regular_price' == $column && empty($product->meta->$column)) {
240
+ $column = '_price';
241
+ }
242
+ if (!self::wt_iew_is_woocommerce_prior_to('2.7')) {
243
+ if ('visibility' == $column) {
244
+ $product_terms = get_the_terms($product->ID, 'product_visibility');
245
+ if (!empty($product_terms)) {
246
+ if (!is_wp_error($product_terms)) {
247
+ $term_slug = '';
248
+ foreach ($product_terms as $i => $term) {
249
+ $term_slug .= $term->slug . (isset($product_terms[$i + 1]) ? '|' : '');
250
+ }
251
+ $row[] = $term_slug;
252
+ }
253
+ } else {
254
+ $row[] = '';
255
+ }
256
+ continue;
257
+ }
258
+ }
259
+
260
+ if ('parent' == $column) {
261
+ if ($product->post_parent) {
262
+ $post_parent_title = get_the_title($product->post_parent);
263
+ if ($post_parent_title) {
264
+ $row[] = self::format_data($post_parent_title);
265
+ } else {
266
+ $row[] = '';
267
+ }
268
+ } else {
269
+ $row[] = '';
270
+ }
271
+ continue;
272
+ }
273
+
274
+ if ('parent_sku' == $column) {
275
+ if ($product->post_parent) {
276
+ $row[] = get_post_meta($product->post_parent, '_sku', true);
277
+ } else {
278
+ $row[] = '';
279
+ }
280
+ continue;
281
+ }
282
+
283
+ // Export images/gallery
284
+ if ('images' == $column) {
285
+
286
+ $export_image_metadata = apply_filters('wt_iew_product_bulk_export_image_metadata', TRUE); //filter for disable export image meta datas such as alt,title,content,caption...
287
+ $image_file_names = array();
288
+
289
+ // Featured image
290
+ if (( $featured_image_id = get_post_thumbnail_id($product->ID))) {
291
+ $image_object = get_post($featured_image_id);
292
+ $img_url = wp_get_attachment_image_src($featured_image_id, 'full');
293
+
294
+ $image_meta = '';
295
+ if ($image_object && $export_image_metadata) {
296
+ $image_metadata = get_post_meta($featured_image_id);
297
+ $image_meta = " ! alt : " . ( isset($image_metadata['_wp_attachment_image_alt'][0]) ? $image_metadata['_wp_attachment_image_alt'][0] : '' ) . " ! title : " . $image_object->post_title . " ! desc : " . $image_object->post_content . " ! caption : " . $image_object->post_excerpt;
298
+ }
299
+ if ($image_object && $image_object->guid) {
300
+ $temp_images_export_to_csv = ($export_images_zip ? basename($img_url[0]) : $img_url[0]) . ($export_image_metadata ? $image_meta : '');
301
+ }
302
+ if (!empty($temp_images_export_to_csv)) {
303
+ $image_file_names[] = $temp_images_export_to_csv;
304
+ }
305
+ }
306
+
307
+ // Images
308
+ $images = isset($meta_data['_product_image_gallery'][0]) ? explode(',', maybe_unserialize(maybe_unserialize($meta_data['_product_image_gallery'][0]))) : false;
309
+ $results = array();
310
+ if ($images) {
311
+ foreach ($images as $image_id) {
312
+ if ($featured_image_id == $image_id) {
313
+ continue;
314
+ }
315
+ $temp_gallery_images_export_to_csv = '';
316
+ $gallery_image_meta = '';
317
+ $gallery_image_object = get_post($image_id);
318
+ $gallery_img_url = wp_get_attachment_image_src($image_id, 'full');
319
+
320
+ if ($gallery_image_object && $export_image_metadata) {
321
+ $gallery_image_metadata = get_post_meta($image_id);
322
+ $gallery_image_meta = " ! alt : " . ( isset($gallery_image_metadata['_wp_attachment_image_alt'][0]) ? $gallery_image_metadata['_wp_attachment_image_alt'][0] : '' ) . " ! title : " . $gallery_image_object->post_title . " ! desc : " . $gallery_image_object->post_content . " ! caption : " . $gallery_image_object->post_excerpt;
323
+ }
324
+ if ($gallery_image_object && $gallery_image_object->guid) {
325
+ $temp_gallery_images_export_to_csv = ($export_images_zip ? basename($gallery_img_url[0]) : $gallery_img_url[0]) . ($export_image_metadata ? $gallery_image_meta : '');
326
+ }
327
+ if (!empty($temp_gallery_images_export_to_csv)) {
328
+ $image_file_names[] = $temp_gallery_images_export_to_csv;
329
+ }
330
+ }
331
+ }
332
+
333
+
334
+ if (!empty($image_file_names)) {
335
+ $row[] = implode(' | ', $image_file_names);
336
+ } else {
337
+ $row[] = '';
338
+ }
339
+ continue;
340
+ }
341
+
342
+
343
+ // Downloadable files
344
+ if ('file_paths' == $column || 'downloadable_files' == $column) {
345
+ $file_paths_to_export = array();
346
+ if (!function_exists('wc_get_filename_from_url')) {
347
+ $file_paths = maybe_unserialize(maybe_unserialize($meta_data['_file_paths'][0]));
348
+
349
+ if ($file_paths) {
350
+ foreach ($file_paths as $file_path) {
351
+ $file_paths_to_export[] = $file_path;
352
+ }
353
+ }
354
+
355
+ $file_paths_to_export = implode(' | ', $file_paths_to_export);
356
+ $row[] = self::format_data($file_paths_to_export);
357
+ } elseif (isset($meta_data['_downloadable_files'][0])) {
358
+ $file_paths = maybe_unserialize(maybe_unserialize($meta_data['_downloadable_files'][0]));
359
+
360
+ if (is_array($file_paths) || is_object($file_paths)) {
361
+ foreach ($file_paths as $file_path) {
362
+ $file_paths_to_export[] = (!empty($file_path['name']) ? $file_path['name'] : self::wt_iew_get_filename_from_url($file_path['file']) ) . '::' . $file_path['file'];
363
+ }
364
+ }
365
+ $file_paths_to_export = implode(' | ', $file_paths_to_export);
366
+ }
367
+ if (!empty($file_paths_to_export)) {
368
+ $row[] = !empty($file_paths_to_export) ? self::format_data($file_paths_to_export) : '';
369
+ } else {
370
+ $row[] = '';
371
+ }
372
+ continue;
373
+ }
374
+
375
+
376
+ // Export taxonomies
377
+ // if ( 'taxonomies' == $column ) {
378
+ if (substr($column, 0, 4) === 'tax:') {
379
+
380
+ foreach ($product_taxonomies as $taxonomy) {
381
+
382
+ if (strstr($taxonomy->name, 'pa_'))
383
+ continue; // Skip attributes
384
+
385
+ if ('tax:' . $taxonomy->name != $column)
386
+ continue;
387
+
388
+ if (is_taxonomy_hierarchical($taxonomy->name)) {
389
+ $terms = wp_get_post_terms($product->ID, $taxonomy->name, array("fields" => "all"));
390
+
391
+ $formatted_terms = array();
392
+
393
+ foreach ($terms as $term) {
394
+ $ancestors = array_reverse(get_ancestors($term->term_id, $taxonomy->name));
395
+ $formatted_term = array();
396
+
397
+ foreach ($ancestors as $ancestor)
398
+ $formatted_term[] = get_term($ancestor, $taxonomy->name)->name;
399
+
400
+ $formatted_term[] = $term->name;
401
+
402
+ $formatted_terms[] = implode(' > ', $formatted_term);
403
+ }
404
+
405
+ $row[] = self::format_data(implode('|', $formatted_terms));
406
+ } else {
407
+ $terms = wp_get_post_terms($product->ID, $taxonomy->name, array("fields" => "names"));
408
+
409
+ $row[] = self::format_data(implode('|', $terms));
410
+ }
411
+ }
412
+ continue;
413
+ }
414
+
415
+ // Export meta data
416
+
417
+ if ('meta' == $column) {
418
+
419
+ continue;
420
+ }
421
+
422
+ // Find and export attributes
423
+ if ('attributes' == $column) {
424
+ foreach ($found_attributes as $attribute) {
425
+ if (isset($product->attributes) && isset($product->attributes->$attribute)) {
426
+ $values = $product->attributes->$attribute;
427
+ $row[] = self::format_data($values['value']);
428
+ $row[] = self::format_data($values['data']);
429
+ $row[] = self::format_data($values['default']);
430
+ } else {
431
+ $row[] = '';
432
+ $row[] = '';
433
+ $row[] = '';
434
+ }
435
+ }
436
+ continue;
437
+ }
438
+
439
+
440
+
441
+ // WF: Adding product permalink.
442
+ if ('product_page_url' == $column) {
443
+ $product_page_url = '';
444
+ if (!empty($product->ID)) {
445
+ $product_page_url = get_permalink($product->ID);
446
+ }
447
+ if (!empty($product->post_parent)) {
448
+ $product_page_url = get_permalink($product->post_parent);
449
+ }
450
+ $row[] = !empty($product_page_url) ? $product_page_url : '';
451
+ continue;
452
+ }
453
+
454
+ /**
455
+ * WPML
456
+ */
457
+ if (apply_filters('wpml_setting', false, 'setup_complete')) {
458
+ if (in_array($column, array('wpml:language_code', 'wpml:original_product_id', 'wpml:original_product_sku'))) {
459
+ if ('wpml:language_code' == $column) {
460
+ $original_post_language_info = self::wt_iew_get_wpml_original_post_language_info($product->ID);
461
+ $row[] = (isset($original_post_language_info->language_code) && !empty($original_post_language_info->language_code) ? $original_post_language_info->language_code : '');
462
+ continue;
463
+ }
464
+
465
+ /*
466
+ * To get the ID of the original product post
467
+ * https://wpml.org/forums/topic/translated-product-get-id-of-original-lang-for-custom-fields/
468
+ */
469
+
470
+ global $sitepress;
471
+ $original_product_id = icl_object_id($product->ID, 'product', false, $sitepress->get_default_language());
472
+ if ('wpml:original_product_id' == $column) {
473
+ $row[] = ($original_product_id ? $original_product_id : '');
474
+ continue;
475
+ }
476
+ if ('wpml:original_product_sku' == $column) {
477
+ $sku = get_post_meta($original_product_id, '_sku', true);
478
+ $row[] = ($sku ? $sku : '');
479
+ continue;
480
+ }
481
+ }
482
+ }
483
+
484
+
485
+ if (isset($product->meta->$column)) {
486
+ if ('children' == $column) {
487
+ if ($export_children_sku) {
488
+ $children_sku = '';
489
+ $children_id_array = str_replace('"', '', explode(',', trim($product->meta->$column, '[' . ']')));
490
+ if (!empty($children_id_array) && $children_id_array[0] != '""') {
491
+ foreach ($children_id_array as $children_id_array_key => $children_id) {
492
+ $children_sku = !empty($children_sku) ? "{$children_sku}|" . get_post_meta($children_id, '_sku', TRUE) : get_post_meta($children_id, '_sku', TRUE);
493
+ }
494
+ }
495
+ $row[] = !empty($children_sku) ? $children_sku : '';
496
+ } else {
497
+ $row[] = str_replace('"', '', implode('|', explode(',', trim($product->meta->$column, '[' . ']'))));
498
+ }
499
+ } elseif ('stock_status' == $column) {
500
+ $stock_status = self::format_data($product->meta->$column);
501
+ $term_product_type = wp_get_post_terms($product->ID, 'product_type', array('fields' => 'slugs'));
502
+ if (!is_wp_error($term_product_type) && isset($term_product_type[0])) {
503
+ $product_type = $term_product_type[0];
504
+ } else {
505
+ $product_type = '';
506
+ }
507
+ $row[] = !empty($stock_status) ? $stock_status : ( ( 'variable' == $product_type || 'variable-subscription' == $product_type ) ? '' : 'instock' );
508
+ } elseif ('sku' == $column) {//PIEPFW-528 url decode replace + with space
509
+ $row[] = $product->meta->$column;
510
+ } else {
511
+ $row[] = self::format_data($product->meta->$column);
512
+ }
513
+ } elseif (isset($product->$column) && !is_array($product->$column)) {
514
+ if ($export_shortcodes && ( 'post_content' == $column || 'post_excerpt' == $column )) {
515
+ //Convert Shortcodes to html for Description and Short Description
516
+ $row[] = do_shortcode($product->$column);
517
+ } elseif ('post_title' === $column) {
518
+ $row[] = sanitize_text_field($product->$column);
519
+ } else {
520
+ $row[] = self::format_data($product->$column);
521
+ }
522
+ } else {
523
+ $row[] = '';
524
+ }
525
+ }
526
+ }
527
+
528
+ $row = apply_filters('wt_iew_product_bulk_export_csv_data', $row, $product->ID, $header_row);
529
+ if (empty($row)) {//remove empty row export
530
+ continue;
531
+ }
532
+
533
+ // Add to csv
534
+ $row = array_map('Wt_Import_Export_For_Woo_Basic_Product_Bulk_Export::wrap_column', $row);
535
+
536
+ fwrite($fp, implode($delimiter, $row) . "\n");
537
+ unset($row);
538
+ }
539
+
540
+
541
+
542
+
543
+ fclose($fp);
544
+ exit;
545
+ }
546
+
547
+ public static function wt_get_product_ptaxonomies() {
548
+ $product_ptaxonomies = get_object_taxonomies('product', 'name');
549
+ $product_vtaxonomies = get_object_taxonomies('product_variation', 'name');
550
+ $product_taxonomies = array_merge($product_ptaxonomies, $product_vtaxonomies);
551
+ return $product_taxonomies;
552
+ }
553
+
554
+ /**
555
+ * To strip the specific string from the array key as well as value.
556
+ * @param array $array.
557
+ * @param string $data.
558
+ * @return array.
559
+ */
560
+ public static function wt_array_walk($array, $data) {
561
+ $new_array = array();
562
+ foreach ($array as $key => $value) {
563
+ $new_array[str_replace($data, '', $key)] = str_replace($data, '', $value);
564
+ }
565
+ return $new_array;
566
+ }
567
+
568
+ /**
569
+ * Get File name by url
570
+ * @param string $file_url URL of the file.
571
+ * @return string the base name of the given URL (File name).
572
+ */
573
+ public static function wt_iew_get_filename_from_url($file_url) {
574
+ $parts = parse_url($file_url);
575
+ if (isset($parts['path'])) {
576
+ return basename($parts['path']);
577
+ }
578
+ }
579
+
580
+ /**
581
+ * Get info like language code, parent product ID etc by product id.
582
+ * @param int Product ID.
583
+ * @return array/false.
584
+ */
585
+ public static function wt_iew_get_wpml_original_post_language_info($element_id) {
586
+ $get_language_args = array('element_id' => $element_id, 'element_type' => 'post_product');
587
+ $original_post_language_info = apply_filters('wpml_element_language_details', null, $get_language_args);
588
+ return $original_post_language_info;
589
+ }
590
+
591
+ public static function wt_iew_is_woocommerce_prior_to($version) {
592
+
593
+ $woocommerce_is_pre_version = (!defined('WC_VERSION') || version_compare(WC_VERSION, $version, '<')) ? true : false;
594
+ return $woocommerce_is_pre_version;
595
+ }
596
+
597
+ public static function wt_iew_get_product_columns($post_columns) {
598
+ if (function_exists('wc_get_filename_from_url')) {
599
+ $file_path_header = 'downloadable_files';
600
+ } else {
601
+ $file_path_header = 'file_paths';
602
+ }
603
+
604
+ $taxonomies = array();
605
+ $product_taxonomies = self::wt_get_product_ptaxonomies();
606
+ foreach ($product_taxonomies as $taxonomy) {
607
+ if (strstr($taxonomy->name, 'pa_'))
608
+ continue; // Skip attributes
609
+
610
+ $taxonomies['tax:' . self::format_data($taxonomy->name)] = 'tax:' .self::format_data($taxonomy->name);
611
+ }
612
+ $post_columns = array_merge($post_columns, $taxonomies);
613
+
614
+ $post_columns['meta'] = 'Meta (custom fields)';
615
+ $post_columns['attributes'] = 'Attributes';
616
+
617
+ if (WC()->version < '2.7.0') {
618
+ $post_columns['_visibility'] = 'visibility';
619
+ }
620
+ if (apply_filters('wpml_setting', false, 'setup_complete')) {
621
+
622
+ $post_columns['wpml:language_code'] = 'wpml:language_code';
623
+ $post_columns['wpml:original_product_id'] = 'wpml:original_product_id';
624
+ $post_columns['wpml:original_product_sku'] = 'wpml:original_product_sku';
625
+ }
626
+
627
+ return apply_filters('wt_iew_woocommerce_csv_product_bulk_product_columns', $post_columns);
628
+ }
629
+
630
+ /**
631
+ * Format the data if required
632
+ * @param string $meta_value
633
+ * @param string $meta name of meta key
634
+ * @return string
635
+ */
636
+ public static function format_export_meta($meta_value, $meta) {
637
+ switch ($meta) {
638
+ case '_sale_price_dates_from' :
639
+ case '_sale_price_dates_to' :
640
+ return $meta_value ? date('Y-m-d', $meta_value) : '';
641
+ break;
642
+ case '_upsell_ids' :
643
+ case '_crosssell_ids' :
644
+ return implode('|', array_filter((array) json_decode($meta_value)));
645
+ break;
646
+ default :
647
+ return $meta_value;
648
+ break;
649
+ }
650
+ }
651
+
652
+ public static function format_data($data) {
653
+ if (!is_array($data))
654
+ ;
655
+ $data = (string) urldecode($data);
656
+ // $enc = mb_detect_encoding($data, 'UTF-8, ISO-8859-1', true);
657
+ $use_mb = function_exists('mb_detect_encoding');
658
+ $enc = '';
659
+ if ($use_mb) {
660
+ $enc = mb_detect_encoding($data, 'UTF-8, ISO-8859-1', true);
661
+ }
662
+ $data = ( $enc == 'UTF-8' ) ? $data : utf8_encode($data);
663
+
664
+ return $data;
665
+ }
666
+
667
+ /**
668
+ * Wrap a column in quotes for the CSV
669
+ * @param string data to wrap
670
+ * @return string wrapped data
671
+ */
672
+ public static function wrap_column($data) {
673
+ return '"' . str_replace('"', '""', $data) . '"';
674
+ }
675
+
676
+
677
+ /**
678
+ * Get a list of all the product attributes for a post type.
679
+ * These require a bit more digging into the values.
680
+ */
681
+ public static function get_all_product_attributes($post_type = 'product') {
682
+ global $wpdb;
683
+
684
+ $results = $wpdb->get_col($wpdb->prepare(
685
+ "SELECT DISTINCT pm.meta_value
686
+ FROM {$wpdb->postmeta} AS pm
687
+ LEFT JOIN {$wpdb->posts} AS p ON p.ID = pm.post_id
688
+ WHERE p.post_type = %s
689
+ AND p.post_status IN ( 'publish', 'private', 'draft', 'pending', 'future' )
690
+ AND pm.meta_key = '_product_attributes'", $post_type
691
+ ));
692
+
693
+ // Go through each result, and look at the attribute keys within them.
694
+ $result = array();
695
+
696
+ if (!empty($results)) {
697
+ foreach ($results as $_product_attributes) {
698
+ $attributes = maybe_unserialize(maybe_unserialize($_product_attributes));
699
+ if (!empty($attributes) && is_array($attributes)) {
700
+ foreach ($attributes as $key => $attribute) {
701
+ if (!$key) {
702
+ continue;
703
+ }
704
+ if (!strstr($key, 'pa_')) {
705
+ if (empty($attribute['name'])) {
706
+ continue;
707
+ }
708
+ $key = $attribute['name'];
709
+ }
710
+
711
+ $result[$key] = $key;
712
+ }
713
+ }
714
+ }
715
+ }
716
+
717
+ sort($result);
718
+
719
+ return $result;
720
+ }
721
+
722
+ }
admin/modules/product/import/import.php CHANGED
@@ -78,16 +78,16 @@ class Wt_Import_Export_For_Woo_Basic_Product_Import {
78
  } else {
79
  $msg = 'Product imported successfully.';
80
  }
81
- $this->import_results[$row] = array('row'=>$row, 'message'=>$msg, 'status'=>true, 'post_id'=>$result['id']);
82
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - ".$msg);
83
  $success++;
84
  }else{
85
- $this->import_results[$row] = array('row'=>$row, 'message'=>$result->get_error_message(), 'status'=>false, 'post_id'=>'');
86
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Processing failed. Reason: ".$result->get_error_message());
87
  $failed++;
88
  }
89
  }else{
90
- $this->import_results[$row] = array('row'=>$row, 'message'=>$parsed_data->get_error_message(), 'status'=>false, 'post_id'=>'');
91
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Parsing failed. Reason: ".$parsed_data->get_error_message());
92
  $failed++;
93
  }
@@ -1209,7 +1209,11 @@ class Wt_Import_Export_For_Woo_Basic_Product_Import {
1209
  }
1210
 
1211
  $images = array();
1212
- $separator = apply_filters( 'wt_woocommerce_product_import_image_separator', '|' );
 
 
 
 
1213
  foreach ( $this->wt_explode_values( $value, $separator ) as $image_data ) {
1214
  $images[] = $this->arrange_product_images($image_data);
1215
 
78
  } else {
79
  $msg = 'Product imported successfully.';
80
  }
81
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$msg, 'status'=>true, 'status_msg' => __( 'Success' ), 'post_id'=>$result['id'], 'post_link' => Wt_Import_Export_For_Woo_Basic_Product::get_item_link_by_id($result['id']));
82
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - ".$msg);
83
  $success++;
84
  }else{
85
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$result->get_error_message(), 'status'=>false, 'status_msg' => __( 'Failed/Skipped' ), 'post_id'=>'', 'post_link' => array( 'title' => __( 'Untitled' ), 'edit_url' => false ) );
86
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Processing failed. Reason: ".$result->get_error_message());
87
  $failed++;
88
  }
89
  }else{
90
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$parsed_data->get_error_message(), 'status'=>false, 'status_msg' => __( 'Failed/Skipped' ), 'post_id'=>'', 'post_link' => array( 'title' => __( 'Untitled' ), 'edit_url' => false ) );
91
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Parsing failed. Reason: ".$parsed_data->get_error_message());
92
  $failed++;
93
  }
1209
  }
1210
 
1211
  $images = array();
1212
+ $default_separator = '|';
1213
+ if (strpos($value, ',') !== false) {
1214
+ $default_separator = ',';
1215
+ }
1216
+ $separator = apply_filters( 'wt_woocommerce_product_import_image_separator', $default_separator );
1217
  foreach ( $this->wt_explode_values( $value, $separator ) as $image_data ) {
1218
  $images[] = $this->arrange_product_images($image_data);
1219
 
admin/modules/product/product.php CHANGED
@@ -73,9 +73,68 @@ class Wt_Import_Export_For_Woo_Basic_Product {
73
  add_filter('wt_iew_importer_do_import_basic', array($this, 'importer_do_import'), 10, 8);
74
 
75
  add_filter('wt_iew_importer_steps_basic', array($this, 'importer_steps'), 10, 2);
 
 
 
76
 
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  /**
80
  * Altering advanced step description
81
  */
@@ -498,6 +557,7 @@ class Wt_Import_Export_For_Woo_Basic_Product {
498
 
499
  public function set_selected_column_names($full_form_data) {
500
  if (is_null($this->selected_column_names)) {
 
501
  if (isset($full_form_data['mapping_form_data']['mapping_selected_fields']) && !empty($full_form_data['mapping_form_data']['mapping_selected_fields'])) {
502
  $this->selected_column_names = $full_form_data['mapping_form_data']['mapping_selected_fields'];
503
  }
@@ -861,6 +921,12 @@ class Wt_Import_Export_For_Woo_Basic_Product {
861
  $post['title'] = get_the_title($id);
862
  return $post;
863
  }
 
 
 
 
 
 
864
 
865
  }
866
  }
73
  add_filter('wt_iew_importer_do_import_basic', array($this, 'importer_do_import'), 10, 8);
74
 
75
  add_filter('wt_iew_importer_steps_basic', array($this, 'importer_steps'), 10, 2);
76
+
77
+ add_action('admin_footer-edit.php', array($this, 'wt_add_products_bulk_actions'));
78
+ add_action('load-edit.php', array($this, 'wt_process_products_bulk_actions'));
79
 
80
  }
81
 
82
+
83
+
84
+ /**
85
+ * Product list page bulk export action add to action list
86
+ *
87
+ */
88
+ public function wt_add_products_bulk_actions() {
89
+ global $post_type, $post_status;
90
+
91
+ if ($post_type == 'product' && $post_status != 'trash') {
92
+ ?>
93
+ <script type="text/javascript">
94
+ jQuery(document).ready(function ($) {
95
+ var $downloadProducts = $('<option>').val('wt_ier_download_products').text('<?php _e('Export to CSV') ?>');
96
+ $('select[name^="action"]').append($downloadProducts);
97
+ });
98
+ </script>
99
+ <?php
100
+ }
101
+ }
102
+
103
+
104
+ /**
105
+ * Product page bulk export action
106
+ *
107
+ */
108
+ public function wt_process_products_bulk_actions() {
109
+ global $typenow;
110
+ if ($typenow == 'product') {
111
+ // get the action list
112
+ $wp_list_table = _get_list_table('WP_Posts_List_Table');
113
+ $action = $wp_list_table->current_action();
114
+ if (!in_array($action, array('wt_ier_download_products'))) {
115
+ return;
116
+ }
117
+ // security check
118
+ check_admin_referer('bulk-posts');
119
+
120
+ if (isset($_REQUEST['post'])) {
121
+ $prod_ids = array_map('absint', $_REQUEST['post']);
122
+ }
123
+ if (empty($prod_ids)) {
124
+ return;
125
+ }
126
+
127
+ if ($action == 'wt_ier_download_products') {
128
+ include_once( 'export/class-wt-prodimpexpcsv-basic-exporter.php' );
129
+
130
+ Wt_Import_Export_For_Woo_Basic_Product_Bulk_Export::do_export('product', $prod_ids);
131
+ }
132
+ }
133
+ }
134
+
135
+
136
+
137
+
138
  /**
139
  * Altering advanced step description
140
  */
557
 
558
  public function set_selected_column_names($full_form_data) {
559
  if (is_null($this->selected_column_names)) {
560
+ $this->selected_column_names = array();
561
  if (isset($full_form_data['mapping_form_data']['mapping_selected_fields']) && !empty($full_form_data['mapping_form_data']['mapping_selected_fields'])) {
562
  $this->selected_column_names = $full_form_data['mapping_form_data']['mapping_selected_fields'];
563
  }
921
  $post['title'] = get_the_title($id);
922
  return $post;
923
  }
924
+
925
+ public static function get_item_link_by_id($id) {
926
+ $post['edit_url']=get_edit_post_link($id);
927
+ $post['title'] = get_the_title($id);
928
+ return $post;
929
+ }
930
 
931
  }
932
  }
admin/modules/product_categories/import/import.php CHANGED
@@ -55,16 +55,16 @@ class Wt_Import_Export_For_Woo_Basic_Categories_Import {
55
  $msg = 'Category updated successfully.';
56
  }
57
 
58
- $this->import_results[$row] = array('row' => $row, 'message' => $msg, 'status' => true, 'post_id' => $result['id']);
59
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - " . $msg);
60
  $success++;
61
  } else {
62
- $this->import_results[$row] = array('row' => $row, 'message' => $result->get_error_message(), 'status' => false, 'post_id' => '');
63
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Prosessing failed. Reason: " . $result->get_error_message());
64
  $failed++;
65
  }
66
  } else {
67
- $this->import_results[$row] = array('row' => $row, 'message' => $parsed_data->get_error_message(), 'status' => false, 'post_id' => '');
68
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Parsing failed. Reason: " . $parsed_data->get_error_message());
69
  $failed++;
70
  }
@@ -106,7 +106,6 @@ class Wt_Import_Export_For_Woo_Basic_Categories_Import {
106
  try {
107
 
108
  $term_data = $this->process_taxonomy_by_type($post, $is_update, $taxonomy_type);
109
-
110
  return $term_data;
111
  } catch (Exception $e) {
112
  return new WP_Error('woocommerce_product_importer_error', $e->getMessage(), array('status' => $e->getCode()));
@@ -174,7 +173,6 @@ class Wt_Import_Export_For_Woo_Basic_Categories_Import {
174
  }
175
  $related_data['parent'] = $pid;
176
  }
177
-
178
  if (!empty($parent_id) && empty($res)) {
179
 
180
  $status = array(
@@ -213,7 +211,9 @@ class Wt_Import_Export_For_Woo_Basic_Categories_Import {
213
  );
214
  unset($cid);
215
  }
216
- }
 
 
217
  } else {
218
 
219
  if ($is_update) {
55
  $msg = 'Category updated successfully.';
56
  }
57
 
58
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$msg, 'status'=>true, 'status_msg' => __( 'Success' ), 'post_id'=>$result['id'], 'post_link' => Wt_Import_Export_For_Woo_Basic_Product_Categories::get_item_link_by_id($result['id']));
59
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - " . $msg);
60
  $success++;
61
  } else {
62
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$result->get_error_message(), 'status'=>false, 'status_msg' => __( 'Failed/Skipped' ), 'post_id'=>'', 'post_link' => array( 'title' => __( 'Untitled' ), 'edit_url' => false ) );
63
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Prosessing failed. Reason: " . $result->get_error_message());
64
  $failed++;
65
  }
66
  } else {
67
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$parsed_data->get_error_message(), 'status'=>false, 'status_msg' => __( 'Failed/Skipped' ), 'post_id'=>'', 'post_link' => array( 'title' => __( 'Untitled' ), 'edit_url' => false ) );
68
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Parsing failed. Reason: " . $parsed_data->get_error_message());
69
  $failed++;
70
  }
106
  try {
107
 
108
  $term_data = $this->process_taxonomy_by_type($post, $is_update, $taxonomy_type);
 
109
  return $term_data;
110
  } catch (Exception $e) {
111
  return new WP_Error('woocommerce_product_importer_error', $e->getMessage(), array('status' => $e->getCode()));
173
  }
174
  $related_data['parent'] = $pid;
175
  }
 
176
  if (!empty($parent_id) && empty($res)) {
177
 
178
  $status = array(
211
  );
212
  unset($cid);
213
  }
214
+ }else{
215
+ return new WP_Error('data-error', 'Missing category details to insert');
216
+ }
217
  } else {
218
 
219
  if ($is_update) {
admin/modules/product_categories/product_categories.php CHANGED
@@ -390,6 +390,11 @@ class Wt_Import_Export_For_Woo_Basic_Product_Categories {
390
  $post['title'] = @get_term($id)->name;
391
  return $post;
392
  }
 
 
 
 
 
393
  }
394
  }
395
  new Wt_Import_Export_For_Woo_Basic_Product_Categories();
390
  $post['title'] = @get_term($id)->name;
391
  return $post;
392
  }
393
+ public static function get_item_link_by_id($id) {
394
+ $post['edit_url']= get_edit_term_link($id);
395
+ $post['title'] = @get_term($id)->name;
396
+ return $post;
397
+ }
398
  }
399
  }
400
  new Wt_Import_Export_For_Woo_Basic_Product_Categories();
admin/modules/product_review/import/import.php CHANGED
@@ -108,16 +108,16 @@ class Wt_Import_Export_For_Woo_Basic_Product_Review_Import {
108
  if($this->is_comment_exist){
109
  $msg = 'Product Review updated successfully.';
110
  }
111
- $this->import_results[$row] = array('row'=>$row, 'message'=>$msg, 'status'=>true, 'post_id'=>$result['id']);
112
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - ".$msg);
113
  $success++;
114
  }else{
115
- $this->import_results[$row] = array('row'=>$row, 'message'=>$result->get_error_message(), 'status'=>false, 'post_id'=>'');
116
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Prosessing failed. Reason: ".$result->get_error_message());
117
  $failed++;
118
  }
119
  }else{
120
- $this->import_results[$row] = array('row'=>$row, 'message'=>$parsed_data->get_error_message(), 'status'=>false, 'post_id'=>'');
121
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Parsing failed. Reason: ".$parsed_data->get_error_message());
122
  $failed++;
123
  }
108
  if($this->is_comment_exist){
109
  $msg = 'Product Review updated successfully.';
110
  }
111
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$msg, 'status'=>true, 'status_msg' => __( 'Success' ), 'post_id'=>$result['id'], 'post_link' => Wt_Import_Export_For_Woo_Basic_Product_Review::get_item_link_by_id($result['id']));
112
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - ".$msg);
113
  $success++;
114
  }else{
115
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$result->get_error_message(), 'status'=>false, 'status_msg' => __( 'Failed/Skipped' ), 'post_id'=>'', 'post_link' => array( 'title' => __( 'Untitled' ), 'edit_url' => false ) );
116
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Prosessing failed. Reason: ".$result->get_error_message());
117
  $failed++;
118
  }
119
  }else{
120
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$parsed_data->get_error_message(), 'status'=>false, 'status_msg' => __( 'Failed/Skipped' ), 'post_id'=>'', 'post_link' => array( 'title' => __( 'Untitled' ), 'edit_url' => false ) );
121
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Parsing failed. Reason: ".$parsed_data->get_error_message());
122
  $failed++;
123
  }
admin/modules/product_review/product_review.php CHANGED
@@ -625,6 +625,11 @@ class Wt_Import_Export_For_Woo_Basic_Product_Review {
625
  $post['title'] = get_comment_excerpt($id);
626
  return $post;
627
  }
 
 
 
 
 
628
  }
629
  }
630
  new Wt_Import_Export_For_Woo_Basic_Product_Review();
625
  $post['title'] = get_comment_excerpt($id);
626
  return $post;
627
  }
628
+ public static function get_item_link_by_id($id) {
629
+ $post['edit_url']=get_edit_comment_link($id);
630
+ $post['title'] = get_comment_excerpt($id);
631
+ return $post;
632
+ }
633
  }
634
  }
635
  new Wt_Import_Export_For_Woo_Basic_Product_Review();
admin/modules/product_tags/import/import.php CHANGED
@@ -53,16 +53,16 @@ class Wt_Import_Export_For_Woo_Basic_Tags_Import {
53
  $msg = 'Tag updated successfully.';
54
  }
55
 
56
- $this->import_results[$row] = array('row' => $row, 'message' => $msg, 'status' => true, 'post_id' => $result['id']);
57
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - " . $msg);
58
  $success++;
59
  } else {
60
- $this->import_results[$row] = array('row' => $row, 'message' => $result->get_error_message(), 'status' => false, 'post_id' => '');
61
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Prosessing failed. Reason: " . $result->get_error_message());
62
  $failed++;
63
  }
64
  } else {
65
- $this->import_results[$row] = array('row' => $row, 'message' => $parsed_data->get_error_message(), 'status' => false, 'post_id' => '');
66
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Parsing failed. Reason: " . $parsed_data->get_error_message());
67
  $failed++;
68
  }
@@ -161,7 +161,7 @@ class Wt_Import_Export_For_Woo_Basic_Tags_Import {
161
 
162
  if ($tid == '') {
163
 
164
- if (!empty($data['slug'])) {
165
 
166
  if ($taxonomy_type == 'product_tag' || $taxonomy_type == 'product_cat') {
167
 
@@ -213,7 +213,9 @@ class Wt_Import_Export_For_Woo_Basic_Tags_Import {
213
  );
214
  unset($cid);
215
  }
216
- }
 
 
217
  } else {
218
 
219
  if ($is_update) {
53
  $msg = 'Tag updated successfully.';
54
  }
55
 
56
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$msg, 'status'=>true, 'status_msg' => __( 'Success' ), 'post_id'=>$result['id'], 'post_link' => Wt_Import_Export_For_Woo_Basic_Product_Tags::get_item_link_by_id($result['id']));
57
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - " . $msg);
58
  $success++;
59
  } else {
60
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$result->get_error_message(), 'status'=>false, 'status_msg' => __( 'Failed/Skipped' ), 'post_id'=>'', 'post_link' => array( 'title' => __( 'Untitled' ), 'edit_url' => false ) );
61
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Prosessing failed. Reason: " . $result->get_error_message());
62
  $failed++;
63
  }
64
  } else {
65
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$parsed_data->get_error_message(), 'status'=>false, 'status_msg' => __( 'Failed/Skipped' ), 'post_id'=>'', 'post_link' => array( 'title' => __( 'Untitled' ), 'edit_url' => false ) );
66
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Parsing failed. Reason: " . $parsed_data->get_error_message());
67
  $failed++;
68
  }
161
 
162
  if ($tid == '') {
163
 
164
+ if (!empty($data['slug']) || '' !== $name ) {
165
 
166
  if ($taxonomy_type == 'product_tag' || $taxonomy_type == 'product_cat') {
167
 
213
  );
214
  unset($cid);
215
  }
216
+ }else{
217
+ return new WP_Error('data-error', 'Missing tag details to insert');
218
+ }
219
  } else {
220
 
221
  if ($is_update) {
admin/modules/product_tags/product_tags.php CHANGED
@@ -393,6 +393,11 @@ class Wt_Import_Export_For_Woo_Basic_Product_Tags {
393
  $post['title'] = @get_term($id)->name;
394
  return $post;
395
  }
 
 
 
 
 
396
  }
397
  }
398
  new Wt_Import_Export_For_Woo_Basic_Product_Tags();
393
  $post['title'] = @get_term($id)->name;
394
  return $post;
395
  }
396
+ public static function get_item_link_by_id($id) {
397
+ $post['edit_url']= get_edit_term_link($id);
398
+ $post['title'] = @get_term($id)->name;
399
+ return $post;
400
+ }
401
  }
402
  }
403
  new Wt_Import_Export_For_Woo_Basic_Product_Tags();
class-wt-product-review-request.php CHANGED
@@ -4,7 +4,7 @@
4
  * Review request
5
  *
6
  *
7
- * @package Cookie_Law_Info
8
  */
9
  if (!defined('ABSPATH')) {
10
  exit;
4
  * Review request
5
  *
6
  *
7
+ * @package Product_Import_Export_Review_Request
8
  */
9
  if (!defined('ABSPATH')) {
10
  exit;
includes/class-wt-import-export-for-woo.php CHANGED
@@ -80,7 +80,7 @@ class Wt_Import_Export_For_Woo_Basic {
80
  if ( defined( 'WT_P_IEW_VERSION' ) ) {
81
  $this->version = WT_P_IEW_VERSION;
82
  } else {
83
- $this->version = '2.2.1';
84
  }
85
  $this->plugin_name = 'wt-import-export-for-woo-basic';
86
 
80
  if ( defined( 'WT_P_IEW_VERSION' ) ) {
81
  $this->version = WT_P_IEW_VERSION;
82
  } else {
83
+ $this->version = '2.2.2';
84
  }
85
  $this->plugin_name = 'wt-import-export-for-woo-basic';
86
 
product-import-export-for-woo.php CHANGED
@@ -5,12 +5,12 @@
5
  Description: Import and Export Products From and To your WooCommerce Store.
6
  Author: WebToffee
7
  Author URI: https://www.webtoffee.com/product/product-import-export-woocommerce/
8
- Version: 2.2.1
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
  Text Domain: product-import-export-for-woo
12
  Domain Path: /languages
13
- WC tested up to: 6.5
14
  Requires at least: 3.0
15
  Requires PHP: 5.6
16
  */
@@ -46,7 +46,7 @@ if ( !defined( 'WT_IEW_DEBUG_BASIC_TROUBLESHOOT' ) ) {
46
  * Start at version 1.0.0 and use SemVer - https://semver.org
47
  * Rename this for your plugin and update it as you release new versions.
48
  */
49
- define( 'WT_P_IEW_VERSION', '2.2.1' );
50
 
51
  /**
52
  * The code that runs during plugin activation.
@@ -271,3 +271,20 @@ function wt_product_addon_basic_gopro_content() {
271
  <?php
272
  }
273
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  Description: Import and Export Products From and To your WooCommerce Store.
6
  Author: WebToffee
7
  Author URI: https://www.webtoffee.com/product/product-import-export-woocommerce/
8
+ Version: 2.2.2
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
  Text Domain: product-import-export-for-woo
12
  Domain Path: /languages
13
+ WC tested up to: 6.6
14
  Requires at least: 3.0
15
  Requires PHP: 5.6
16
  */
46
  * Start at version 1.0.0 and use SemVer - https://semver.org
47
  * Rename this for your plugin and update it as you release new versions.
48
  */
49
+ define( 'WT_P_IEW_VERSION', '2.2.2' );
50
 
51
  /**
52
  * The code that runs during plugin activation.
271
  <?php
272
  }
273
  }
274
+
275
+
276
+ /**
277
+ * Add Export to CSV link in product listing page near the filter button.
278
+ *
279
+ * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
280
+ */
281
+ function export_csv_linkin_product_listing_page($which) {
282
+
283
+ $currentScreen = get_current_screen();
284
+
285
+ if ('edit-product' === $currentScreen->id) {
286
+ echo '<a target="_blank" href="' . admin_url('admin.php?page=wt_import_export_for_woo_basic_export&wt_to_export=product') . '" class="button" style="height:32px;" >' . __('Export to CSV') . ' </a>';
287
+ }
288
+ }
289
+
290
+ add_filter('manage_posts_extra_tablenav', 'export_csv_linkin_product_listing_page');
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: product export, product import, CSV import export, woocommerce, CSV, produ
5
  Requires at least: 3.0.1
6
  Tested up to: 6.0
7
  Requires PHP: 5.6
8
- Stable tag: 2.2.1
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -56,7 +56,7 @@ With this plugin, you can export and import WooCommerce products to and from a C
56
  * <strong>Save frequently used import/export configurations</strong> as templates and use the template for future imports and exports.
57
  * The plugin <strong>stores all the past imports and exports</strong> and <strong>lets you re-run</strong> them when needed.
58
  * <strong>Easy debugging:</strong> View and download import log for debugging purpose.
59
- * Tested OK with WooCommerce 6.5
60
 
61
  ###COMPATIBLE PLUGINS###
62
 
@@ -242,6 +242,10 @@ Yes, you can import grouped, affiliate/external products in addition to simple p
242
 
243
  == CHANGELOG ==
244
 
 
 
 
 
245
  = 2.2.1 2022-05-26 =
246
  * WordPress 6.0 Tested OK.
247
  * WooCommerce 6.5 Tested OK.
@@ -607,7 +611,7 @@ Yes, you can import grouped, affiliate/external products in addition to simple p
607
 
608
  == Upgrade Notice ==
609
 
610
- = 2.2.1 =
611
- * WordPress 6.0 Tested OK.
612
- * WooCommerce 6.5 Tested OK.
613
- * Enhancement: Option to choose delimiter when exporting.
5
  Requires at least: 3.0.1
6
  Tested up to: 6.0
7
  Requires PHP: 5.6
8
+ Stable tag: 2.2.2
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
56
  * <strong>Save frequently used import/export configurations</strong> as templates and use the template for future imports and exports.
57
  * The plugin <strong>stores all the past imports and exports</strong> and <strong>lets you re-run</strong> them when needed.
58
  * <strong>Easy debugging:</strong> View and download import log for debugging purpose.
59
+ * Tested OK with WooCommerce 6.6
60
 
61
  ###COMPATIBLE PLUGINS###
62
 
242
 
243
  == CHANGELOG ==
244
 
245
+ = 2.2.2 2022-07-05 =
246
+ * Enhancement: Export to CSV option to Bulk Action drop-down menu in WC Product listing page.
247
+ * Enhancement: Import progress screen improvements.
248
+ * WooCommerce 6.6 Tested OK.
249
  = 2.2.1 2022-05-26 =
250
  * WordPress 6.0 Tested OK.
251
  * WooCommerce 6.5 Tested OK.
611
 
612
  == Upgrade Notice ==
613
 
614
+ = 2.2.2 =
615
+ * Enhancement: Export to CSV option to Bulk Action drop-down menu in WC Product listing page.
616
+ * Enhancement: Import progress screen improvements.
617
+ * WooCommerce 6.6 Tested OK.