Order Export & Order Import for WooCommerce - Version 2.0.8

Version Description

  • Fixed: Grant download permission issue on import
  • Fixed: Trash orders getting exported with coupon filter applied
  • WC 5.5 tested OK
  • WP 5.8 tested OK
Download this release

Release Info

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

Code changes from version 2.0.7 to 2.0.8

admin/modules/coupon/data/data-coupon-post-columns.php CHANGED
@@ -4,31 +4,31 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  }
5
 
6
  return apply_filters('coupon_csv_coupon_post_columns', array(
7
- 'post_title' => 'post_title',
8
  'ID' => 'ID',
9
- 'post_excerpt' => 'post_excerpt',
10
- 'post_status' => 'post_status',
11
- 'post_date' => 'post_date',
12
- 'post_author' => 'post_author',
 
13
 
14
  // // Meta
15
- 'discount_type' => 'discount_type',
16
- 'coupon_amount' => 'coupon_amount',
17
- 'individual_use' => 'individual_use',
18
- 'product_ids' => 'product_ids',
19
- 'product_SKUs' => 'product_SKUs',
20
- 'exclude_product_ids' => 'exclude_product_ids',
21
- 'exclude_product_SKUs' => 'exclude_product_SKUs',
22
- 'usage_count' => 'usage_count',
23
- 'usage_limit' => 'usage_limit',
24
- 'usage_limit_per_user' => 'usage_limit_per_user',
25
- 'limit_usage_to_x_items' => 'limit_usage_to_x_items',
26
- 'date_expires' => 'date_expires',
27
- 'free_shipping' => 'free_shipping',
28
- 'exclude_sale_items' => 'exclude_sale_items',
29
- 'product_categories' => 'product_categories',
30
- 'exclude_product_categories' => 'exclude_product_categories',
31
- 'minimum_amount' => 'minimum_amount',
32
- 'maximum_amount' => 'maximum_amount',
33
- 'customer_email' => 'customer_email',
34
- ) );
4
  }
5
 
6
  return apply_filters('coupon_csv_coupon_post_columns', array(
 
7
  'ID' => 'ID',
8
+ 'post_title' => 'Coupon code',
9
+ 'post_excerpt' => 'Description',
10
+ 'post_status' => 'Status',
11
+ 'post_date' => 'Post date',
12
+ 'post_author' => 'Post author',
13
 
14
  // // Meta
15
+ 'discount_type' => 'Discount type',
16
+ 'coupon_amount' => 'Coupon amount',
17
+ 'individual_use' => 'Individual use only',
18
+ 'product_ids' => 'Product IDs',
19
+ 'product_SKUs' => 'Product SKUs',
20
+ 'exclude_product_ids' => 'Exclude product IIDs',
21
+ 'exclude_product_SKUs' => 'Exclude product SKUs',
22
+ 'usage_count' => 'No of times used',
23
+ 'usage_limit' => 'Usage limit per coupon',
24
+ 'usage_limit_per_user' => 'Usage limit per user',
25
+ 'limit_usage_to_x_items' => 'Limit usage to X items',
26
+ 'date_expires' => 'Expiry date',
27
+ 'free_shipping' => 'Allow free shipping',
28
+ 'exclude_sale_items' => 'Exclude sale items',
29
+ 'product_categories' => 'Product categories',
30
+ 'exclude_product_categories' => 'Exclude categories',
31
+ 'minimum_amount' => 'Minimum amount',
32
+ 'maximum_amount' => 'Maximum amount',
33
+ 'customer_email' => 'Allowed emails',
34
+ ) );
admin/modules/coupon/data/data/data-wf-reserved-fields-pair.php CHANGED
@@ -2,28 +2,26 @@
2
 
3
  // Reserved column names
4
  return apply_filters('woocommerce_csv_product_import_reserved_fields_pair',array(
5
- 'ID' => array('title'=>'Coupon ID','description'=>'Coupon ID'),
6
- 'post_title' => array('title'=>'Coupon Title','description'=>'Name of the coupon '),
7
- //'post_name' => array('title'=>'Coupon Permalink','description'=>'Unique part of the coupon URL'),
8
- 'post_status' => array('title'=>'Coupon Status','description'=>'Coupon Status ( published , draft ...)'),
9
- //'post_content' => array('title'=>'Coupon Description','description'=>'Description about the Coupon'),
10
- 'post_excerpt' => array('title'=>'Coupon Short Description','description'=>'Short description about the Coupon'),
11
- 'post_date' => array('title'=>'Post Date','description'=>'Coupon posted date', 'type' => 'date'),
12
- 'discount_type' => array('title'=>'Coupon Type','description'=>'fixed_cart OR percent OR fixed_product OR percent_product'),
13
- 'coupon_amount' => array('title'=>'Coupon Amount','description'=>'Numeric values'),
14
- 'individual_use' => array('title'=>'Individual Use?','description'=>'yes or no'),
15
- 'product_ids' => array('title'=>'Associated Product Ids','description'=>'With comma(,) Separator'),
16
- 'exclude_product_ids' => array('title'=>'Exclude Product Ids','description'=>'With comma(,) Separator'),
17
  'usage_count' => array('title'=>'No of times used','description'=>'Numeric Values'),
18
- 'usage_limit' => array('title'=>'Usage Limit Per Coupon','description'=>'Numeric Values'),
19
- 'usage_limit_per_user' => array('title'=>'Usage Limit Per User','description'=>'Numeric Values'),
20
- 'limit_usage_to_x_items' => array('title'=>'Limit Usage To X Items','description'=>'Maximum Number Of Individual Items This Coupon Can Apply'),
21
- 'date_expires' => array('title'=>'Expiry Date','description'=>'YYYY-MM-DD', 'type' => 'date'),
22
- 'free_shipping' => array('title'=>'Is Free Shipping?','description'=>'yes or no'),
23
- 'exclude_sale_items' => array('title'=>'Is Exclude Sale Items?','description'=>'yes or no'),
24
- 'product_categories' => array('title'=>'Product Categories','description'=>'with comma(,) Separator'),
25
- 'exclude_product_categories' => array('title'=>'Exclude Product Categories','description'=>'With comma(,) Separator'),
26
- 'minimum_amount' => array('title'=>'Minimum Amount','description'=>'Numeric'),
27
- 'maximum_amount' => array('title'=>'Maximum Amount','description'=>'Numeric'),
28
- 'customer_email' => array('title'=>'Restricted Customers Email Ids','description'=>'With comma(,) Separator'),
29
  ));
2
 
3
  // Reserved column names
4
  return apply_filters('woocommerce_csv_product_import_reserved_fields_pair',array(
5
+ 'ID' => array('title'=>'ID','description'=>'Coupon ID'),
6
+ 'post_title' => array('title'=>'Coupon code','description'=>'Name of the coupon '),
7
+ 'post_excerpt' => array('title'=>'Description','description'=>'Short description about the Coupon'),
8
+ 'post_status' => array('title'=>'Status','description'=>'Coupon Status ( published , draft ...)'),
9
+ 'post_date' => array('title'=>'Post date','description'=>'Coupon posted date', 'type' => 'date'),
10
+ 'discount_type' => array('title'=>'Discount type','description'=>'fixed_cart OR percent OR fixed_product OR percent_product'),
11
+ 'coupon_amount' => array('title'=>'Coupon amount','description'=>'Numeric values'),
12
+ 'individual_use' => array('title'=>'Individual use only','description'=>'yes or no'),
13
+ 'product_ids' => array('title'=>'Products','description'=>'With comma(,) Separator'),
14
+ 'exclude_product_ids' => array('title'=>'Exclude products','description'=>'With comma(,) Separator'),
 
 
15
  'usage_count' => array('title'=>'No of times used','description'=>'Numeric Values'),
16
+ 'usage_limit' => array('title'=>'Usage limit per coupon','description'=>'Numeric Values'),
17
+ 'usage_limit_per_user' => array('title'=>'Usage limit per user','description'=>'Numeric Values'),
18
+ 'limit_usage_to_x_items' => array('title'=>'Limit usage to X items','description'=>'Maximum Number Of Individual Items This Coupon Can Apply'),
19
+ 'date_expires' => array('title'=>'Expiry date','description'=>'YYYY-MM-DD', 'type' => 'date'),
20
+ 'free_shipping' => array('title'=>'Allow free shipping','description'=>'yes or no'),
21
+ 'exclude_sale_items' => array('title'=>'Exclude sale items','description'=>'yes or no'),
22
+ 'product_categories' => array('title'=>'Product categories','description'=>'with comma(,) Separator'),
23
+ 'exclude_product_categories' => array('title'=>'Exclude categories','description'=>'With comma(,) Separator'),
24
+ 'minimum_amount' => array('title'=>'Minimum amount','description'=>'Numeric'),
25
+ 'maximum_amount' => array('title'=>'Maximum amount','description'=>'Numeric'),
26
+ 'customer_email' => array('title'=>'Allowed emails','description'=>'With comma(,) Separator'),
27
  ));
