Order Export & Order Import for WooCommerce - Version 1.7.0

Version Description

  • Tested OK with WC 4.6.0
Download this release

Release Info

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

Code changes from version 1.6.9 to 1.7.0

images/webtoffee-logo_small.png ADDED
Binary file
includes/class-wf-orderimpexp-plugin-review-request.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Review request
5
+ *
6
+ *
7
+ * @package
8
+ */
9
+ if (!defined('ABSPATH')) {
10
+ exit;
11
+ }
12
+ class WT_OrderImpExp_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 = "wforderimpexp"; /* must be unique name */
20
+ private $activation_hook = "wforderimpexp_activate"; /* hook for activation, to store activated date */
21
+ private $deactivation_hook = "wforderimpexp_deactivate"; /* hook for deactivation, to delete activated date */
22
+ private $days_to_show_banner = 4; /* when did the banner to show */
23
+ private $remind_days = 2; /* remind interval in days */
24
+ private $webtoffee_logo_url = '/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.", 'order-import-export-for-woocommerce'), '<b>', '</b>');
55
+
56
+ /* button texts */
57
+ $this->later_btn_text = __("Remind me later", 'order-import-export-for-woocommerce');
58
+ $this->never_btn_text = __("Not interested", 'order-import-export-for-woocommerce');
59
+ $this->review_btn_text = __("Review now", 'order-import-export-for-woocommerce');
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 plugins_url(basename(plugin_dir_path(WF_OrderImpExpCsv_FILE))).$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 WT_OrderImpExp_Review_Request();
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.6.9
10
  Text Domain: order-import-export-for-woocommerce
11
- WC tested up to: 4.5.2
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.6.9");
28
  }
29
 
30
  /**
@@ -84,6 +84,9 @@ function wt_order_basic_register_activation_hook_callback() {
84
 
85
  // uninstall feedback catch
86
  include_once 'includes/class-wf-orderimpexp-plugin-uninstall-feedback.php';
 
 
 
87
  }
88
 
89
  public function wf_plugin_action_links( $links ) {
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.7.0
10
  Text Domain: order-import-export-for-woocommerce
11
+ WC tested up to: 4.6.0
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.7.0");
28
  }
29
 
30
  /**
84
 
85
  // uninstall feedback catch
86
  include_once 'includes/class-wf-orderimpexp-plugin-uninstall-feedback.php';
87
+
88
+ // review request
89
+ include_once 'includes/class-wf-orderimpexp-plugin-review-request.php';
90
  }
91
 
92
  public function wf_plugin_action_links( $links ) {
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: order export, order import, woocommerce export orders, woocommerce import
5
  Requires at least: 3.0.1
6
  Tested up to: 5.5
7
  Requires PHP: 5.6
8
- Stable tag: 1.6.9
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -22,7 +22,7 @@ This is a perfect tool if you are migrating an existing shop on a different eCom
22
  &#128312; Import Coupons from CSV file.
23
  &#128312; Export Subscription Orders to CSV file(Premium Feature).
24
  &#128312; Import Subscription Orders from CSV file(Premium Feature).
25
- &#128312; Tested OK with WooCommerce 4.5.2
26
  &#128312; Tested OK with PHP 7.3.5
27
 
28
  <blockquote>
@@ -118,6 +118,8 @@ By default, admin and store manager are given access to export orders from your
118
 
119
  == Changelog ==
120
 
 
 
121
  = 1.6.9 =
122
  * [Improvement] Coupons expiry date import and export.
123
  = 1.6.8 =
@@ -304,5 +306,5 @@ By default, admin and store manager are given access to export orders from your
304
 
305
  == Upgrade Notice ==
306
 
307
- = 1.6.9 =
308
- * [Improvement] Coupons expiry date import and export.
5
  Requires at least: 3.0.1
6
  Tested up to: 5.5
7
  Requires PHP: 5.6
8
+ Stable tag: 1.7.0
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
22
  &#128312; Import Coupons from CSV file.
23
  &#128312; Export Subscription Orders to CSV file(Premium Feature).
24
  &#128312; Import Subscription Orders from CSV file(Premium Feature).
25
+ &#128312; Tested OK with WooCommerce 4.6.0
26
  &#128312; Tested OK with PHP 7.3.5
27
 
28
  <blockquote>
118
 
119
  == Changelog ==
120
 
121
+ = 1.7.0 =
122
+ * Tested OK with WC 4.6.0
123
  = 1.6.9 =
124
  * [Improvement] Coupons expiry date import and export.
125
  = 1.6.8 =
306
 
307
  == Upgrade Notice ==
308
 
309
+ = 1.7.0 =
310
+ * Tested OK with WC 4.6.0