Order Export & Order Import for WooCommerce - Version 1.4.2

Version Description

  • Bug fix.
  • WC 3.5.5 and WP5.1 compatibility.
Download this release

Release Info

Developer webtoffee
Plugin Icon 128x128 Order Export & Order Import for WooCommerce
Version 1.4.2
Comparing to
See all releases

Code changes from version 1.4.1 to 1.4.2

includes/exporter/class-wf-orderimpexpcsv-exporter.php CHANGED
@@ -251,7 +251,7 @@ class WF_OrderImpExpCsv_Exporter {
251
  'fee_items' => implode(';', $fee_items),
252
  'tax_items' => implode(';', $tax_items),
253
  'coupon_items' => implode(';', $coupon_items),
254
- 'order_notes' => implode('|', WF_OrderImpExpCsv_Exporter::get_order_notes($order)),
255
  'download_permissions' => $order->download_permissions_granted ? $order->download_permissions_granted : 0,
256
  );
257
  }else{
@@ -302,7 +302,7 @@ class WF_OrderImpExpCsv_Exporter {
302
  'fee_items' => implode(';', $fee_items),
303
  'tax_items' => implode(';', $tax_items),
304
  'coupon_items' => implode(';', $coupon_items),
305
- 'order_notes' => implode('|', WF_OrderImpExpCsv_Exporter::get_order_notes($order)),
306
  'download_permissions' => $order->is_download_permitted() ? $order->is_download_permitted() : 0,
307
  );
308
 
@@ -341,14 +341,22 @@ class WF_OrderImpExpCsv_Exporter {
341
  $notes = get_comments($args);
342
 
343
  add_filter('comments_clauses', $callback);
 
344
 
345
  $order_notes = array();
346
 
347
  foreach ($notes as $note) {
348
-
349
- $order_notes[] = str_replace(array("\r", "\n"), ' ', $note->comment_content);
 
 
 
 
 
 
 
 
350
  }
351
-
352
  return $order_notes;
353
  }
354
 
251
  'fee_items' => implode(';', $fee_items),
252
  'tax_items' => implode(';', $tax_items),
253
  'coupon_items' => implode(';', $coupon_items),
254
+ 'order_notes' => implode('||', WF_OrderImpExpCsv_Exporter::get_order_notes($order)),
255
  'download_permissions' => $order->download_permissions_granted ? $order->download_permissions_granted : 0,
256
  );
257
  }else{
302
  'fee_items' => implode(';', $fee_items),
303
  'tax_items' => implode(';', $tax_items),
304
  'coupon_items' => implode(';', $coupon_items),
305
+ 'order_notes' => implode('||', WF_OrderImpExpCsv_Exporter::get_order_notes($order)),
306
  'download_permissions' => $order->is_download_permitted() ? $order->is_download_permitted() : 0,
307
  );
308
 
341
  $notes = get_comments($args);
342
 
343
  add_filter('comments_clauses', $callback);
344
+ $notes = array_reverse($notes);
345
 
346
  $order_notes = array();
347
 
348
  foreach ($notes as $note) {
349
+ $date = $note->comment_date;
350
+ $customer_note = 0;
351
+ if (get_comment_meta($note->comment_ID, 'is_customer_note', '1')){
352
+ $customer_note = 1;
353
+ }
354
+ $order_notes[] = implode('|', array(
355
+ 'content:' .str_replace(array("\r", "\n"), ' ', $note->comment_content),
356
+ 'date:'.(!empty($date) ? $date : current_time( 'mysql' )),
357
+ 'customer:'.$customer_note
358
+ ));
359
  }
 
360
  return $order_notes;
361
  }
362
 