admin/modules/coupon/export/export.php CHANGED
@@ -191,6 +191,17 @@ class Wt_Import_Export_For_Woo_Basic_Coupon_Export {
191
  continue;
192
  }
193
 
 
 
 
 
 
 
 
 
 
 
 
194
  if('date_expires' == $column && !empty($coupon->$column)){
195
  $row[$column] = date('Y-m-d',$coupon->$column);
196
  continue;
@@ -238,6 +249,7 @@ class Wt_Import_Export_For_Woo_Basic_Coupon_Export {
238
 
239
  $row[$column] = '';
240
  }
 
241
  return apply_filters('hf_alter_coupon_csv_data', $row, $csv_columns);
242
 
243
  }
191
  continue;
192
  }
193
 
194
+ if($column == 'product_categories' || $column == 'exclude_product_categories'){
195
+
196
+ $cpn_product_category_ids = explode(',', $coupon->$column);
197
+ $cpn_product_category_name = array();
198
+ foreach ($cpn_product_category_ids as $cpn_product_category_id) {
199
+ $cpn_product_category_name[] = get_term( $cpn_product_category_id )->name;
200
+ }
201
+ $row[$column] = implode(',', $cpn_product_category_name);
202
+ continue;
203
+ }
204
+
205
  if('date_expires' == $column && !empty($coupon->$column)){
206
  $row[$column] = date('Y-m-d',$coupon->$column);
207
  continue;
249
 
250
  $row[$column] = '';
251
  }
252
+
253
  return apply_filters('hf_alter_coupon_csv_data', $row, $csv_columns);
254
 
255
  }
admin/modules/coupon/import/import.php CHANGED
@@ -235,11 +235,11 @@ class Wt_Import_Export_For_Woo_Basic_Coupon_Import {
235
  continue;
236
  }
237
  if ('product_categories' == $column ) {
238
- $item_data['product_categories'] = $this->wt_explode_values($value,',');
239
  continue;
240
  }
241
  if ('exclude_product_categories' == $column) {
242
- $item_data['excluded_product_categories'] = $this->wt_explode_values($value,',');
243
  continue;
244
  }
245
  if ('minimum_amount' == $column ) {
@@ -658,6 +658,30 @@ class Wt_Import_Export_For_Woo_Basic_Coupon_Import {
658
  }
659
 
660
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
661
  /**
662
  * Parse relative comma-delineated field and return product ID.
663
  *
235
  continue;
236
  }
237
  if ('product_categories' == $column ) {
238
+ $item_data['product_categories'] = $this->wt_parse_product_category_field($value);
239
  continue;
240
  }
241
  if ('exclude_product_categories' == $column) {
242
+ $item_data['excluded_product_categories'] = $this->wt_parse_product_category_field($value);
243
  continue;
244
  }
245
  if ('minimum_amount' == $column ) {
658
  }
659
 
660
 
661
+
662
+ /**
663
+ * Parse category names to IDs.
664
+ *
665
+ * @param string $value Field value.
666
+ *
667
+ * @return array
668
+ */
669
+ public function wt_parse_product_category_field($product_categories) {
670
+ if (empty($product_categories)) {
671
+ return array();
672
+ }
673
+ $cpn_product_categories = explode(',', $product_categories);
674
+ $cpn_product_category_ids = array();
675
+ foreach ($cpn_product_categories as $cpn_product_category_name) {
676
+
677
+ $cpn_product_category_obj = get_term_by( 'name', $cpn_product_category_name, 'product_cat' );
678
+ $cpn_product_category_ids[] = $cpn_product_category_obj->term_id;
679
+
680
+ }
681
+
682
+ return $cpn_product_category_ids;
683
+ }
684
+
685
  /**
686
  * Parse relative comma-delineated field and return product ID.
687
  *
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:'',
9
  to_export_title:'',
10
  export_method:'',
11
  current_step:'',
5
  ajax_data:{},
6
  selected_template:0,
7
  selected_template_name:'',
8
+ to_export:'order',
9
  to_export_title:'',
10
  export_method:'',
11
  current_step:'',
admin/modules/history/history.php CHANGED
@@ -164,7 +164,7 @@ class Wt_Import_Export_For_Woo_Basic_History
164
  }
165
  }else{
166
  $out['status']=1;
167
- $out['html']= sprintf( __( 'Please check the Save import log is enabled under <a target = "_blank" href="%s">settings</a>' ), admin_url('admin.php?page=wt_import_export_for_woo_basic'));
168
  }
169
  }
170
  }
164
  }
165
  }else{
166
  $out['status']=1;
167
+ $out['html']= sprintf( __( 'Please check the Generate import log is enabled under <a target = "_blank" href="%s">settings</a>' ), admin_url('admin.php?page=wt_import_export_for_woo_basic'));
168
  }
169
  }
170
  }
admin/modules/import/assets/js/main.js CHANGED
@@ -5,7 +5,7 @@ var wt_iew_basic_import=(function( $ ) {
5
  ajax_data:{},
6
  selected_template:0,
7
  selected_template_name:'',
8
- to_import:'',
9
  to_import_title:'',
10
  import_method:'',
11
  current_step:'',
@@ -471,7 +471,7 @@ var wt_iew_basic_import=(function( $ ) {
471
  }
472
  }
473
 
474
- if(this.current_step=='method_import' && !this.is_valid_file) /* method import page, then check file validation is done. */
475
  {
476
  if(action_type=='step' && this.is_previous_step(action)) /* step action and previous step */
477
  {
5
  ajax_data:{},
6
  selected_template:0,
7
  selected_template_name:'',
8
+ to_import:'order',
9
  to_import_title:'',
10
  import_method:'',
11
  current_step:'',
471
  }
472
  }
473
 
474
+ if(this.current_step=='method_import') // && !this.is_valid_file) /* method import page, then check file validation is done. */
475
  {
476
  if(action_type=='step' && this.is_previous_step(action)) /* step action and previous step */
477
  {
admin/modules/import/import.php CHANGED
@@ -106,7 +106,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
106
  public function advanced_setting_fields($fields)
107
  {
108
  $fields['enable_import_log']=array(
109
- 'label'=>__("Save Import log"),
110
  'type'=>'radio',
111
  'radio_fields'=>array(
112
  1=>__('Yes'),
@@ -115,7 +115,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
115
  'value' =>1,
116
  'field_name'=>'enable_import_log',
117
  'field_group'=>'advanced_field',
118
- 'help_text'=>__('Save import log as text file and make it available in the history section.'),
119
  'validation_rule'=>array('type'=>'absint'),
120
  );
121
  $import_methods=array_map(function($vl){ return $vl['title']; }, $this->import_methods);
@@ -123,7 +123,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
123
  'label'=>__("Default Import method"),
124
  'type'=>'select',
125
  'sele_vals'=>$import_methods,
126
- 'value' =>'quick',
127
  'field_name'=>'default_import_method',
128
  'field_group'=>'advanced_field',
129
  'help_text'=>__('Select the default method of import.'),
106
  public function advanced_setting_fields($fields)
107
  {
108
  $fields['enable_import_log']=array(
109
+ 'label'=>__("Generate Import log"),
110
  'type'=>'radio',
111
  'radio_fields'=>array(
112
  1=>__('Yes'),
115
  'value' =>1,
116
  'field_name'=>'enable_import_log',
117
  'field_group'=>'advanced_field',
118
+ 'help_text'=>__('Generate import log as text file and make it available in the history section.'),
119
  'validation_rule'=>array('type'=>'absint'),
120
  );
121
  $import_methods=array_map(function($vl){ return $vl['title']; }, $this->import_methods);
123
  'label'=>__("Default Import method"),
124
  'type'=>'select',
125
  'sele_vals'=>$import_methods,
126
+ 'value' =>'new',
127
  'field_name'=>'default_import_method',
128
  'field_group'=>'advanced_field',
129
  'help_text'=>__('Select the default method of import.'),
admin/modules/order/data/data-order-post-columns.php CHANGED
@@ -5,55 +5,58 @@ if (!defined('ABSPATH')) {
5
  }
6
 
7
  return apply_filters('hf_csv_order_post_columns', array(
8
- 'order_id' => 'order_id',
9
- 'order_number' => 'order_number',
10
- 'order_date' => 'order_date',
11
- 'paid_date' => 'paid_date',
12
- 'status' => 'status',
13
- 'shipping_total' => 'shipping_total',
14
- 'shipping_tax_total' => 'shipping_tax_total',
15
- 'fee_total' => 'fee_total',
16
- 'fee_tax_total' => 'fee_tax_total',
17
- 'tax_total' => 'tax_total',
18
- 'cart_discount' => 'cart_discount',
19
- 'order_discount' => 'order_discount',
20
- 'discount_total' => 'discount_total',
21
- 'order_total' => 'order_total',
22
  //'refunded_total' => 'refunded_total',
23
- 'order_currency' => 'order_currency',
24
- 'payment_method' => 'payment_method',
25
- 'payment_method_title' => 'payment_method_title',
26
- 'shipping_method' => 'shipping_method',
27
- 'customer_id' => 'customer_id',
28
- 'customer_user' => 'customer_user',
29
- 'customer_email' => 'customer_email',
30
- 'billing_first_name' => 'billing_first_name',
31
- 'billing_last_name' => 'billing_last_name',
32
- 'billing_company' => 'billing_company',
33
- 'billing_email' => 'billing_email',
34
- 'billing_phone' => 'billing_phone',
35
- 'billing_address_1' => 'billing_address_1',
36
- 'billing_address_2' => 'billing_address_2',
37
- 'billing_postcode' => 'billing_postcode',
38
- 'billing_city' => 'billing_city',
39
- 'billing_state' => 'billing_state',
40
- 'billing_country' => 'billing_country',
41
- 'shipping_first_name' => 'shipping_first_name',
42
- 'shipping_last_name' => 'shipping_last_name',
43
- 'shipping_company' => 'shipping_company',
44
- 'shipping_address_1' => 'shipping_address_1',
45
- 'shipping_address_2' => 'shipping_address_2',
46
- 'shipping_postcode' => 'shipping_postcode',
47
- 'shipping_city' => 'shipping_city',
48
- 'shipping_state' => 'shipping_state',
49
- 'shipping_country' => 'shipping_country',
50
- 'customer_note' => 'customer_note',
 
 
 
51
  'wt_import_key' => 'wt_import_key',
52
- 'shipping_items' => 'shipping_items',
53
- 'fee_items' => 'fee_items',
54
- 'tax_items' => 'tax_items',
55
- 'coupon_items' => 'coupon_items',
56
- 'refund_items' => 'refund_items',
57
- 'order_notes' => 'order_notes',
58
- 'download_permissions' => 'download_permissions'
59
  ));
5
  }
6
 
7
  return apply_filters('hf_csv_order_post_columns', array(
8
+ 'order_id' => 'ID',
9
+ 'order_number' => 'Order number',
10
+ 'order_date' => 'Order date',
11
+ 'paid_date' => 'Paid date',
12
+ 'status' => 'Status',
13
+ 'shipping_total' => 'Shipping total',
14
+ 'shipping_tax_total' => 'Shipping tax total',
15
+ 'fee_total' => 'Fee total',
16
+ 'fee_tax_total' => 'Fee tax total',
17
+ 'tax_total' => 'Tax total',
18
+ 'cart_discount' => 'Cart discount',
19
+ 'order_discount' => 'Order discount',
20
+ 'discount_total' => 'Discount total',
21
+ 'order_total' => 'Order total',
22
  //'refunded_total' => 'refunded_total',
23
+ 'order_currency' => 'Order currency',
24
+ 'payment_method' => 'Payment method',
25
+ 'payment_method_title' => 'Payment method title',
26
+ 'transaction_id' => 'Transaction ID',
27
+ 'customer_ip_address' => 'Customer IP address',
28
+ 'customer_user_agent' => 'Customer user agent',
29
+ 'shipping_method' => 'Shipping method',
30
+ 'customer_id' => 'Customer ID',
31
+ 'customer_user' => 'Customer user',
32
+ 'customer_email' => 'Customer email',
33
+ 'billing_first_name' => 'Billing first name',
34
+ 'billing_last_name' => 'Billing last name',
35
+ 'billing_company' => 'Billing company',
36
+ 'billing_email' => 'Billing email',
37
+ 'billing_phone' => 'Billing phone',
38
+ 'billing_address_1' => 'Billing address 1',
39
+ 'billing_address_2' => 'Billing address 2',
40
+ 'billing_postcode' => 'Billing postcode',
41
+ 'billing_city' => 'Billing city',
42
+ 'billing_state' => 'Billing state',
43
+ 'billing_country' => 'Billing country',
44
+ 'shipping_first_name' => 'Shipping first name',
45
+ 'shipping_last_name' => 'Shipping last name',
46
+ 'shipping_company' => 'Shipping company',
47
+ 'shipping_address_1' => 'Shipping address 1',
48
+ 'shipping_address_2' => 'Shipping address 2',
49
+ 'shipping_postcode' => 'Shipping postcode',
50
+ 'shipping_city' => 'Shipping city',
51
+ 'shipping_state' => 'Shipping state',
52
+ 'shipping_country' => 'Shipping country',
53
+ 'customer_note' => 'Customer note',
54
  'wt_import_key' => 'wt_import_key',
55
+ 'shipping_items' => 'Shipping items',
56
+ 'fee_items' => 'Fee items',
57
+ 'tax_items' => 'Tax items',
58
+ 'coupon_items' => 'Coupon items',
59
+ 'refund_items' => 'Refund items',
60
+ 'order_notes' => 'Order notes',
61
+ 'download_permissions' => 'Download permissions'
62
  ));
admin/modules/order/data/data/data-wf-reserved-fields-pair.php CHANGED
@@ -2,55 +2,58 @@
2
 
3
  // Reserved column names
4
  return apply_filters('woocommerce_csv_order_reserved_fields_pair',array(
5
- 'order_id' => array('title'=>'Order ID ','description'=>'Order ID '),
6
- 'order_number' => array('title'=>'Order Number','description'=>'Order Number'),
7
- 'order_date' => array('title'=>'Order Date','description'=>'Order Date', 'type' => 'date'),
8
- 'paid_date' => array('title'=>'Paid Date','description'=>'Paid Date', 'type' => 'date'),
9
- 'status' => array('title'=>'Order Status','description'=>'Order Status ( processing , pending ...) '),
10
- 'shipping_total' => array('title'=>'Shipping Total','description'=>'Shipping Total amount'),
11
- 'shipping_tax_total' => array('title'=>'Shipping Tax Total','description'=>'Shipping Tax Total'),
12
- 'fee_total' => array('title'=>'Total Fee','description'=>'Total Fee'),
13
- 'fee_tax_total' => array('title'=>'Total Tax Fee','description'=>'Total Tax Fee'),
14
- 'tax_total' => array('title'=>'Total Tax','description'=>'Total Tax'),
15
- 'cart_discount' => array('title'=>'Cart Discount','description'=>'Cart Discount'),
16
- 'order_discount' => array('title'=>'Order Discount','description'=>'Order Discount'),
17
- 'discount_total' => array('title'=>'Discount Total','description'=>'Discount Total'),
18
- 'order_total' => array('title'=>'Order Total','description'=>'Order Total'),
19
  //'refunded_total' => array('title'=>'refunded_total','description'=>'refunded_total'),
20
- 'order_currency' => array('title'=>'order_currency','description'=>'Order Currency'),
21
- 'payment_method' => array('title'=>'payment_method','description'=>'Payment Method'),
22
- 'payment_method_title' => array('title'=>'payment_method_title','description'=>'Payment Method Title'),
23
- 'shipping_method' => array('title'=>'shipping_method','description'=>'Shipping Method'),
24
- 'customer_email' => array('title'=>'customer_email','description'=>'Customer Email ( if not provided order will be created as Guest)'),
25
- 'customer_user' => array('title'=>'customer_user','description'=>'Customer id ( if not provided order will be created as Guest)'),
26
- 'billing_first_name' => array('title'=>'billing_first_name','description'=>'billing_first_name'),
27
- 'billing_last_name' => array('title'=>'billing_last_name','description'=>'billing_last_name'),
28
- 'billing_company' => array('title'=>'billing_company','description'=>'billing_company'),
29
- 'billing_email' => array('title'=>'billing_email','description'=>'billing_email'),
30
- 'billing_phone' => array('title'=>'billing_phone','description'=>'billing_phone'),
31
- 'billing_address_1' => array('title'=>'billing_address_1','description'=>'billing_address_1'),
32
- 'billing_address_2' => array('title'=>'billing_address_2','description'=>'billing_address_2'),
33
- 'billing_postcode' => array('title'=>'billing_postcode','description'=>'billing_postcode'),
34
- 'billing_city' => array('title'=>'billing_city','description'=>'billing_city'),
35
- 'billing_state' => array('title'=>'billing_state','description'=>'billing_state'),
36
- 'billing_country' => array('title'=>'billing_country','description'=>'billing_country'),
37
- 'shipping_first_name' => array('title'=>'shipping_first_name','description'=>'shipping_first_name'),
38
- 'shipping_last_name' => array('title'=>'shipping_last_name','description'=>'shipping_last_name'),
39
- 'shipping_company' => array('title'=>'shipping_company','description'=>'shipping_company'),
40
- 'shipping_address_1' => array('title'=>'shipping_address_1','description'=>'shipping_address_1'),
41
- 'shipping_address_2' => array('title'=>'shipping_address_2','description'=>'shipping_address_2'),
42
- 'shipping_postcode' => array('title'=>'shipping_postcode','description'=>'shipping_postcode'),
43
- 'shipping_city' => array('title'=>'shipping_city','description'=>'shipping_city'),
44
- 'shipping_state' => array('title'=>'shipping_state','description'=>'shipping_state'),
45
- 'shipping_country' => array('title'=>'shipping_country','description'=>'shipping_country'),
46
- 'customer_note' => array('title'=>'customer_note','description'=>'customer_note'),
47
- 'wt_import_key' => array('title'=>'wt_import_key','description'=>'wt_import_key'),
48
- 'shipping_items' => array('title'=>'shipping_items','description'=>'shipping_items'),
49
- 'fee_items' => array('title'=>'fee_items','description'=>'fee_items'),
50
- 'tax_items' => array('title'=>'tax_items','description'=>'tax_items'),
51
- 'coupon_items' => array('title'=>'coupon_items','description'=>'coupons'),
52
- 'refund_items' => array('title'=>'refund_items','description'=>'refund_items'),
53
- 'order_notes' => array('title'=>'order_notes','description'=>'Order notes'),
54
- 'line_item_' => array('title'=>'line_item_','description'=>'Line Items','field_type'=>'start_with'),
55
- 'download_permissions' => array('title'=>'Downloadable Product Permissions ','description'=>'Permissions for order items will automatically be granted when the order status changes to processing or completed.'),
 
 
 
56
  ));
2
 
3
  // Reserved column names
4
  return apply_filters('woocommerce_csv_order_reserved_fields_pair',array(
5
+ 'order_id' => array('title'=>'ID ','description'=>'Order ID '),
6
+ 'order_number' => array('title'=>'Order number','description'=>'Order Number'),
7
+ 'order_date' => array('title'=>'Order date','description'=>'Order Date', 'type' => 'date'),
8
+ 'paid_date' => array('title'=>'Paid date','description'=>'Paid Date', 'type' => 'date'),
9
+ 'status' => array('title'=>'Status','description'=>'Order Status ( processing , pending ...) '),
10
+ 'shipping_total' => array('title'=>'Shipping total','description'=>'Shipping Total amount'),
11
+ 'shipping_tax_total' => array('title'=>'Shipping tax total','description'=>'Shipping Tax Total'),
12
+ 'fee_total' => array('title'=>'Total fee','description'=>'Total Fee'),
13
+ 'fee_tax_total' => array('title'=>'Total tax fee','description'=>'Total Tax Fee'),
14
+ 'tax_total' => array('title'=>'Total tax','description'=>'Total Tax'),
15
+ 'cart_discount' => array('title'=>'Cart discount','description'=>'Cart Discount'),
16
+ 'order_discount' => array('title'=>'Order discount','description'=>'Order Discount'),
17
+ 'discount_total' => array('title'=>'Discount total','description'=>'Discount Total'),
18
+ 'order_total' => array('title'=>'Order total','description'=>'Order Total'),
19
  //'refunded_total' => array('title'=>'refunded_total','description'=>'refunded_total'),
20
+ 'order_currency' => array('title'=>'Order currency','description'=>'Order Currency'),
21
+ 'payment_method' => array('title'=>'Payment method','description'=>'Payment Method'),
22
+ 'payment_method_title' => array('title'=>'Payment method title','description'=>'Payment Method Title'),
23
+ 'transaction_id' => array('title'=>'Transaction ID','description'=>'Payment transaction id'),
24
+ 'customer_ip_address' => array('title'=>'Customer IP address','description'=>'Customer ip address'),
25
+ 'customer_user_agent' => array('title'=>'Customer user agent','description'=>'Customer user agent'),
26
+ 'shipping_method' => array('title'=>'Shipping method','description'=>'Shipping Method'),
27
+ 'customer_email' => array('title'=>'Customer email','description'=>'Customer Email ( if not provided order will be created as Guest)'),
28
+ 'customer_user' => array('title'=>'Customer user','description'=>'Customer id ( if not provided order will be created as Guest)'),
29
+ 'billing_first_name' => array('title'=>'Billing first name','description'=>'billing_first_name'),
30
+ 'billing_last_name' => array('title'=>'Billing last name','description'=>'billing_last_name'),
31
+ 'billing_company' => array('title'=>'Billing company','description'=>'billing_company'),
32
+ 'billing_email' => array('title'=>'Billing email','description'=>'billing_email'),
33
+ 'billing_phone' => array('title'=>'Billing phone','description'=>'billing_phone'),
34
+ 'billing_address_1' => array('title'=>'Billing address 1','description'=>'billing_address_1'),
35
+ 'billing_address_2' => array('title'=>'Billing address 2','description'=>'billing_address_2'),
36
+ 'billing_postcode' => array('title'=>'Billing postcode','description'=>'billing_postcode'),
37
+ 'billing_city' => array('title'=>'Billing city','description'=>'billing_city'),
38
+ 'billing_state' => array('title'=>'Billing state','description'=>'billing_state'),
39
+ 'billing_country' => array('title'=>'Billing country','description'=>'billing_country'),
40
+ 'shipping_first_name' => array('title'=>'Shipping first name','description'=>'shipping_first_name'),
41
+ 'shipping_last_name' => array('title'=>'Shipping last name','description'=>'shipping_last_name'),
42
+ 'shipping_company' => array('title'=>'Shipping company','description'=>'shipping_company'),
43
+ 'shipping_address_1' => array('title'=>'Shipping address 1','description'=>'shipping_address_1'),
44
+ 'shipping_address_2' => array('title'=>'Shipping address 2','description'=>'shipping_address_2'),
45
+ 'shipping_postcode' => array('title'=>'Shipping_ ostcode','description'=>'shipping_postcode'),
46
+ 'shipping_city' => array('title'=>'Shipping city','description'=>'shipping_city'),
47
+ 'shipping_state' => array('title'=>'Shipping state','description'=>'shipping_state'),
48
+ 'shipping_country' => array('title'=>'Shipping country','description'=>'shipping_country'),
49
+ 'customer_note' => array('title'=>'Customer note','description'=>'customer_note'),
50
+ 'wt_import_key' => array('title'=>'wt_impor_key','description'=>'wt_import_key'),
51
+ 'shipping_items' => array('title'=>'Shipping items','description'=>'shipping_items'),
52
+ 'fee_items' => array('title'=>'Fee items','description'=>'fee_items'),
53
+ 'tax_items' => array('title'=>'Tax items','description'=>'tax_items'),
54
+ 'coupon_items' => array('title'=>'Coupon items','description'=>'coupons'),
55
+ 'refund_items' => array('title'=>'Refund items','description'=>'refund_items'),
56
+ 'order_notes' => array('title'=>'Order notes','description'=>'Order notes'),
57
+ 'line_item_' => array('title'=>'Line_item_','description'=>'Line Items','field_type'=>'start_with'),
58
+ 'download_permissions' => array('title'=>'Downloadable product permissions ','description'=>'Permissions for order items will automatically be granted when the order status changes to processing or completed.'),
59
  ));
admin/modules/order/export/export.php CHANGED
@@ -435,7 +435,7 @@ class Wt_Import_Export_For_Woo_Basic_Order_Export {
435
  $item_meta = self::get_order_line_item_meta($item_id);
436
  foreach ($item_meta as $key => $value) {
437
  switch ($key) {
438
- case 'Items':
439
  case 'method_id':
440
  case 'taxes':
441
  if (is_object($value))
@@ -446,12 +446,12 @@ class Wt_Import_Export_For_Woo_Basic_Order_Export {
446
  break;
447
  }
448
  }
449
- foreach (array('Items', 'method_id', 'taxes') as $value) {
450
  if (!isset($meta[$value])) {
451
  $meta[$value] = '';
452
  }
453
  }
454
- $shipping_items[] = trim(implode('|', array('items:' . $meta['Items'], 'method_id:' . $meta['method_id'], 'taxes:' . $meta['taxes'])));
455
  }
456
 
457
  //get fee and total
@@ -539,7 +539,10 @@ class Wt_Import_Export_For_Woo_Basic_Order_Export {
539
  'order_total' => wc_format_decimal($order->get_total(), 2),
540
  'order_currency' => $order->get_order_currency(),
541
  'payment_method' => $order->payment_method,
542
- 'payment_method' => $order->payment_method_title,
 
 
 
543
  'shipping_method' => $order->get_shipping_method(),
544
  'customer_id' => $order->get_user_id(),
545
  'customer_user' => $order->get_user_id(),
@@ -580,7 +583,7 @@ class Wt_Import_Export_For_Woo_Basic_Order_Export {
580
  'order_id' => $order->get_id(),
581
  'order_number' => $order->get_order_number(),
582
  'order_date' => date('Y-m-d H:i:s', strtotime(get_post($order->get_id())->post_date)),
583
- 'paid_date' => isset($paid_date) ? date('Y-m-d H:i:s', strtotime($paid_date)) : '',
584
  'status' => $order->get_status(),
585
  'shipping_total' => $order->get_total_shipping(),
586
  'shipping_tax_total' => wc_format_decimal($order->get_shipping_tax(), 2),
@@ -594,6 +597,9 @@ class Wt_Import_Export_For_Woo_Basic_Order_Export {
594
  'order_currency' => $order->get_currency(),
595
  'payment_method' => $order->get_payment_method(),
596
  'payment_method_title' => $order->get_payment_method_title(),
 
 
 
597
  'shipping_method' => $order->get_shipping_method(),
598
  'customer_id' => $order->get_user_id(),
599
  'customer_user' => $order->get_user_id(),
@@ -626,7 +632,7 @@ class Wt_Import_Export_For_Woo_Basic_Order_Export {
626
  'coupon_items' => implode(';', $coupon_items),
627
  'refund_items' => implode(';', $refund_items),
628
  'order_notes' => implode('||', (defined('WC_VERSION') && (WC_VERSION >= 3.2)) ? self::get_order_notes_new($order) : self::get_order_notes($order)),
629
- 'download_permissions' => $order->is_download_permitted() ? $order->is_download_permitted() : 0,
630
  );
631
  }
632
 
@@ -722,6 +728,16 @@ class Wt_Import_Export_For_Woo_Basic_Order_Export {
722
  if ($export_order_statuses != 'any') {
723
  $query .= " AND po.post_status IN ( '" . implode("','", $export_order_statuses) . "' )";
724
  }
 
 
 
 
 
 
 
 
 
 
725
  if ($exclude_already_exported) {
726
  $query .= " AND pm.meta_key = 'wf_order_exported_status' AND pm.meta_value=1";
727
  }
435
  $item_meta = self::get_order_line_item_meta($item_id);
436
  foreach ($item_meta as $key => $value) {
437
  switch ($key) {
438
+ case 'Items':
439
  case 'method_id':
440
  case 'taxes':
441
  if (is_object($value))
446
  break;
447
  }
448
  }
449
+ foreach (array('Items','method_id', 'taxes') as $value) {
450
  if (!isset($meta[$value])) {
451
  $meta[$value] = '';
452
  }
453
  }
454
+ $shipping_items[] = trim(implode('|', array('items:' . $meta['Items'],'method_id:' . $meta['method_id'], 'taxes:' . $meta['taxes'])));
455
  }
456
 
457
  //get fee and total
539
  'order_total' => wc_format_decimal($order->get_total(), 2),
540
  'order_currency' => $order->get_order_currency(),
541
  'payment_method' => $order->payment_method,
542
+ 'payment_method_title' => $order->payment_method_title,
543
+ 'transaction_id' => $order->transaction_id,
544
+ 'customer_ip_address' => $order->customer_ip_address,
545
+ 'customer_user_agent' => $order->customer_user_agent,
546
  'shipping_method' => $order->get_shipping_method(),
547
  'customer_id' => $order->get_user_id(),
548
  'customer_user' => $order->get_user_id(),
583
  'order_id' => $order->get_id(),
584
  'order_number' => $order->get_order_number(),
585
  'order_date' => date('Y-m-d H:i:s', strtotime(get_post($order->get_id())->post_date)),
586
+ 'paid_date' => $paid_date, //isset($paid_date) ? date('Y-m-d H:i:s', strtotime($paid_date)) : '',
587
  'status' => $order->get_status(),
588
  'shipping_total' => $order->get_total_shipping(),
589
  'shipping_tax_total' => wc_format_decimal($order->get_shipping_tax(), 2),
597
  'order_currency' => $order->get_currency(),
598
  'payment_method' => $order->get_payment_method(),
599
  'payment_method_title' => $order->get_payment_method_title(),
600
+ 'transaction_id' => $order->get_transaction_id(),
601
+ 'customer_ip_address' => $order->get_customer_ip_address(),
602
+ 'customer_user_agent' => $order->get_customer_user_agent(),
603
  'shipping_method' => $order->get_shipping_method(),
604
  'customer_id' => $order->get_user_id(),
605
  'customer_user' => $order->get_user_id(),
632
  'coupon_items' => implode(';', $coupon_items),
633
  'refund_items' => implode(';', $refund_items),
634
  'order_notes' => implode('||', (defined('WC_VERSION') && (WC_VERSION >= 3.2)) ? self::get_order_notes_new($order) : self::get_order_notes($order)),
635
+ 'download_permissions' => $order->is_download_permitted() ? $order->is_download_permitted() : 0,
636
  );
637
  }
638
 
728
  if ($export_order_statuses != 'any') {
729
  $query .= " AND po.post_status IN ( '" . implode("','", $export_order_statuses) . "' )";
730
  }
731
+ if ($export_order_statuses == 'any') {
732
+ $defualt_exclude_status = get_post_stati(array('exclude_from_search' => true));
733
+ $stati = array_values(get_post_stati());
734
+ foreach ($stati as $key => $status) {
735
+ if (in_array($status, $defualt_exclude_status, true)) {
736
+ unset($stati[$key]);
737
+ }
738
+ }
739
+ $query .= " AND po.post_status IN ( '" . implode("','", $stati) . "' )";
740
+ }
741
  if ($exclude_already_exported) {
742
  $query .= " AND pm.meta_key = 'wf_order_exported_status' AND pm.meta_value=1";
743
  }
admin/modules/order/import/import.php CHANGED
@@ -196,7 +196,18 @@ class Wt_Import_Export_For_Woo_Basic_Order_Import {
196
  $this->item_data['payment_method_title'] = $value;
197
  continue;
198
  }
199
-
 
 
 
 
 
 
 
 
 
 
 
200
  if ( 'date_created' == $column || 'post_date' == $column || 'order_date' == $column) {
201
  $date = $this->wt_parse_date_field($value,$column);
202
  $this->item_data['date_created'] = date('Y-m-d H:i:s', $date);
@@ -408,7 +419,14 @@ class Wt_Import_Export_For_Woo_Basic_Order_Import {
408
 
409
  if(empty($this->item_data['order_id'])){
410
  $this->item_data['order_id'] = $this->wt_parse_id_field($mapping_fields,$this->item_data);
411
- }
 
 
 
 
 
 
 
412
 
413
  return $this->item_data;
414
  } catch (Exception $e) {
@@ -816,7 +834,7 @@ class Wt_Import_Export_For_Woo_Basic_Order_Import {
816
  $shipping_items = array(
817
  'Items' => $items,
818
  'method_id' => $method_id,
819
- 'taxes' => $taxes
820
  );
821
  }
822
 
@@ -1375,17 +1393,15 @@ class Wt_Import_Export_For_Woo_Basic_Order_Import {
1375
  }
1376
 
1377
  public function process_item($data) {
 
1378
  try {
1379
  global $wpdb;
1380
  do_action('wt_woocommerce_order_import_before_process_item', $data);
1381
  $data = apply_filters('wt_woocommerce_order_import_process_item', $data);
1382
 
1383
  $post_id = $data['order_id'];
1384
-
1385
- $status = isset($data['status']) ? $data['status'] : 'wc-pending';
1386
- if($this->merge){
1387
- $status = isset($data['status']) ? $data['status'] : '';
1388
- }
1389
 
1390
 
1391
  // wc_create_order(); woocommerce/includes/wc-core-function.php:83 -> $order = new WC_Order(); woocommerce/includes/class-wc-order.php:16 -> $order->save();
@@ -1430,7 +1446,9 @@ class Wt_Import_Export_For_Woo_Basic_Order_Import {
1430
  $order_id = $order->get_id();
1431
  }
1432
 
 
1433
  $order->set_address($data['billing'], 'billing');
 
1434
  $order->set_address($data['shipping'], 'shipping');
1435
 
1436
  $order->set_prices_include_tax( 'yes' === get_option( 'woocommerce_prices_include_tax' ) );
@@ -1714,7 +1732,7 @@ class Wt_Import_Export_For_Woo_Basic_Order_Import {
1714
 
1715
 
1716
  $this->set_meta_data($order, $data);
1717
-
1718
  if($this->status_mail == true){
1719
  $order->update_status('wc-' . preg_replace('/^wc-/', '', $status));
1720
  } else {
@@ -1899,7 +1917,7 @@ class Wt_Import_Export_For_Woo_Basic_Order_Import {
1899
  function set_meta_data(&$object, $data) {
1900
  if (isset($data['meta_data'])) {
1901
  $order_id = $object->get_id();
1902
- $add_download_permissions = false;
1903
  foreach ($data['meta_data'] as $meta) {
1904
  if (( 'Download Permissions Granted' == $meta['key'] || '_download_permissions_granted' == $meta['key'] ) && $meta['value']) {
1905
  $add_download_permissions = true;
@@ -1916,13 +1934,10 @@ class Wt_Import_Export_For_Woo_Basic_Order_Import {
1916
 
1917
  $object->update_meta_data($meta['key'], $meta['value']);
1918
  }
1919
-
1920
  // Grant downloadalbe product permissions
1921
  if ($add_download_permissions) {
1922
- wc_downloadable_product_permissions($order_id);
1923
- $next_update = get_post_meta( $order_id, '_wt_import_key');
1924
- $force_update = isset($next_update) ? FALSE : TRUE;
1925
- $force = apply_filters('wt_force_update_downloadalbe_product_permissions', $force_update);
1926
  wc_downloadable_product_permissions($order_id, $force);
1927
 
1928
  }
@@ -1941,7 +1956,9 @@ class Wt_Import_Export_For_Woo_Basic_Order_Import {
1941
  remove_action( 'woocommerce_order_status_failed_to_completed_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
1942
  remove_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
1943
  remove_action( 'woocommerce_order_status_failed_to_pending_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
1944
-
 
 
1945
  // Processing emails
1946
  remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
1947
  remove_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
196
  $this->item_data['payment_method_title'] = $value;
197
  continue;
198
  }
199
+ if ('transaction_id' == $column ) {
200
+ $this->item_data['transaction_id'] = $value;
201
+ continue;
202
+ }
203
+ if ('customer_ip_address' == $column ) {
204
+ $this->item_data['customer_ip_address'] = $value;
205
+ continue;
206
+ }
207
+ if ('customer_user_agent' == $column) {
208
+ $this->item_data['customer_user_agent'] = $value;
209
+ continue;
210
+ }
211
  if ( 'date_created' == $column || 'post_date' == $column || 'order_date' == $column) {
212
  $date = $this->wt_parse_date_field($value,$column);
213
  $this->item_data['date_created'] = date('Y-m-d H:i:s', $date);
419
 
420
  if(empty($this->item_data['order_id'])){
421
  $this->item_data['order_id'] = $this->wt_parse_id_field($mapping_fields,$this->item_data);
422
+ }
423
+
424
+ if (empty($this->item_data['status'])) {
425
+ if ($this->item_data['order_id'] > 0) {
426
+ $ord = wc_get_order($this->item_data['order_id']);
427
+ $this->item_data['status'] = preg_replace('/^wc-/', '', $ord->get_status());
428
+ }
429
+ }
430
 
431
  return $this->item_data;
432
  } catch (Exception $e) {
834
  $shipping_items = array(
835
  'Items' => $items,
836
  'method_id' => $method_id,
837
+ 'taxes' => maybe_unserialize($taxes)
838
  );
839
  }
840
 
1393
  }
1394
 
1395
  public function process_item($data) {
1396
+
1397
  try {
1398
  global $wpdb;
1399
  do_action('wt_woocommerce_order_import_before_process_item', $data);
1400
  $data = apply_filters('wt_woocommerce_order_import_process_item', $data);
1401
 
1402
  $post_id = $data['order_id'];
1403
+
1404
+ $status = !empty($data['status']) ? $data['status'] : 'wc-pending';
 
 
 
1405
 
1406
 
1407
  // wc_create_order(); woocommerce/includes/wc-core-function.php:83 -> $order = new WC_Order(); woocommerce/includes/class-wc-order.php:16 -> $order->save();
1446
  $order_id = $order->get_id();
1447
  }
1448
 
1449
+ if(isset($data['billing']))
1450
  $order->set_address($data['billing'], 'billing');
1451
+ if(isset($data['shipping']))
1452
  $order->set_address($data['shipping'], 'shipping');
1453
 
1454
  $order->set_prices_include_tax( 'yes' === get_option( 'woocommerce_prices_include_tax' ) );
1732
 
1733
 
1734
  $this->set_meta_data($order, $data);
1735
+
1736
  if($this->status_mail == true){
1737
  $order->update_status('wc-' . preg_replace('/^wc-/', '', $status));
1738
  } else {
1917
  function set_meta_data(&$object, $data) {
1918
  if (isset($data['meta_data'])) {
1919
  $order_id = $object->get_id();
1920
+ $add_download_permissions = false;
1921
  foreach ($data['meta_data'] as $meta) {
1922
  if (( 'Download Permissions Granted' == $meta['key'] || '_download_permissions_granted' == $meta['key'] ) && $meta['value']) {
1923
  $add_download_permissions = true;
1934
 
1935
  $object->update_meta_data($meta['key'], $meta['value']);
1936
  }
1937
+
1938
  // Grant downloadalbe product permissions
1939
  if ($add_download_permissions) {
1940
+ $force = apply_filters('wt_force_update_downloadalbe_product_permissions', true);
 
 
 
1941
  wc_downloadable_product_permissions($order_id, $force);
1942
 
1943
  }
1956
  remove_action( 'woocommerce_order_status_failed_to_completed_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
1957
  remove_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
1958
  remove_action( 'woocommerce_order_status_failed_to_pending_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
1959
+ remove_action( 'woocommerce_order_status_cancelled_to_completed_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
1960
+ remove_action( 'woocommerce_order_status_cancelled_to_processing_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
1961
+
1962
  // Processing emails
1963
  remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
1964
  remove_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
assets/images/webtoffee-logo_small.png ADDED
Binary file
class-wt-order-review-request.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Review request
5
+ *
6
+ *
7
+ * @package Cookie_Law_Info
8
+ */
9
+ if (!defined('ABSPATH')) {
10
+ exit;
11
+ }
12
+ class Order_Import_Export_Review_Request
13
+ {
14
+ /**
15
+ * config options
16
+ */
17
+ private $plugin_title = "Order / Coupon / Subscription Export Import Plugin for WooCommerce (BASIC)";
18
+ private $review_url = "https://wordpress.org/support/plugin/order-import-export-for-woocommerce/reviews/#new-post";
19
+ private $plugin_prefix = "wt_o_iew_basic"; /* must be unique name */
20
+ private $activation_hook = "wt_o_iew_basic_activate"; /* hook for activation, to store activated date */
21
+ private $deactivation_hook = "wt_o_iew_basic_deactivate"; /* hook for deactivation, to delete activated date */
22
+ private $days_to_show_banner = 7; /* when did the banner to show */
23
+ private $remind_days = 5; /* remind interval in days */
24
+ private $webtoffee_logo_url = WT_O_IEW_PLUGIN_URL.'assets/images/webtoffee-logo_small.png';
25
+
26
+
27
+
28
+ private $start_date = 0; /* banner to show count start date. plugin installed date, remind me later added date */
29
+ private $current_banner_state = 2; /* 1: active, 2: waiting to show(first after installation), 3: closed by user/not interested to review, 4: user done the review, 5:remind me later */
30
+ private $banner_state_option_name = ''; /* WP option name to save banner state */
31
+ private $start_date_option_name = ''; /* WP option name to save start date */
32
+ private $banner_css_class = ''; /* CSS class name for Banner HTML element. */
33
+ private $banner_message = ''; /* Banner message. */
34
+ private $later_btn_text = ''; /* Remind me later button text */
35
+ private $never_btn_text = ''; /* Never review button text. */
36
+ private $review_btn_text = ''; /* Review now button text. */
37
+ private $ajax_action_name = ''; /* Name of ajax action to save banner state. */
38
+ private $allowed_action_type_arr = array(
39
+ 'later', /* remind me later */
40
+ 'never', /* never */
41
+ 'review', /* review now */
42
+ 'closed', /* not interested */
43
+ );
44
+
45
+ public function __construct()
46
+ {
47
+ //Set config vars
48
+ $this->set_vars();
49
+
50
+ add_action($this->activation_hook, array($this, 'on_activate'));
51
+ add_action($this->deactivation_hook, array($this, 'on_deactivate'));
52
+
53
+ if ($this->check_condition()) /* checks the banner is active now */ {
54
+ $this->banner_message = sprintf(__("Hey, we at %sWebToffee%s would like to thank you for using our plugin. We would really appreciate if you could take a moment to drop a quick review that will inspire us to keep going."), '<b>', '</b>');
55
+
56
+ /* button texts */
57
+ $this->later_btn_text = __("Remind me later");
58
+ $this->never_btn_text = __("Not interested");
59
+ $this->review_btn_text = __("Review now");
60
+
61
+ add_action('admin_notices', array($this, 'show_banner')); /* show banner */
62
+ add_action('admin_print_footer_scripts', array($this, 'add_banner_scripts')); /* add banner scripts */
63
+ add_action('wp_ajax_' . $this->ajax_action_name, array($this, 'process_user_action')); /* process banner user action */
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Set config vars
69
+ */
70
+ public function set_vars()
71
+ {
72
+ $this->ajax_action_name = $this->plugin_prefix . '_process_user_review_action';
73
+ $this->banner_state_option_name = $this->plugin_prefix . "_review_request";
74
+ $this->start_date_option_name = $this->plugin_prefix . "_start_date";
75
+ $this->banner_css_class = $this->plugin_prefix . "_review_request";
76
+
77
+ $this->start_date = absint(get_option($this->start_date_option_name));
78
+ $banner_state = absint(get_option($this->banner_state_option_name));
79
+ $this->current_banner_state = ($banner_state == 0 ? $this->current_banner_state : $banner_state);
80
+ }
81
+
82
+ /**
83
+ * Actions on plugin activation
84
+ * Saves activation date
85
+ */
86
+ public function on_activate()
87
+ {
88
+ $this->reset_start_date();
89
+ }
90
+
91
+ /**
92
+ * Actions on plugin deactivation
93
+ * Removes activation date
94
+ */
95
+ public function on_deactivate()
96
+ {
97
+ delete_option($this->start_date_option_name);
98
+ }
99
+
100
+ /**
101
+ * Reset the start date.
102
+ */
103
+ private function reset_start_date()
104
+ {
105
+ update_option($this->start_date_option_name, time());
106
+ }
107
+
108
+ /**
109
+ * Update the banner state
110
+ */
111
+ private function update_banner_state($val)
112
+ {
113
+ update_option($this->banner_state_option_name, $val);
114
+ }
115
+
116
+ /**
117
+ * Prints the banner
118
+ */
119
+ public function show_banner()
120
+ {
121
+ $this->update_banner_state(1); /* update banner active state */
122
+ ?>
123
+ <div class="<?php echo $this->banner_css_class; ?> notice-info notice is-dismissible">
124
+ <?php
125
+ if ($this->webtoffee_logo_url != "") {
126
+ ?>
127
+ <h3 style="margin: 10px 0;"><?php echo $this->plugin_title; ?></h3>
128
+ <?php
129
+ }
130
+ ?>
131
+ <p>
132
+ <?php echo $this->banner_message; ?>
133
+ </p>
134
+ <p>
135
+ <a class="button button-secondary" style="color:#333; border-color:#ccc; background:#efefef;" data-type="later"><?php echo $this->later_btn_text; ?></a>
136
+ <a class="button button-primary" data-type="review"><?php echo $this->review_btn_text; ?></a>
137
+ </p>
138
+ <div class="wt-cli-review-footer" style="position: relative;">
139
+ <span class="wt-cli-footer-icon" style="position: absolute;right: 0;bottom: 10px;"><img src="<?php echo $this->webtoffee_logo_url; ?>" style="max-width:100px;"></span>
140
+ </div>
141
+ </div>
142
+ <?php
143
+ }
144
+
145
+ /**
146
+ * Ajax hook to process user action on the banner
147
+ */
148
+ public function process_user_action()
149
+ {
150
+ check_ajax_referer($this->plugin_prefix);
151
+ if (isset($_POST['wt_review_action_type'])) {
152
+ $action_type = sanitize_text_field($_POST['wt_review_action_type']);
153
+
154
+ /* current action is in allowed action list */
155
+ if (in_array($action_type, $this->allowed_action_type_arr)) {
156
+ if ($action_type == 'never' || $action_type == 'closed') {
157
+ $new_banner_state = 3;
158
+ } elseif ($action_type == 'review') {
159
+ $new_banner_state = 4;
160
+ } else {
161
+ /* reset start date to current date */
162
+ $this->reset_start_date();
163
+ $new_banner_state = 5; /* remind me later */
164
+ }
165
+ $this->update_banner_state($new_banner_state);
166
+ }
167
+ }
168
+ exit();
169
+ }
170
+
171
+ /**
172
+ * Add banner JS to admin footer
173
+ */
174
+ public function add_banner_scripts()
175
+ {
176
+ $ajax_url = admin_url('admin-ajax.php');
177
+ $nonce = wp_create_nonce($this->plugin_prefix);
178
+ ?>
179
+ <script type="text/javascript">
180
+ (function($) {
181
+ "use strict";
182
+
183
+ /* prepare data object */
184
+ var data_obj = {
185
+ _wpnonce: '<?php echo $nonce; ?>',
186
+ action: '<?php echo $this->ajax_action_name; ?>',
187
+ wt_review_action_type: ''
188
+ };
189
+
190
+ $(document).on('click', '.<?php echo $this->banner_css_class; ?> a.button', function(e) {
191
+ e.preventDefault();
192
+ var elm = $(this);
193
+ var btn_type = elm.attr('data-type');
194
+ if (btn_type == 'review') {
195
+ window.open('<?php echo $this->review_url; ?>');
196
+ }
197
+ elm.parents('.<?php echo $this->banner_css_class; ?>').hide();
198
+
199
+ data_obj['wt_review_action_type'] = btn_type;
200
+ $.ajax({
201
+ url: '<?php echo $ajax_url; ?>',
202
+ data: data_obj,
203
+ type: 'POST'
204
+ });
205
+
206
+ }).on('click', '.<?php echo $this->banner_css_class; ?> .notice-dismiss', function(e) {
207
+ e.preventDefault();
208
+ data_obj['wt_review_action_type'] = 'closed';
209
+ $.ajax({
210
+ url: '<?php echo $ajax_url; ?>',
211
+ data: data_obj,
212
+ type: 'POST',
213
+ });
214
+
215
+ });
216
+
217
+ })(jQuery)
218
+ </script>
219
+ <?php
220
+ }
221
+
222
+ /**
223
+ * Checks the condition to show the banner
224
+ */
225
+ private function check_condition()
226
+ {
227
+
228
+ if ($this->current_banner_state == 1) /* currently showing then return true */ {
229
+ return true;
230
+ }
231
+
232
+ if ($this->current_banner_state == 2 || $this->current_banner_state == 5) /* only waiting/remind later state */ {
233
+ if ($this->start_date == 0) /* unable to get activated date */ {
234
+ /* set current date as activation date*/
235
+ $this->reset_start_date();
236
+ return false;
237
+ }
238
+
239
+ $days = ($this->current_banner_state == 2 ? $this->days_to_show_banner : $this->remind_days);
240
+
241
+ $date_to_check = $this->start_date + (86400 * $days);
242
+ if ($date_to_check <= time()) /* time reached to show the banner */ {
243
+ return true;
244
+ } else {
245
+ return false;
246
+ }
247
+ }
248
+
249
+ return false;
250
+ }
251
+ }
252
+ new Order_Import_Export_Review_Request();
includes/class-wf-orderimpexp-plugin-uninstall-feedback.php CHANGED
@@ -92,6 +92,10 @@ if (!class_exists('WF_OrderImpExp_Uninstall_Feedback')) :
92
  </li>
93
  <?php } ?>
94
  </ul>
 
 
 
 
95
  </div>
96
  <div class="wforderimpexp-modal-footer">
97
  <a href="#" class="dont-bother-me"><?php _e('I rather wouldn\'t say', 'order-import-export-for-woocommerce'); ?></a>
@@ -141,6 +145,20 @@ if (!class_exists('WF_OrderImpExp_Uninstall_Feedback')) :
141
  padding: 12px 20px;
142
  text-align: right;
143
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  </style>
145
  <script type="text/javascript">
146
  (function ($) {
92
  </li>
93
  <?php } ?>
94
  </ul>
95
+ <div class="wt-uninstall-feedback-privacy-policy">
96
+ <?php _e('We do not collect any personal data when you submit this form. It\'s your feedback that we value.', 'order-import-export-for-woocommerce'); ?>
97
+ <a href="https://www.webtoffee.com/privacy-policy/" target="_blank"><?php _e('Privacy Policy', 'order-import-export-for-woocommerce'); ?></a>
98
+ </div>
99
  </div>
100
  <div class="wforderimpexp-modal-footer">
101
  <a href="#" class="dont-bother-me"><?php _e('I rather wouldn\'t say', 'order-import-export-for-woocommerce'); ?></a>
145
  padding: 12px 20px;
146
  text-align: right;
147
  }
148
+ .wt-uninstall-feedback-privacy-policy {
149
+ text-align: left;
150
+ font-size: 12px;
151
+ color: #aaa;
152
+ line-height: 14px;
153
+ margin-top: 20px;
154
+ font-style: italic;
155
+ }
156
+
157
+ .wt-uninstall-feedback-privacy-policy a {
158
+ font-size: 11px;
159
+ color: #4b9cc3;
160
+ text-decoration-color: #99c3d7;
161
+ }
162
  </style>
163
  <script type="text/javascript">
164
  (function ($) {
includes/class-wt-import-export-for-woo.php CHANGED
@@ -80,7 +80,7 @@ class Wt_Import_Export_For_Woo_Basic {
80
  if ( defined( 'WT_O_IEW_VERSION' ) ) {
81
  $this->version = WT_O_IEW_VERSION;
82
  } else {
83
- $this->version = '2.0.7';
84
  }
85
  $this->plugin_name = 'wt-import-export-for-woo-basic';
86
 
80
  if ( defined( 'WT_O_IEW_VERSION' ) ) {
81
  $this->version = WT_O_IEW_VERSION;
82
  } else {
83
+ $this->version = '2.0.8';
84
  }
85
  $this->plugin_name = 'wt-import-export-for-woo-basic';
86
 
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: 2.0.7
10
  Text Domain: order-import-export-for-woocommerce
11
- WC tested up to: 5.4
12
  License: GPLv3
13
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
14
  */
@@ -45,7 +45,7 @@ if ( !defined( 'WT_IEW_DEBUG_BASIC_TROUBLESHOOT' ) ) {
45
  * Start at version 1.0.0 and use SemVer - https://semver.org
46
  * Rename this for your plugin and update it as you release new versions.
47
  */
48
- define( 'WT_O_IEW_VERSION', '2.0.7' );
49
 
50
  /**
51
  * The code that runs during plugin activation.
@@ -212,6 +212,7 @@ $order_legacy_menu->old_menu_params = array(
212
  array( 'parent_slug' => 'woocommerce', 'menu_title' => 'Order Im-EX', 'capability' => 'import' )
213
  );
214
 
 
215
 
216
  // Add dismissible server info for file restrictions
217
  include_once plugin_dir_path( __FILE__ ) . 'includes/class-wt-non-apache-info.php';
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: 2.0.8
10
  Text Domain: order-import-export-for-woocommerce
11
+ WC tested up to: 5.5
12
  License: GPLv3
13
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
14
  */
45
  * Start at version 1.0.0 and use SemVer - https://semver.org
46
  * Rename this for your plugin and update it as you release new versions.
47
  */
48
+ define( 'WT_O_IEW_VERSION', '2.0.8' );
49
 
50
  /**
51
  * The code that runs during plugin activation.
212
  array( 'parent_slug' => 'woocommerce', 'menu_title' => 'Order Im-EX', 'capability' => 'import' )
213
  );
214
 
215
+ include_once 'class-wt-order-review-request.php';
216
 
217
  // Add dismissible server info for file restrictions
218
  include_once plugin_dir_path( __FILE__ ) . 'includes/class-wt-non-apache-info.php';
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: webtoffee
3
  Donate link: https://www.webtoffee.com/plugins/
4
  Tags: order export, order import, woocommerce, csv, coupon, woocommerce export orders, woocommerce import orders, order, export, import, coupon export, coupon import
5
  Requires at least: 3.0.1
6
- Tested up to: 5.7
7
  Requires PHP: 5.6
8
- Stable tag: 2.0.7
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -29,8 +29,8 @@ The following are functionalities offered by the basic version of the plugin.
29
  &#128312; Supports various export filters (order status, product, coupon, customer, date range)
30
  &#128312; Export Subscription orders to a CSV file(Premium Feature).
31
  &#128312; Import Subscription orders from a CSV file(Premium Feature).
32
- &#128312; Tested OK with WooCommerce 5.4
33
- &#128312; Tested OK with WP 5.7
34
  &#128312; Tested OK with PHP 8.0
35
 
36
  Additional features that will help you in the CSV export and import process:
@@ -220,6 +220,11 @@ Yes.
220
 
221
  == Changelog ==
222
 
 
 
 
 
 
223
  = 2.0.7 =
224
  * Fixed: Paid date import
225
  = 2.0.6 =
@@ -446,5 +451,8 @@ Yes.
446
 
447
  == Upgrade Notice ==
448
 
449
- = 2.0.7 =
450
- * Fixed: Paid date import
 
 
 
3
  Donate link: https://www.webtoffee.com/plugins/
4
  Tags: order export, order import, woocommerce, csv, coupon, woocommerce export orders, woocommerce import orders, order, export, import, coupon export, coupon import
5
  Requires at least: 3.0.1
6
+ Tested up to: 5.8
7
  Requires PHP: 5.6
8
+ Stable tag: 2.0.8
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
29
  &#128312; Supports various export filters (order status, product, coupon, customer, date range)
30
  &#128312; Export Subscription orders to a CSV file(Premium Feature).
31
  &#128312; Import Subscription orders from a CSV file(Premium Feature).
32
+ &#128312; Tested OK with WooCommerce 5.5
33
+ &#128312; Tested OK with WP 5.8
34
  &#128312; Tested OK with PHP 8.0
35
 
36
  Additional features that will help you in the CSV export and import process:
220
 
221
  == Changelog ==
222
 
223
+ = 2.0.8 =
224
+ * Fixed: Grant download permission issue on import
225
+ * Fixed: Trash orders getting exported with coupon filter applied
226
+ * WC 5.5 tested OK
227
+ * WP 5.8 tested OK
228
  = 2.0.7 =
229
  * Fixed: Paid date import
230
  = 2.0.6 =
451
 
452
  == Upgrade Notice ==
453
 
454
+ = 2.0.8 =
455
+ * Fixed: Grant download permission issue on import
456
+ * Fixed: Trash orders getting exported with coupon filter applied
457
+ * WC 5.5 tested OK
458
+ * WP 5.8 tested OK