includes/importer/class-wf-cpnimpexpcsv-coupon-import.php CHANGED
@@ -378,17 +378,17 @@ class WF_CpnImpExpCsv_Coupon_Import extends WP_Importer {
378
 
379
  $file = stripslashes( $_POST['file'] );
380
  $mapping = json_decode( stripslashes( $_POST['mapping'] ), true );
381
- $profile = isset( $_POST['profile'] ) ? $_POST['profile']:'';
382
- $eval_field = $_POST['eval_field'];
383
  $start_pos = isset( $_POST['start_pos'] ) ? absint( $_POST['start_pos'] ) : 0;
384
  $end_pos = isset( $_POST['end_pos'] ) ? absint( $_POST['end_pos'] ) : '';
385
 
386
  if($profile!== '')
387
  {
388
- $profile_array = get_option('wf_cpn_csv_imp_exp_mapping');
389
- $profile_array[$profile] = array($mapping,$eval_field);
390
- update_option('wf_cpn_csv_imp_exp_mapping', $profile_array);
391
- }
392
 
393
  $position = $this->import_start( $file, $mapping, $start_pos, $end_pos, $eval_field );
394
  $this->import();
@@ -777,6 +777,7 @@ class WF_CpnImpExpCsv_Coupon_Import extends WP_Importer {
777
 
778
  $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> Inserting %s', 'order-import-export-for-woocommerce'), esc_html($processing_coupon_title)), true);
779
  $postdata = array(
 
780
  'post_author' => (isset($post['post_author']) && !empty($post['post_author'])) ? absint($post['post_author']) : get_current_user_id(),
781
  'post_date' => (isset($post['post_date']) && !empty($post['post_date'])) ? date('Y-m-d H:i:s', strtotime($post['post_date'])) : '',
782
  'post_date_gmt' => (isset($post['post_date_gmt']) && !empty($post['post_date_gmt'])) ? date('Y-m-d H:i:s', strtotime($post['post_date_gmt'])) : '',
@@ -797,7 +798,6 @@ class WF_CpnImpExpCsv_Coupon_Import extends WP_Importer {
797
  unset($post);
798
  return;
799
  } else {
800
-
801
  $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> Inserted - coupon ID is %s.', 'order-import-export-for-woocommerce'), $post_id));
802
  }
803
  }
378
 
379
  $file = stripslashes( $_POST['file'] );
380
  $mapping = json_decode( stripslashes( $_POST['mapping'] ), true );
381
+ $profile = isset( $_POST['profile'] ) ? $_POST['profile']:'';
382
+ $eval_field = $_POST['eval_field'];
383
  $start_pos = isset( $_POST['start_pos'] ) ? absint( $_POST['start_pos'] ) : 0;
384
  $end_pos = isset( $_POST['end_pos'] ) ? absint( $_POST['end_pos'] ) : '';
385
 
386
  if($profile!== '')
387
  {
388
+ $profile_array = get_option('wf_cpn_csv_imp_exp_mapping');
389
+ $profile_array[$profile] = array($mapping,$eval_field);
390
+ update_option('wf_cpn_csv_imp_exp_mapping', $profile_array);
391
+ }
392
 
393
  $position = $this->import_start( $file, $mapping, $start_pos, $end_pos, $eval_field );
394
  $this->import();
777
 
778
  $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> Inserting %s', 'order-import-export-for-woocommerce'), esc_html($processing_coupon_title)), true);
779
  $postdata = array(
780
+ 'import_id' => $post['post_id'],
781
  'post_author' => (isset($post['post_author']) && !empty($post['post_author'])) ? absint($post['post_author']) : get_current_user_id(),
782
  'post_date' => (isset($post['post_date']) && !empty($post['post_date'])) ? date('Y-m-d H:i:s', strtotime($post['post_date'])) : '',
783
  'post_date_gmt' => (isset($post['post_date_gmt']) && !empty($post['post_date_gmt'])) ? date('Y-m-d H:i:s', strtotime($post['post_date_gmt'])) : '',
798
  unset($post);
799
  return;
800
  } else {
 
801
  $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> Inserted - coupon ID is %s.', 'order-import-export-for-woocommerce'), $post_id));
802
  }
803
  }
includes/importer/class-wf-csv-parser.php CHANGED
@@ -318,7 +318,7 @@ class WF_CSV_Parser {
318
 
319
  $order_notes = array();
320
  if (!empty($item['order_notes'])) {
321
- $order_notes = explode("|", $item['order_notes']);
322
  }
323
 
324
  // build the order data object
318
 
319
  $order_notes = array();
320
  if (!empty($item['order_notes'])) {
321
+ $order_notes = explode("||", $item['order_notes']);
322
  }
323
 
324
  // build the order data object
includes/importer/class-wf-orderimpexpcsv-order-import.php CHANGED
@@ -747,9 +747,27 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
747
  }
748
 
749
  // add order notes
750
- $order = wc_get_order($order_id);
751
- foreach ($post['notes'] as $order_note) {
752
- $order->add_order_note($order_note);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
753
  }
754
 
755
  // record the product sales
747
  }
748
 
749
  // add order notes
750
+ if(!empty($post['notes'])){
751
+ add_filter('woocommerce_email_enabled_customer_note', '__return_false');
752
+ if ($merging && $is_order_exist) {
753
+ $wpdb->query($wpdb->prepare("DELETE comments,meta FROM {$wpdb->prefix}comments comments LEFT JOIN {$wpdb->prefix}commentmeta meta ON comments.comment_ID = meta.comment_id WHERE comments.comment_post_ID = %d",$order_id));
754
+ }
755
+ $order = wc_get_order($order_id);
756
+ foreach ($post['notes'] as $order_note) {
757
+ $note = explode('|', $order_note);
758
+ $con = array_shift($note);
759
+ $con = substr($con, strpos($con, ":") + 1);
760
+ $date = array_shift($note);
761
+ $date = substr($date, strpos($date, ":") + 1);
762
+ $cus = array_shift($note);
763
+ $cus = substr($cus, strpos($cus, ":") + 1);
764
+ if($cus == '1'){
765
+ $comment_id = $order->add_order_note($con,1,1);
766
+ } else {
767
+ $comment_id = $order->add_order_note($con);
768
+ }
769
+ wp_update_comment(array('comment_ID' => $comment_id,'comment_date' => $date));
770
+ }
771
  }
772
 
773
  // record the product sales
order-import-export-for-woocommerce.php CHANGED
@@ -6,9 +6,9 @@ Plugin URI: https://wordpress.org/plugins/order-import-export-for-woocommerce/
6
  Description: Export and Import Order detail including line items, From and To your WooCommerce Store.
7
  Author: WebToffee
8
  Author URI: https://www.webtoffee.com/product/woocommerce-order-coupon-subscription-export-import/
9
- Version: 1.4.1
10
  Text Domain: order-import-export-for-woocommerce
11
- WC tested up to: 3.5.4
12
  License: GPLv3
13
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
14
  */
@@ -24,7 +24,7 @@ define("WF_CPN_IMP_EXP_ID", "wf_cpn_imp_exp");
24
  define("wf_coupon_csv_im_ex", "wf_coupon_csv_im_ex");
25
 
26
  if (!defined('WF_ORDERIMPEXP_CURRENT_VERSION')) {
27
- define("WF_ORDERIMPEXP_CURRENT_VERSION", "1.4.1");
28
  }
29
 
30
  /**
6
  Description: Export and Import Order detail including line items, From and To your WooCommerce Store.
7
  Author: WebToffee
8
  Author URI: https://www.webtoffee.com/product/woocommerce-order-coupon-subscription-export-import/
9
+ Version: 1.4.2
10
  Text Domain: order-import-export-for-woocommerce
11
+ WC tested up to: 3.5.5
12
  License: GPLv3
13
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
14
  */
24
  define("wf_coupon_csv_im_ex", "wf_coupon_csv_im_ex");
25
 
26
  if (!defined('WF_ORDERIMPEXP_CURRENT_VERSION')) {
27
+ define("WF_ORDERIMPEXP_CURRENT_VERSION", "1.4.2");
28
  }
29
 
30
  /**
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: webtoffee
3
  Donate link: https://www.webtoffee.com/plugins/
4
  Tags: Order Export, Order Import, WooCommerce Export Orders , WooCommerce Import Orders , Export Orders, Import Orders
5
  Requires at least: 3.0.1
6
- Tested up to: 5.0.3
7
- Stable tag: 1.4.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -21,7 +21,7 @@ This is perfect tool if you are migrating an existing shop on a different eComme
21
  🔸 Import Coupons from CSV file.
22
  🔸 Export Subscription Orders to CSV file(Premium Feature).
23
  🔸 Import Subscription Orders from CSV file(Premium Feature).
24
- 🔸 Tested OK with WooCommerce 3.5.4
25
 
26
  <blockquote>
27
 
@@ -110,6 +110,9 @@ Yes. You can import or export order line item details.
110
 
111
  == Changelog ==
112
 
 
 
 
113
  = 1.4.1 =
114
  * Tools Updated.
115
  * Help tab added.
@@ -215,12 +218,6 @@ Yes. You can import or export order line item details.
215
  * Export /Import WooCommerce Orders.
216
 
217
  == Upgrade Notice ==
218
- = 1.4.1 =
219
- * Tools Updated.
220
- * Help tab added.
221
- * Bug fix: Import of 'download permissions'.
222
- * Bug fix: 2 blank meta columns on coupon export.
223
- * All sample CSVs updated.
224
- * Order date supports formats, 'd-m-y H:i' & 'Y-m-d H:i:s'.
225
- * WC 3.5.4 compatibility.
226
- * Language translation supported.
3
  Donate link: https://www.webtoffee.com/plugins/
4
  Tags: Order Export, Order Import, WooCommerce Export Orders , WooCommerce Import Orders , Export Orders, Import Orders
5
  Requires at least: 3.0.1
6
+ Tested up to: 5.1
7
+ Stable tag: 1.4.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
21
  &#128312; Import Coupons from CSV file.
22
  &#128312; Export Subscription Orders to CSV file(Premium Feature).
23
  &#128312; Import Subscription Orders from CSV file(Premium Feature).
24
+ &#128312; Tested OK with WooCommerce 3.5.5
25
 
26
  <blockquote>
27
 
110
 
111
  == Changelog ==
112
 
113
+ = 1.4.2 =
114
+ * Bug fix.
115
+ * WC 3.5.5 and WP5.1 compatibility.
116
  = 1.4.1 =
117
  * Tools Updated.
118
  * Help tab added.
218
  * Export /Import WooCommerce Orders.
219
 
220
  == Upgrade Notice ==
221
+ = 1.4.2 =
222
+ * Bug fix.
223
+ * WC 3.5.5 and WP5.1 compatibility.