Abandoned Cart Lite for WooCommerce - Version 4.9

Version Description

Download this release

Release Info

Developer ashokrane
Plugin Icon 128x128 Abandoned Cart Lite for WooCommerce
Version 4.9
Comparing to
See all releases

Code changes from version 4.8 to 4.9

Files changed (41) hide show
  1. woocommerce-abandoned-cart/assets/css/view.abandoned.orders.style.css +23 -7
  2. woocommerce-abandoned-cart/includes/admin/wcal_privacy_erase.php +244 -0
  3. woocommerce-abandoned-cart/includes/admin/wcal_privacy_export.php +377 -0
  4. woocommerce-abandoned-cart/includes/classes/class-wcal-abandoned-orders-table.php +29 -20
  5. woocommerce-abandoned-cart/includes/classes/class-wcal-product-report-table.php +1 -1
  6. woocommerce-abandoned-cart/includes/classes/class-wcal-recover-orders-table.php +3 -2
  7. woocommerce-abandoned-cart/includes/classes/class-wcal-ts-tracker.php +0 -752
  8. woocommerce-abandoned-cart/includes/component/README.md +1 -0
  9. woocommerce-abandoned-cart/includes/component/WooCommerce-Check/Instructions +11 -0
  10. woocommerce-abandoned-cart/includes/component/WooCommerce-Check/ts-woo-active.php +80 -0
  11. woocommerce-abandoned-cart/includes/component/deactivate-survey-popup/Instructions +73 -0
  12. woocommerce-abandoned-cart/includes/component/deactivate-survey-popup/class-ts-deactivation.php +231 -0
  13. woocommerce-abandoned-cart/includes/component/deactivate-survey-popup/template/ts-deactivate-modal.php +387 -0
  14. woocommerce-abandoned-cart/includes/component/faq_support/Instructions +47 -0
  15. woocommerce-abandoned-cart/includes/component/faq_support/templates/faq-page/faq-page.php +134 -0
  16. woocommerce-abandoned-cart/includes/component/faq_support/ts-faq-support.php +231 -0
  17. woocommerce-abandoned-cart/includes/component/pro-notices-in-lite/Instructions +41 -0
  18. woocommerce-abandoned-cart/includes/component/pro-notices-in-lite/ts-pro-notices.php +372 -0
  19. woocommerce-abandoned-cart/includes/component/tracking data/Instructions +54 -0
  20. woocommerce-abandoned-cart/includes/component/tracking data/assets/images/site-logo-new.jpg +0 -0
  21. woocommerce-abandoned-cart/includes/component/tracking data/assets/js/dismiss-notice.js +41 -0
  22. woocommerce-abandoned-cart/includes/component/tracking data/class-ts-tracker.php +282 -0
  23. woocommerce-abandoned-cart/includes/component/tracking data/ts-tracking.php +269 -0
  24. woocommerce-abandoned-cart/includes/component/welcome-page/Instructions +37 -0
  25. woocommerce-abandoned-cart/includes/component/welcome-page/assets/images/abandon-cart-cut-off-time.png +0 -0
  26. woocommerce-abandoned-cart/includes/component/welcome-page/assets/images/abandoned-cart-lite-email-templates.png +0 -0
  27. woocommerce-abandoned-cart/includes/component/welcome-page/assets/images/email-templates-send-time.png +0 -0
  28. woocommerce-abandoned-cart/includes/component/welcome-page/assets/images/icon-256x256.png +0 -0
  29. woocommerce-abandoned-cart/includes/component/welcome-page/assets/images/site-logo-new.jpg +0 -0
  30. woocommerce-abandoned-cart/includes/component/welcome-page/templates/social-media-elements.php +24 -0
  31. woocommerce-abandoned-cart/includes/component/welcome-page/templates/welcome/welcome-page.php +134 -0
  32. woocommerce-abandoned-cart/includes/component/welcome-page/ts-welcome.php +275 -0
  33. woocommerce-abandoned-cart/includes/wcal-common.php +610 -4
  34. woocommerce-abandoned-cart/includes/wcal_admin_notice.php +0 -159
  35. woocommerce-abandoned-cart/includes/wcal_all_component.php +196 -0
  36. woocommerce-abandoned-cart/includes/wcal_class-guest.php +28 -4
  37. woocommerce-abandoned-cart/includes/wcal_data_tracking_message.php +74 -0
  38. woocommerce-abandoned-cart/includes/wcal_ts_tracking.php +0 -85
  39. woocommerce-abandoned-cart/includes/welcome.php +0 -313
  40. woocommerce-abandoned-cart/readme.txt +18 -4
  41. woocommerce-abandoned-cart/woocommerce-ac.php +195 -212
woocommerce-abandoned-cart/assets/css/view.abandoned.orders.style.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * Decrease the width of the Id column.
3
- *
4
  */
5
  table.wp-list-table .column-id {
6
  width:5%;
@@ -8,12 +8,12 @@ table.wp-list-table .column-id {
8
 
9
  /**
10
  * Decrease the width of the email column.
11
- */
12
  table.wp-list-table .column-email {
13
  width:15%;
14
  }
15
 
16
- /**
17
  * Decrease the width of the abandoned order date column.
18
  */
19
  table.wp-list-table .column-date {
@@ -27,18 +27,18 @@ table.wp-list-table .column-order_total {
27
  width:20%;
28
  }
29
 
30
- /**
31
  * This is for the new cart and checkout button in tinymce.
32
  */
33
  #woocommerce_ac_email_body_abandoncart_email_variables_css{
34
-
35
  width : 60px !important;
36
  }
37
  span.mce_abandoncart_email_variables_css {
38
  width : 60px !important;
39
  }
40
 
41
- /**
42
  * Decrease the width of the sr column in templates tab.
43
  */
44
  table.wp-list-table .column-sr {
@@ -49,4 +49,20 @@ i.mce-i-abandoncart_email_variables {
49
  background-image: url(../images/ac_editor_icon.png) ;
50
  width: 30px;
51
  height: 30px;
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /**
2
  * Decrease the width of the Id column.
3
+ *
4
  */
5
  table.wp-list-table .column-id {
6
  width:5%;
8
 
9
  /**
10
  * Decrease the width of the email column.
11
+ */
12
  table.wp-list-table .column-email {
13
  width:15%;
14
  }
15
 
16
+ /**
17
  * Decrease the width of the abandoned order date column.
18
  */
19
  table.wp-list-table .column-date {
27
  width:20%;
28
  }
29
 
30
+ /**
31
  * This is for the new cart and checkout button in tinymce.
32
  */
33
  #woocommerce_ac_email_body_abandoncart_email_variables_css{
34
+
35
  width : 60px !important;
36
  }
37
  span.mce_abandoncart_email_variables_css {
38
  width : 60px !important;
39
  }
40
 
41
+ /**
42
  * Decrease the width of the sr column in templates tab.
43
  */
44
  table.wp-list-table .column-sr {
49
  background-image: url(../images/ac_editor_icon.png) ;
50
  width: 30px;
51
  height: 30px;
52
+ }
53
+
54
+ /**
55
+ * Resize product image to fit within td.
56
+ */
57
+ table.wp-list-table td img {
58
+ max-width: 100%;
59
+ height: auto;
60
+ }
61
+
62
+ /**
63
+ * Add left/right margin to h3 titles.
64
+ */
65
+ h3.details-title {
66
+ margin-left: 12px;
67
+ margin-right: 12px;
68
+ }
woocommerce-abandoned-cart/includes/admin/wcal_privacy_erase.php ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Export Abandoned Carts data in
4
+ * Dashboard->Tools->Erase Personal Data
5
+ *
6
+ * @since 4.9
7
+ */
8
+ // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) exit;
10
+
11
+ if ( !class_exists('Wcal_Personal_Data_Eraser' ) ) {
12
+
13
+ /**
14
+ * Export Abandoned Carts data in
15
+ * Dashboard->Tools->Erase Personal Data
16
+ */
17
+ class Wcal_Personal_Data_Eraser {
18
+
19
+ /**
20
+ * Construct
21
+ * @since 4.9
22
+ */
23
+ public function __construct() {
24
+ // Hook into the WP erase process
25
+ add_filter( 'wp_privacy_personal_data_erasers', array( &$this, 'wcal_eraser_array' ), 6 );
26
+ }
27
+
28
+ /**
29
+ * Add our eraser and it's callback function
30
+ *
31
+ * @param array $erasers - Any erasers that need to be added by 3rd party plugins
32
+ * @param array $erasers - Erasers list containing our plugin details
33
+ *
34
+ * @since 4.9
35
+ */
36
+ public static function wcal_eraser_array( $erasers = array() ) {
37
+
38
+ $eraser_list = array();
39
+ // Add our eraser and it's callback function
40
+ $eraser_list[ 'wcal_carts' ] = array(
41
+ 'eraser_friendly_name' => __( 'Abandoned & Recovered Carts', 'woocommerce-abandoned-cart' ),
42
+ 'callback' => array( 'Wcal_Personal_Data_Eraser', 'wcal_data_eraser' )
43
+ );
44
+
45
+ $erasers = array_merge( $erasers, $eraser_list );
46
+
47
+ return $erasers;
48
+
49
+ }
50
+
51
+ /**
52
+ * Erases personal data for abandoned carts.
53
+ *
54
+ * @param string $email_address - EMail Address for which personal data is being exported
55
+ * @param integer $page - The Eraser page number
56
+ * @return array $reponse - Whether the process was successful or no
57
+ *
58
+ * @hook wp_privacy_personal_data_erasers
59
+ * @global $wpdb
60
+ * @since 4.9
61
+ */
62
+ static function wcal_data_eraser( $email_address, $page ) {
63
+ global $wpdb;
64
+
65
+ $page = (int) $page;
66
+ $user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
67
+ $erasure_enabled = wc_string_to_bool( get_option( 'woocommerce_erasure_request_removes_order_data', 'no' ) );
68
+ $response = array(
69
+ 'items_removed' => false,
70
+ 'items_retained' => false,
71
+ 'messages' => array(),
72
+ 'done' => true,
73
+ );
74
+
75
+ $user_id = $user ? (int) $user->ID : 0;
76
+
77
+ if( $user_id > 0 ) { // registered user
78
+ $cart_query = "SELECT id FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
79
+ WHERE user_id = %d AND
80
+ user_type = 'REGISTERED'";
81
+
82
+ $cart_ids = $wpdb->get_results( $wpdb->prepare( $cart_query, $user_id ) );
83
+ } else { // guest carts
84
+ $guest_query = "SELECT id FROM `" . $wpdb->prefix . 'ac_guest_abandoned_cart_history_lite' . "`
85
+ WHERE email_id = %s";
86
+
87
+ $guest_user_ids = $wpdb->get_results( $wpdb->prepare( $guest_query, $email_address ) );
88
+
89
+ if( count( $guest_user_ids ) == 0 )
90
+ return;
91
+
92
+ $cart_ids = array();
93
+
94
+ foreach( $guest_user_ids as $ids ) {
95
+ // get the cart data
96
+ $cart_query = "SELECT id FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
97
+ WHERE user_id = %d AND
98
+ user_type = 'GUEST'";
99
+
100
+ $cart_data = $wpdb->get_results( $wpdb->prepare( $cart_query, $ids->id ) );
101
+
102
+ $cart_ids = array_merge( $cart_ids, $cart_data );
103
+ }
104
+ }
105
+
106
+ if ( 0 < count( $cart_ids ) ) {
107
+
108
+ $cart_chunks = array_chunk( $cart_ids, 10, true );
109
+
110
+ $cart_export = isset( $cart_chunks[ $page - 1 ] ) ? $cart_chunks[ $page - 1 ] : array();
111
+ if( count( $cart_export ) > 0 ) {
112
+ foreach ( $cart_export as $abandoned_ids ) {
113
+ $cart_id = $abandoned_ids->id;
114
+
115
+ if ( apply_filters( 'wcal_privacy_erase_cart_personal_data', $erasure_enabled, $cart_id ) ) {
116
+ self::remove_cart_personal_data( $cart_id );
117
+
118
+ /* Translators: %s Abandoned Cart ID. */
119
+ $response['messages'][] = sprintf( __( 'Removed personal data from cart %s.', 'woocommerce-abandoned-cart' ), $cart_id );
120
+ $response['items_removed'] = true;
121
+ } else {
122
+ /* Translators: %s Abandoned Cart ID. */
123
+ $response['messages'][] = sprintf( __( 'Personal data within cart %s has been retained.', 'woocommerce-abandoned-cart' ), $cart_id );
124
+ $response['items_retained'] = true;
125
+ }
126
+
127
+ }
128
+ $response['done'] = $page > count( $cart_chunks );
129
+ } else {
130
+ $response['done'] = true;
131
+ }
132
+ } else {
133
+ $response['done'] = true;
134
+ }
135
+ return $response;
136
+ }
137
+
138
+ /**
139
+ * Erases the personal data for each abandoned cart
140
+ *
141
+ * @param integer $abandoned_id - Abandoned Cart ID
142
+ * @global $wpdb
143
+ * @since 4.9
144
+ */
145
+ static function remove_cart_personal_data( $abandoned_id ) {
146
+ global $wpdb;
147
+
148
+ $anonymized_cart = array();
149
+ $anonymized_guest = array();
150
+
151
+ do_action( 'wcal_privacy_before_remove_cart_personal_data', $abandoned_id );
152
+
153
+ // list the props we'll be anonymizing for cart history table
154
+ $props_to_remove_cart = apply_filters( 'wcal_privacy_remove_cart_personal_data_props', array(
155
+ 'session_id' => 'numeric_id',
156
+ ),
157
+ $abandoned_id
158
+ );
159
+
160
+ // list the props we'll be anonymizing for guest cart history table
161
+ $props_to_remove_guest = apply_filters( 'wcal_privacy_remove_cart_personal_data_props_guest', array(
162
+ 'billing_first_name' => 'text',
163
+ 'billing_last_name' => 'text',
164
+ 'phone' => 'phone',
165
+ 'email_id' => 'email' ), $abandoned_id );
166
+
167
+
168
+ if ( ! empty( $props_to_remove_cart ) && is_array( $props_to_remove_cart ) ) {
169
+
170
+ // get the data from cart history
171
+ $cart_query = "SELECT session_id, user_type, user_id FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
172
+ WHERE id = %d";
173
+ $cart_details = $wpdb->get_results( $wpdb->prepare( $cart_query, $abandoned_id ) );
174
+
175
+ if( count( $cart_details ) > 0 ) {
176
+ $cart_details = $cart_details[0];
177
+ } else {
178
+ return;
179
+ }
180
+
181
+ $user_id = $cart_details->user_id;
182
+ $user_type = $cart_details->user_type;
183
+
184
+ foreach ( $props_to_remove_cart as $prop => $data_type ) {
185
+
186
+ $value = $cart_details->$prop;
187
+
188
+ if ( empty( $value ) || empty( $data_type ) ) {
189
+ continue;
190
+ }
191
+
192
+ if ( function_exists( 'wp_privacy_anonymize_data' ) ) {
193
+ $anon_value = wp_privacy_anonymize_data( $data_type, $value );
194
+ } else {
195
+ $anon_value = '';
196
+ }
197
+
198
+ $anonymized_cart[ $prop ] = apply_filters( 'wcal_privacy_remove_cart_personal_data_prop_value', $anon_value, $prop, $value, $data_type, $abandoned_id );
199
+ }
200
+ $anonymized_cart[ 'user_type' ] = __( 'ANONYMIZED', 'woocommerce-abandoned-cart' );
201
+ // update the DB
202
+ $wpdb->update( $wpdb->prefix . 'ac_abandoned_cart_history_lite', $anonymized_cart, array( 'id' => $abandoned_id ) );
203
+ }
204
+
205
+ // check whether it's a guest user
206
+ if( $user_type == 'GUEST' && ! empty( $props_to_remove_guest ) && is_array( $props_to_remove_guest ) ) {
207
+
208
+ // get the data from guest cart history
209
+ $guest_query = "SELECT billing_first_name, billing_last_name, phone, email_id FROM `" . $wpdb->prefix . 'ac_guest_abandoned_cart_history_lite' . "`
210
+ WHERE id = %d";
211
+ $guest_details = $wpdb->get_results( $wpdb->prepare( $guest_query, $user_id ) );
212
+
213
+ if( count( $guest_details ) > 0 ) {
214
+ $guest_details = $guest_details[0];
215
+ } else {
216
+ return;
217
+ }
218
+
219
+ foreach ( $props_to_remove_guest as $prop => $data_type ) {
220
+ $value = $guest_details->$prop;
221
+
222
+ if ( empty( $value ) || empty( $data_type ) ) {
223
+ continue;
224
+ }
225
+
226
+ if ( function_exists( 'wp_privacy_anonymize_data' ) ) {
227
+ $anon_value = wp_privacy_anonymize_data( $data_type, $value );
228
+ } else {
229
+ $anon_value = '';
230
+ }
231
+
232
+ $anonymized_guest[ $prop ] = apply_filters( 'wcal_privacy_remove_cart_personal_data_prop_value_guest', $anon_value, $prop, $value, $data_type, $abandoned_id );
233
+ }
234
+ // update the DB
235
+ $wpdb->update( $wpdb->prefix . 'ac_guest_abandoned_cart_history_lite', $anonymized_guest, array( 'id' => $user_id ) );
236
+
237
+ }
238
+
239
+ }
240
+
241
+ } // end of class
242
+ $Wcal_Personal_Data_Eraser = new Wcal_Personal_Data_Eraser();
243
+ } // end if
244
+ ?>
woocommerce-abandoned-cart/includes/admin/wcal_privacy_export.php ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Export Abandoned Carts data in
4
+ * Dashboard->Tools->Export Personal Data
5
+ *
6
+ * @since 4.9
7
+ */
8
+ // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) exit;
10
+
11
+ if ( !class_exists('Wcal_Personal_Data_Export' ) ) {
12
+
13
+ /**
14
+ * Export Abandoned Carts data in
15
+ * Dashboard->Tools->Export Personal Data
16
+ */
17
+ class Wcal_Personal_Data_Export {
18
+
19
+ /**
20
+ * Construct
21
+ * @since 7.8
22
+ */
23
+ public function __construct() {
24
+ // Hook into the WP export process
25
+ add_filter( 'wp_privacy_personal_data_exporters', array( &$this, 'wcal_exporter_array' ), 6 );
26
+ }
27
+
28
+ /**
29
+ * Add our export and it's callback function
30
+ *
31
+ * @param array $exporters - Any exportes that need to be added by 3rd party plugins
32
+ * @param array $exporters - Exportes list containing our plugin details
33
+ *
34
+ * @since 4.9
35
+ */
36
+ public static function wcal_exporter_array( $exporters = array() ) {
37
+
38
+ $exporter_list = array();
39
+ // Add our export and it's callback function
40
+ $exporter_list[ 'wcal_carts' ] = array(
41
+ 'exporter_friendly_name' => __( 'Abandoned & Recovered Carts', 'woocommerce-abandoned-cart' ),
42
+ 'callback' => array( 'Wcal_Personal_Data_Export', 'wcal_data_exporter' )
43
+ );
44
+
45
+ $exporters = array_merge( $exporters, $exporter_list );
46
+
47
+ return $exporters;
48
+
49
+ }
50
+
51
+ /**
52
+ * Returns data to be displayed for exporting the
53
+ * cart details
54
+ *
55
+ * @param string $email_address - EMail Address for which personal data is being exported
56
+ * @param integer $page - The Export page number
57
+ * @return array $data_to_export - Data to be exported
58
+ *
59
+ * @hook wp_privacy_personal_data_exporters
60
+ * @global $wpdb
61
+ * @since 4.9
62
+ */
63
+ static function wcal_data_exporter( $email_address, $page ) {
64
+
65
+ global $wpdb;
66
+
67
+ $done = false;
68
+ $page = (int) $page;
69
+ $user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
70
+ $data_to_export = array();
71
+ $blank_cart_info = '{"cart":[]}';
72
+ $blank_cart_info_guest = '[]';
73
+ $blank_cart = '""';
74
+
75
+ $user_id = $user ? (int) $user->ID : 0;
76
+
77
+ if( $user_id > 0 ) { // registered user
78
+
79
+ $cart_query = "SELECT id FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
80
+ WHERE user_id = %d AND
81
+ user_type = 'REGISTERED' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart'";
82
+
83
+ $cart_ids = $wpdb->get_results( $wpdb->prepare( $cart_query, $user_id ) );
84
+ } else { // guest carts
85
+ $guest_query = "SELECT id FROM `" . $wpdb->prefix . 'ac_guest_abandoned_cart_history_lite' . "`
86
+ WHERE email_id = %s";
87
+
88
+ $guest_user_ids = $wpdb->get_results( $wpdb->prepare( $guest_query, $email_address ) );
89
+
90
+ if( count( $guest_user_ids ) == 0 )
91
+ return;
92
+
93
+ $cart_ids = array();
94
+
95
+ foreach( $guest_user_ids as $ids ) {
96
+ // get the cart data
97
+ $cart_query = "SELECT id, abandoned_cart_info AS cart_info FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
98
+ WHERE user_id = %d AND
99
+ user_type = 'GUEST'";
100
+
101
+ $cart_data = $wpdb->get_results( $wpdb->prepare( $cart_query, $ids->id ) );
102
+
103
+ $cart_ids = array_merge( $cart_ids, $cart_data );
104
+ }
105
+ }
106
+
107
+ if ( 0 < count( $cart_ids ) ) {
108
+
109
+ $cart_chunks = array_chunk( $cart_ids, 10, true );
110
+
111
+ $cart_export = isset( $cart_chunks[ $page - 1 ] ) ? $cart_chunks[ $page - 1 ] : array();
112
+ if( count( $cart_export ) > 0 ) {
113
+
114
+ foreach ( $cart_export as $abandoned_ids ) {
115
+
116
+ $cart_id = $abandoned_ids->id;
117
+ if( count( $abandoned_ids->id ) > 0 ) {
118
+ $data_to_export[] = array(
119
+ 'group_id' => 'wcal_carts',
120
+ 'group_label' => __( 'Abandoned Carts', 'woocommerce-abandoned-cart' ),
121
+ 'item_id' => 'cart-' . $cart_id,
122
+ 'data' => self::get_cart_data( $cart_id ),
123
+ );
124
+ }
125
+ }
126
+ $done = $page > count( $cart_chunks );
127
+ } else {
128
+ $done = true;
129
+ }
130
+ } else {
131
+ $done = true;
132
+ }
133
+
134
+ return array(
135
+ 'data' => $data_to_export,
136
+ 'done' => $done,
137
+ );
138
+
139
+ }
140
+
141
+ /**
142
+ * Returns the personal data for each abandoned cart
143
+ *
144
+ * @param integer $abandoned_id - Abandoned Cart ID
145
+ * @return array $personal_data - Personal data to be displayed
146
+ * @global $wpdb
147
+ * @since 4.9
148
+ */
149
+ static function get_cart_data( $abandoned_id ) {
150
+ $personal_data = array();
151
+
152
+ global $wpdb;
153
+
154
+ $cart_query = "SELECT * FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
155
+ WHERE id = %d";
156
+ $cart_details = $wpdb->get_results( $wpdb->prepare( $cart_query, $abandoned_id ) );
157
+ $cart_details = $cart_details[0];
158
+ $user_id = $cart_details->user_id;
159
+ $user_type = $cart_details->user_type;
160
+
161
+ if( $user_type == 'GUEST' ) {
162
+
163
+ $cart_details_to_export = apply_filters( 'wcal_personal_export_cart_details_prop', array(
164
+ 'cart_id' => __( 'Abandoned Cart ID', 'woocommerce-abandoned-cart' ),
165
+ 'date_created' => __( 'Abandoned Date', 'woocommerce-abandoned-cart' ),
166
+ 'cart_status' => __( 'Abandoned Cart Status', 'woocommerce-abandoned-cart' ),
167
+ 'total' => __( 'Cart Total', 'woocommerce-abandoned-cart' ),
168
+ 'items' => __( 'Items Present', 'woocommerce-abandoned-cart' ),
169
+ 'session_id' => __( 'Session ID', 'woocommerce-abandoned-cart' ),
170
+ 'formatted_billing_address' => __( 'Billing Address', 'woocommerce-abandoned-cart' ),
171
+ 'billing_email' => __( 'Email Address', 'woocommerce-abandoned-cart' ),
172
+ ), $abandoned_id );
173
+
174
+ } else {
175
+ $cart_details_to_export = apply_filters( 'wcal_personal_export_cart_details_prop', array(
176
+ 'cart_id' => __( 'Abandoned Cart ID', 'woocommerce-abandoned-cart' ),
177
+ 'date_created' => __( 'Abandoned Date', 'woocommerce-abandoned-cart' ),
178
+ 'cart_status' => __( 'Abandoned Cart Status', 'woocommerce-abandoned-cart' ),
179
+ 'total' => __( 'Cart Total', 'woocommerce-abandoned-cart' ),
180
+ 'items' => __( 'Items Present', 'woocommerce-abandoned-cart' ),
181
+ 'formatted_billing_address' => __( 'Billing Address', 'woocommerce-abandoned-cart' ),
182
+ 'billing_email' => __( 'Email Address', 'woocommerce-abandoned-cart' ),
183
+ ), $abandoned_id );
184
+
185
+ }
186
+
187
+ $cart_data = json_decode( stripslashes( $cart_details->abandoned_cart_info ) );
188
+ $cart_info = $cart_data->cart;
189
+
190
+ if( count( $cart_info ) > 0 ) {
191
+ $cart_details_formatted = self::wcal_get_cart_details_export( $cart_info );
192
+ }
193
+
194
+ if( $user_type == 'GUEST' ) {
195
+ $guest_details = self::wcal_get_guest_personal_info( $user_id );
196
+ }
197
+ foreach( $cart_details_to_export as $prop => $name ) {
198
+
199
+ switch( $prop ) {
200
+ case 'cart_id':
201
+ $value = $cart_details->id;
202
+ break;
203
+ case 'date_created':
204
+ $value = date( 'Y-m-d H:i:s', $cart_details->abandoned_cart_time );
205
+ break;
206
+ case 'cart_status':
207
+
208
+ $cart_ignored = $cart_details->cart_ignored;
209
+
210
+ switch( $cart_ignored ) {
211
+ case '0':
212
+ $value = $cart_details->recovered_cart > 0 ? __( "Cart Recovered - Order #", 'woocommerce-abandoned-cart' ) . $cart_details->recovered_cart : __( 'Abandoned', 'woocommerce-abandoned-cart' );
213
+ break;
214
+ case '1':
215
+ $value = $cart_details->recovered_cart > 0 ? __( "Cart Recovered - Order #", 'woocommerce-abandoned-cart' ) . $cart_details->recovered_cart : __( 'Abandoned but new cart created', 'woocommerce-abandoned-cart' );
216
+ break;
217
+ case '2':
218
+ $value = __( 'Abandoned - Order Unpaid (Order #', 'woocommerce-abandoned-cart') . $cart_details->recovered_cart . ")";
219
+ break;
220
+ }
221
+ break;
222
+ case 'total':
223
+ $total = 0;
224
+
225
+ if( count( $cart_info ) > 0 ) {
226
+ foreach( $cart_info as $k => $v ) {
227
+
228
+ $total += $cart_details_formatted[$k][ 'item_total' ];
229
+ }
230
+ }
231
+ $value = wc_price( $total );
232
+ break;
233
+ case 'items':
234
+ $value = '';
235
+
236
+ if( count( $cart_info ) > 0 ) {
237
+ foreach( $cart_info as $k => $v ) {
238
+
239
+ $product_name = $cart_details_formatted[$k][ 'product_name' ];
240
+ $qty = $cart_details_formatted[$k][ 'qty' ];
241
+
242
+ $value .= ( $value == '' ) ? "$product_name x $qty" : ", $product_name x $qty";
243
+ }
244
+ }
245
+ break;
246
+ case 'formatted_billing_address':
247
+
248
+ if( $user_type == 'REGISTERED' ) { // registered user
249
+
250
+ $billing = wcal_common::wcal_get_billing_details( $user_id );
251
+ $value = get_user_meta( $user_id, 'billing_first_name', true ); // First Name
252
+ $value .= ' ' . get_user_meta( $user_id, 'billing_last_name', true ); // Last Name
253
+ if( count( $billing ) > 0 ) {
254
+ foreach( $billing as $details ) {
255
+ if( $details != '' ) {
256
+ $value .= ",$details ";
257
+ }
258
+ }
259
+
260
+ }
261
+ } elseif ( $user_type == 'GUEST' ) {
262
+ if( count( $guest_details ) > 0 ) {
263
+ $value = $guest_details->billing_first_name; // First Name
264
+ $value .= ' ' . $guest_details->billing_last_name; // Last Name
265
+ }
266
+ }
267
+ break;
268
+
269
+ case 'billing_email':
270
+ if( $user_type == 'REGISTERED' ) { // registered user
271
+ $value = get_user_meta( $user_id, $prop, true );
272
+ } else if( $user_type == 'GUEST' ) {
273
+ if( count( $guest_details ) > 0 ) {
274
+ $value = $guest_details->$prop;
275
+ }
276
+ }
277
+ break;
278
+ default:
279
+ $value = ( isset( $cart_details->$prop ) ) ? $cart_details->$prop : '';
280
+ break;
281
+ }
282
+
283
+ $value = apply_filters( 'wcal_personal_export_cart_details_prop_value', $value, $prop, $cart_details );
284
+
285
+ $personal_data[] = array(
286
+ 'name' => $name,
287
+ 'value' => $value,
288
+ );
289
+
290
+ }
291
+ $personal_data = apply_filters( 'wcal_personal_data_cart_details_export', $personal_data, $cart_details );
292
+
293
+ return $personal_data;
294
+ }
295
+
296
+ /**
297
+ * Returns the personal data from the plugin guest cart table
298
+ * for guest abandoned carts
299
+ *
300
+ * @param integer $user_id - User ID
301
+ * @return array $guest_details - Guest personal details
302
+ * @global $wpdb
303
+ * @since 4.9
304
+ */
305
+ static function wcal_get_guest_personal_info( $user_id ) {
306
+ global $wpdb;
307
+ $guest_details = array();
308
+
309
+ $guest_query = "SELECT billing_first_name, billing_last_name, email_id AS billing_email, phone AS billing_phone FROM `" . $wpdb->prefix . 'ac_guest_abandoned_cart_history_lite' . "`
310
+ WHERE id = %d";
311
+
312
+ $guest_details = $wpdb->get_results( $wpdb->prepare( $guest_query, $user_id ) );
313
+
314
+ if( is_array( $guest_details ) && count( $guest_details ) > 0 ) {
315
+ $guest_details = $guest_details[0];
316
+ }
317
+
318
+ return $guest_details;
319
+ }
320
+
321
+ /**
322
+ * Returns the Cart Details such as quantity, product name
323
+ * etc.
324
+ *
325
+ * @param object $cart_info - Abandoned Cart Information
326
+ * @return array $cart_details - Array containing product, qty & total for each item
327
+ * @since 4.9
328
+ */
329
+ static function wcal_get_cart_details_export( $cart_info ) {
330
+
331
+ $cart_details = array();
332
+
333
+ if( count( $cart_info ) > 0 ) {
334
+
335
+ $cart_total = 0;
336
+ foreach( $cart_info as $k => $item_detail ) {
337
+
338
+ // Qty
339
+ $qty = $item_detail->quantity;
340
+
341
+ //Product Name
342
+ $product_id = $item_detail->product_id;
343
+ $prod_obj = wc_get_product( $product_id );
344
+ $product_name = $prod_obj->get_name();
345
+
346
+ // Variation Name
347
+ if( isset( $item_detail->variation_id ) && $item_detail->variation_id > 0 ) {
348
+ $variation_id = $item_detail->variation_id;
349
+ $variation = wc_get_product( $variation_id );
350
+ $variation_name = $variation->get_name();
351
+
352
+ $product_name = $variation_name;
353
+ }
354
+
355
+ // Total
356
+ $item_total = $item_detail->line_total;
357
+ if ( $item_detail->line_subtotal_tax > 0 ) {
358
+ $item_total += $item_detail->line_subtotal_tax;
359
+ }
360
+
361
+ // Populate the array
362
+ $cart_details[ $k ][ 'qty' ] = $qty;
363
+ $cart_details[ $k ][ 'product_name' ] = $product_name;
364
+ $cart_details[ $k ][ 'item_total' ] = $item_total;
365
+
366
+ $cart_total += $item_total;
367
+ }
368
+
369
+ $cart_details[ 'total' ] = $cart_total;
370
+ }
371
+
372
+ return $cart_details;
373
+ }
374
+ } // end of class
375
+ $Wcal_Personal_Data_Export = new Wcal_Personal_Data_Export();
376
+ } // end if
377
+ ?>
woocommerce-abandoned-cart/includes/classes/class-wcal-abandoned-orders-table.php CHANGED
@@ -178,12 +178,12 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
178
  // get main site's table prefix
179
  $main_prefix = $wpdb->get_blog_prefix(1);
180
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$main_prefix."users AS wpu ON wpac.user_id = wpu.id
181
- WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart%' ORDER BY wpac.abandoned_cart_time DESC";
182
  $results = $wpdb->get_results( $query );
183
  } else {
184
  // non-multisite - regular table name
185
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$wpdb->prefix."users AS wpu ON wpac.user_id = wpu.id
186
- WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart%' ORDER BY wpac.abandoned_cart_time DESC ";
187
 
188
  $results = $wpdb->get_results( $query );
189
  }
@@ -195,12 +195,12 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
195
  // get main site's table prefix
196
  $main_prefix = $wpdb->get_blog_prefix(1);
197
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$main_prefix."users AS wpu ON wpac.user_id = wpu.id
198
- WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart%' ORDER BY wpac.abandoned_cart_time DESC ";
199
  $results = $wpdb->get_results( $query );
200
  } else {
201
  // non-multisite - regular table name
202
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$wpdb->prefix."users AS wpu ON wpac.user_id = wpu.id
203
- WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND wpac.user_type = 'REGISTERED' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart%' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart%' ORDER BY wpac.abandoned_cart_time DESC ";
204
  $results = $wpdb->get_results( $query );
205
  }
206
  break;
@@ -211,12 +211,12 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
211
  // get main site's table prefix
212
  $main_prefix = $wpdb->get_blog_prefix(1);
213
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$main_prefix."users AS wpu ON wpac.user_id = wpu.id
214
- WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart%' AND wpac.user_id >= 63000000 ORDER BY wpac.abandoned_cart_time DESC ";
215
  $results = $wpdb->get_results( $query );
216
  } else {
217
  // non-multisite - regular table name
218
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$wpdb->prefix."users AS wpu ON wpac.user_id = wpu.id
219
- WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart%' AND wpac.user_id >= 63000000 ORDER BY wpac.abandoned_cart_time DESC ";
220
  $results = $wpdb->get_results( $query );
221
  }
222
  break;
@@ -227,12 +227,12 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
227
  // get main site's table prefix
228
  $main_prefix = $wpdb->get_blog_prefix(1);
229
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$main_prefix."users AS wpu ON wpac.user_id = wpu.id
230
- WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart%' AND wpac.user_id >= 63000000 ORDER BY wpac.abandoned_cart_time DESC ";
231
  $results = $wpdb->get_results( $query );
232
  } else {
233
  // non-multisite - regular table name
234
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$wpdb->prefix."users AS wpu ON wpac.user_id = wpu.id
235
- WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart%' AND wpac.user_id = 0 ORDER BY wpac.abandoned_cart_time DESC ";
236
  $results = $wpdb->get_results( $query );
237
  }
238
  break;
@@ -279,27 +279,36 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
279
  $user_last_name = "";
280
  }
281
  } else {
282
- $user_email_billing = get_user_meta( $value->user_id, 'billing_email', true );
283
- if( $user_email_billing != '' ) {
284
- $user_email = $user_email_billing;
285
- } else {
286
- $user_data = get_userdata( $value->user_id );
287
- $user_email = $user_data->user_email;
288
- }
289
- $user_first_name = "";
 
 
290
  $user_first_name_temp = get_user_meta( $user_id, 'billing_first_name', true );
291
  if( isset( $user_first_name_temp ) && "" == $user_first_name_temp ) {
292
  $user_data = get_userdata( $user_id );
293
- $user_first_name = $user_data->first_name;
 
 
 
 
294
  } else {
295
  $user_first_name = $user_first_name_temp;
296
  }
297
-
298
- $user_last_name = "";
299
  $user_last_name_temp = get_user_meta( $user_id, 'billing_last_name', true );
300
  if( isset( $user_last_name_temp ) && "" == $user_last_name_temp ) {
301
  $user_data = get_userdata( $user_id );
302
- $user_last_name = $user_data->last_name;
 
 
 
 
303
  } else {
304
  $user_last_name = $user_last_name_temp;
305
  }
178
  // get main site's table prefix
179
  $main_prefix = $wpdb->get_blog_prefix(1);
180
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$main_prefix."users AS wpu ON wpac.user_id = wpu.id
181
+ WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart' ORDER BY wpac.abandoned_cart_time DESC";
182
  $results = $wpdb->get_results( $query );
183
  } else {
184
  // non-multisite - regular table name
185
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$wpdb->prefix."users AS wpu ON wpac.user_id = wpu.id
186
+ WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart' ORDER BY wpac.abandoned_cart_time DESC ";
187
 
188
  $results = $wpdb->get_results( $query );
189
  }
195
  // get main site's table prefix
196
  $main_prefix = $wpdb->get_blog_prefix(1);
197
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$main_prefix."users AS wpu ON wpac.user_id = wpu.id
198
+ WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart' ORDER BY wpac.abandoned_cart_time DESC ";
199
  $results = $wpdb->get_results( $query );
200
  } else {
201
  // non-multisite - regular table name
202
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$wpdb->prefix."users AS wpu ON wpac.user_id = wpu.id
203
+ WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND wpac.user_type = 'REGISTERED' AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart%' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart' ORDER BY wpac.abandoned_cart_time DESC ";
204
  $results = $wpdb->get_results( $query );
205
  }
206
  break;
211
  // get main site's table prefix
212
  $main_prefix = $wpdb->get_blog_prefix(1);
213
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$main_prefix."users AS wpu ON wpac.user_id = wpu.id
214
+ WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart' AND wpac.user_id >= 63000000 ORDER BY wpac.abandoned_cart_time DESC ";
215
  $results = $wpdb->get_results( $query );
216
  } else {
217
  // non-multisite - regular table name
218
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$wpdb->prefix."users AS wpu ON wpac.user_id = wpu.id
219
+ WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart' AND wpac.user_id >= 63000000 ORDER BY wpac.abandoned_cart_time DESC ";
220
  $results = $wpdb->get_results( $query );
221
  }
222
  break;
227
  // get main site's table prefix
228
  $main_prefix = $wpdb->get_blog_prefix(1);
229
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$main_prefix."users AS wpu ON wpac.user_id = wpu.id
230
+ WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart' AND wpac.user_id >= 63000000 ORDER BY wpac.abandoned_cart_time DESC ";
231
  $results = $wpdb->get_results( $query );
232
  } else {
233
  // non-multisite - regular table name
234
  $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac LEFT JOIN ".$wpdb->prefix."users AS wpu ON wpac.user_id = wpu.id
235
+ WHERE wpac.recovered_cart='0' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart' AND wpac.user_id = 0 ORDER BY wpac.abandoned_cart_time DESC ";
236
  $results = $wpdb->get_results( $query );
237
  }
238
  break;
279
  $user_last_name = "";
280
  }
281
  } else {
282
+ $user_email_biiling = get_user_meta( $user_id, 'billing_email', true );
283
+ $user_email = __( "User Deleted" , "woocommerce-abandoned-cart" );
284
+ if( isset( $user_email_biiling ) && "" == $user_email_biiling ) {
285
+ $user_data = get_userdata( $user_id );
286
+ if( isset( $user_data->user_email ) && "" != $user_data->user_email ) {
287
+ $user_email = $user_data->user_email;
288
+ }
289
+ } else if ( '' != $user_email_biiling ) {
290
+ $user_email = $user_email_biiling;
291
+ }
292
  $user_first_name_temp = get_user_meta( $user_id, 'billing_first_name', true );
293
  if( isset( $user_first_name_temp ) && "" == $user_first_name_temp ) {
294
  $user_data = get_userdata( $user_id );
295
+ if( isset( $user_data->first_name ) && "" != $user_data->first_name ) {
296
+ $user_first_name = $user_data->first_name;
297
+ }else{
298
+ $user_first_name = '';
299
+ }
300
  } else {
301
  $user_first_name = $user_first_name_temp;
302
  }
303
+
 
304
  $user_last_name_temp = get_user_meta( $user_id, 'billing_last_name', true );
305
  if( isset( $user_last_name_temp ) && "" == $user_last_name_temp ) {
306
  $user_data = get_userdata( $user_id );
307
+ if( isset( $user_data->last_name ) && "" != $user_data->last_name ) {
308
+ $user_last_name = $user_data->last_name;
309
+ }else{
310
+ $user_last_name = '';
311
+ }
312
  } else {
313
  $user_last_name = $user_last_name_temp;
314
  }
woocommerce-abandoned-cart/includes/classes/class-wcal-product-report-table.php CHANGED
@@ -110,7 +110,7 @@ class WCAL_Product_Report_Table extends WP_List_Table {
110
  $blank_cart_info = '{"cart":[]}';
111
  $blank_cart_info_guest = '[]';
112
  $blank_cart = '""';
113
- $query = "SELECT abandoned_cart_time, abandoned_cart_info, recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND abandoned_cart_info NOT LIKE '%$blank_cart%' ORDER BY recovered_cart DESC";
114
  $recover_query = $wpdb->get_results( $query );
115
  $rec_carts_array = array ( );
116
  $recover_product_array = array( );
110
  $blank_cart_info = '{"cart":[]}';
111
  $blank_cart_info_guest = '[]';
112
  $blank_cart = '""';
113
+ $query = "SELECT abandoned_cart_time, abandoned_cart_info, recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND abandoned_cart_info NOT LIKE '$blank_cart' ORDER BY recovered_cart DESC";
114
  $recover_query = $wpdb->get_results( $query );
115
  $rec_carts_array = array ( );
116
  $recover_product_array = array( );
woocommerce-abandoned-cart/includes/classes/class-wcal-recover-orders-table.php CHANGED
@@ -223,13 +223,14 @@ class wcal_Recover_Orders_Table extends WP_List_Table {
223
  $compare_time = $current_time - $cut_off_time;
224
  $blank_cart_info = '{"cart":[]}';
225
  $blank_cart_info_guest = '[]';
 
226
 
227
  $query_ac = "SELECT * FROM " . $wpdb->prefix . "ac_abandoned_cart_history_lite
228
- WHERE abandoned_cart_time >= %d AND abandoned_cart_time <= %d AND recovered_cart > 0 AND abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' ORDER BY recovered_cart desc";
229
  $ac_results = $wpdb->get_results( $wpdb->prepare( $query_ac, $start_date, $end_date ) );
230
 
231
  $query_ac_carts = "SELECT * FROM " . $wpdb->prefix . "ac_abandoned_cart_history_lite
232
- WHERE abandoned_cart_time >= %d AND abandoned_cart_time <= %d AND abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' ";
233
  $ac_carts_results = $wpdb->get_results( $wpdb->prepare( $query_ac_carts, $start_date, $end_date ) );
234
 
235
  $recovered_item = $recovered_total = $count_carts = $total_value = $order_total = 0;
223
  $compare_time = $current_time - $cut_off_time;
224
  $blank_cart_info = '{"cart":[]}';
225
  $blank_cart_info_guest = '[]';
226
+ $blank_cart = '""';
227
 
228
  $query_ac = "SELECT * FROM " . $wpdb->prefix . "ac_abandoned_cart_history_lite
229
+ WHERE abandoned_cart_time >= %d AND abandoned_cart_time <= %d AND recovered_cart > 0 AND abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND abandoned_cart_info NOT LIKE '$blank_cart' ORDER BY recovered_cart desc";
230
  $ac_results = $wpdb->get_results( $wpdb->prepare( $query_ac, $start_date, $end_date ) );
231
 
232
  $query_ac_carts = "SELECT * FROM " . $wpdb->prefix . "ac_abandoned_cart_history_lite
233
+ WHERE abandoned_cart_time >= %d AND abandoned_cart_time <= %d AND abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND abandoned_cart_info NOT LIKE '$blank_cart' ";
234
  $ac_carts_results = $wpdb->get_results( $wpdb->prepare( $query_ac_carts, $start_date, $end_date ) );
235
 
236
  $recovered_item = $recovered_total = $count_carts = $total_value = $order_total = 0;
woocommerce-abandoned-cart/includes/classes/class-wcal-ts-tracker.php DELETED
@@ -1,752 +0,0 @@
1
- <?php
2
- /**
3
- * Abandoned Cart Lite for WooCommerce
4
- *
5
- * The Abandoned Cart lite tracker class adds functionality to track Abandoned Cart lite Data usage based on if the customer opted in.
6
- * No personal information is tracked, only general Abandoned Cart lite settings, abandoned orders and
7
- * recovered orders, abandoned orders amount, recovered orders amount, total templates, total email sent, logged-in users abandoned
8
- * & recovered amount, guest users abandoned and admin email for discount code.
9
- *
10
- * @author Tyche Softwares
11
- * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Tracking-Data
12
- */
13
-
14
- if ( ! defined( 'ABSPATH' ) ) {
15
- exit;
16
- }
17
-
18
- /**
19
- * It will get all the data for the tracking.
20
- * @since 3.9
21
- */
22
- class Class_Wcal_Ts_Tracker {
23
-
24
- /**
25
- * URL to the Tracker API endpoint.
26
- * @var string
27
- */
28
- private static $wcal_api_url = 'http://tracking.tychesoftwares.com/v1/';
29
-
30
- /**
31
- * It will add all the action needed for tracking the data from customers site.
32
- * @since 3.9
33
- */
34
- public static function init() {
35
- add_action( 'wcal_ts_tracker_send_event', array( __CLASS__, 'wcal_ts_send_tracking_data' ) );
36
- add_filter( 'ts_tracker_data', array( __CLASS__, 'wcal_ts_add_plugin_tracking_data' ), 10, 1);
37
- add_filter( 'ts_tracker_opt_out_data', array( __CLASS__, 'wcal_get_data_for_opt_out' ), 10, 1);
38
- }
39
-
40
- /**
41
- * Decide whether to send tracking data or not.
42
- * @hook wcal_ts_tracker_send_event
43
- * @param boolean $override
44
- * @since 3.9
45
- */
46
- public static function wcal_ts_send_tracking_data( $override = false ) {
47
-
48
- if ( ! apply_filters( 'wcal_ts_tracker_send_override', $override ) ) {
49
- // Send a maximum of once per week by default.
50
- $wcal_last_send = self::wcal_ts_get_last_send_time();
51
- if ( $wcal_last_send && $wcal_last_send > apply_filters( 'wcal_ts_tracker_last_send_interval', strtotime( '-1 week' ) ) ) {
52
- return;
53
- }
54
- } else {
55
- // Make sure there is at least a 1 hour delay between override sends, we don't want duplicate calls due to double clicking links.
56
- $wcal_last_send = self::wcal_ts_get_last_send_time();
57
- if ( $wcal_last_send && $wcal_last_send > strtotime( '-1 hours' ) ) {
58
- return;
59
- }
60
- }
61
-
62
- $allow_tracking = get_option('wcal_allow_tracking');
63
- if ( 'yes' == $allow_tracking ){
64
- $override = true;
65
- }
66
-
67
- // Update time first before sending to ensure it is set
68
- update_option( 'wcal_ts_tracker_last_send', time() );
69
-
70
- if( $override == false ) {
71
- $params = array();
72
- $params[ 'tracking_usage' ] = 'no';
73
- $params[ 'url' ] = home_url();
74
- $params[ 'email' ] = apply_filters( 'wcal_ts_tracker_admin_email', get_option( 'admin_email' ) );
75
-
76
- $params = apply_filters( 'ts_tracker_opt_out_data', $params );
77
- } else {
78
-
79
- $params = self::wcal_ts_get_tracking_data();
80
- }
81
-
82
- wp_safe_remote_post( self::$wcal_api_url, array(
83
- 'method' => 'POST',
84
- 'timeout' => 45,
85
- 'redirection' => 5,
86
- 'httpversion' => '1.0',
87
- 'blocking' => false,
88
- 'headers' => array( 'user-agent' => 'TSTracker/' . md5( esc_url( home_url( '/' ) ) ) . ';' ),
89
- 'body' => json_encode( $params ),
90
- 'cookies' => array(),
91
- )
92
- );
93
- }
94
-
95
- /**
96
- * Get the last time tracking data was sent.
97
- * @return int|bool
98
- * @since 3.9
99
- */
100
- private static function wcal_ts_get_last_send_time() {
101
- return apply_filters( 'wcal_ts_tracker_last_send_time', get_option( 'wcal_ts_tracker_last_send', false ) );
102
- }
103
-
104
- /**
105
- * Get all the tracking data.
106
- * @return array
107
- * @since 3.9
108
- */
109
- private static function wcal_ts_get_tracking_data() {
110
- $data = array();
111
-
112
- // General site info
113
- $data[ 'url' ] = home_url();
114
- $data[ 'email' ] = apply_filters( 'wcal_ts_tracker_admin_email', get_option( 'admin_email' ) );
115
-
116
- // WordPress Info
117
- $data[ 'wp' ] = self::wcal_ts_get_wordpress_info();
118
-
119
- $data[ 'theme_info' ] = self::wcal_ts_get_theme_info();
120
-
121
- // Server Info
122
- $data[ 'server' ] = self::wcal_ts_get_server_info();
123
-
124
- // Plugin info
125
- $all_plugins = self::wcal_ts_get_all_plugins();
126
- $data[ 'active_plugins' ] = $all_plugins[ 'active_plugins' ];
127
- $data[ 'inactive_plugins' ] = $all_plugins[ 'inactive_plugins' ];
128
-
129
- //WooCommerce version
130
- $data[ 'wc_plugin_version' ] = self::wcal_ts_get_wc_plugin_version();
131
- return apply_filters( 'ts_tracker_data', $data );
132
- }
133
-
134
- /**
135
- * If admin allow to track the data the it will gather all information and return back.
136
- * @hook ts_tracker_data
137
- * @param array $data
138
- * @return array $data
139
- * @since 3.9
140
- */
141
- public static function wcal_ts_add_plugin_tracking_data ( $data ){
142
-
143
-
144
- if ( isset( $_GET[ 'wcal_tracker_optin' ] ) && isset( $_GET[ 'wcal_tracker_nonce' ] ) && wp_verify_nonce( $_GET[ 'wcal_tracker_nonce' ], 'wcal_tracker_optin' ) ) {
145
-
146
- $plugin_data[ 'ts_meta_data_table_name'] = 'ts_wcal_tracking_meta_data';
147
-
148
- $plugin_data[ 'ts_plugin_name' ] = 'Abandoned Cart Lite for WooCommerce';
149
-
150
- // Store abandoned count info
151
- $plugin_data[ 'abandoned_orders' ] = self::wcal_ts_get_abandoned_order_counts();
152
-
153
- // Store recovred count info
154
- $plugin_data[ 'recovered_orders' ] = self::wcal_ts_get_recovered_order_counts();
155
-
156
- // store abandoned orders amount
157
- $plugin_data[ 'abandoned_orders_amount' ] = self::wcal_ts_get_abandoned_order_total_amount();
158
-
159
- // Store recovered count info
160
- $plugin_data[ 'recovered_orders_amount' ] = self::wcal_ts_get_recovered_order_total_amount();
161
-
162
- // Store abandoned cart emails sent count info
163
- $plugin_data[ 'sent_emails' ] = self::wcal_ts_get_sent_emails_total_count();
164
-
165
- // Store email template count info
166
- $plugin_data[ 'email_templates_data' ] = self::wcal_ts_get_email_templates_data();
167
-
168
- // Store only logged-in users abandoned cart count info
169
- $plugin_data[ 'logged_in_abandoned_orders' ] = self::wcal_ts_get_logged_in_users_abandoned_cart_total_count();
170
-
171
- // Store only logged-in users abandoned cart count info
172
- $plugin_data[ 'guest_abandoned_orders' ] = self::wcal_ts_get_guest_users_abandoned_cart_total_count();
173
-
174
- // Store only logged-in users abandoned cart amount info
175
- $plugin_data[ 'logged_in_abandoned_orders_amount' ] = self::wcal_ts_get_logged_in_users_abandoned_cart_total_amount();
176
-
177
- // store only guest users abandoned cart amount
178
- $plugin_data[ 'guest_abandoned_orders_amount' ] = self::wcal_ts_get_guest_users_abandoned_cart_total_amount();
179
-
180
- // Store only logged-in users recovered cart amount info
181
- $plugin_data[ 'logged_in_recovered_orders_amount' ] = self::wcal_ts_get_logged_in_users_recovered_cart_total_amount();
182
-
183
- // Store only guest users recovered cart amount
184
- $plugin_data[ 'guest_recovered_orders_amount' ] = self::wcal_ts_get_guest_users_recovered_cart_total_amount();
185
-
186
- // Get all plugin options info
187
- $plugin_data[ 'settings' ] = self::wcal_ts_get_all_plugin_options_values();
188
- $plugin_data[ 'plugin_version' ] = self::wcal_ts_get_plugin_version();
189
- $plugin_data[ 'wcal_allow_tracking' ] = get_option ('wcal_allow_tracking');
190
-
191
- $data [ 'plugin_data' ] = $plugin_data;
192
- }
193
- return $data;
194
- }
195
-
196
- /**
197
- * Get data when Admin dont want to share information.
198
- * @param array $params
199
- * @return array $params
200
- * @since 3.9
201
- */
202
- public static function wcal_get_data_for_opt_out( $params ){
203
-
204
- $plugin_data[ 'ts_meta_data_table_name'] = 'ts_wcal_tracking_meta_data';
205
- $plugin_data[ 'ts_plugin_name' ] = 'Abandoned Cart Lite for WooCommerce';
206
- $plugin_data[ 'abandoned_orders_amount' ] = self::wcal_ts_get_abandoned_order_total_amount();
207
- // Store recovered count info
208
- $plugin_data[ 'recovered_orders_amount' ] = self::wcal_ts_get_recovered_order_total_amount();
209
-
210
- $params[ 'plugin_data' ] = $plugin_data;
211
-
212
- return $params;
213
- }
214
-
215
-
216
- /**
217
- * Get WordPress related data.
218
- * @return array $wp_data
219
- * @since 3.9
220
- */
221
- private static function wcal_ts_get_wordpress_info() {
222
- $wp_data = array();
223
-
224
- $memory = wc_let_to_num( WP_MEMORY_LIMIT );
225
-
226
- if ( function_exists( 'memory_get_usage' ) ) {
227
- $system_memory = wc_let_to_num( @ini_get( 'memory_limit' ) );
228
- $memory = max( $memory, $system_memory );
229
- }
230
-
231
- $wp_data[ 'memory_limit' ] = size_format( $memory );
232
- $wp_data[ 'debug_mode' ] = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? 'Yes' : 'No';
233
- $wp_data[ 'locale' ] = get_locale();
234
- $wp_data[ 'wp_version' ] = get_bloginfo( 'version' );
235
- $wp_data[ 'multisite' ] = is_multisite() ? 'Yes' : 'No';
236
-
237
- return $wp_data;
238
- }
239
-
240
- /**
241
- * Get the current theme information, theme name and version.
242
- * @return array
243
- * @since 3.9
244
- */
245
- public static function wcal_ts_get_theme_info() {
246
- $theme_data = wp_get_theme();
247
- $theme_child_theme = is_child_theme() ? 'Yes' : 'No';
248
-
249
- return array( 'theme_name' => $theme_data->Name,
250
- 'theme_version' => $theme_data->Version,
251
- 'child_theme' => $theme_child_theme );
252
- }
253
-
254
- /**
255
- * Get server related information.
256
- * @return array $server_data
257
- * @globals mixed $wpdb
258
- * @since 3.9
259
- */
260
- private static function wcal_ts_get_server_info() {
261
- $server_data = array();
262
-
263
- if ( isset( $_SERVER[ 'SERVER_SOFTWARE' ] ) && ! empty( $_SERVER[ 'SERVER_SOFTWARE' ] ) ) {
264
- $server_data[ 'software' ] = $_SERVER[ 'SERVER_SOFTWARE' ];
265
- }
266
-
267
- if ( function_exists( 'phpversion' ) ) {
268
- $server_data[ 'php_version' ] = phpversion();
269
- }
270
-
271
- if ( function_exists( 'ini_get' ) ) {
272
- $server_data[ 'php_post_max_size' ] = size_format( wc_let_to_num( ini_get( 'post_max_size' ) ) );
273
- $server_data[ 'php_time_limt' ] = ini_get( 'max_execution_time' );
274
- $server_data[ 'php_max_input_vars' ] = ini_get( 'max_input_vars' );
275
- $server_data[ 'php_suhosin' ] = extension_loaded( 'suhosin' ) ? 'Yes' : 'No';
276
- }
277
-
278
- global $wpdb;
279
- $server_data[ 'mysql_version' ] = $wpdb->db_version();
280
-
281
- $server_data[ 'php_max_upload_size' ] = size_format( wp_max_upload_size() );
282
- $server_data[ 'php_default_timezone' ] = date_default_timezone_get();
283
- $server_data[ 'php_soap' ] = class_exists( 'SoapClient' ) ? 'Yes' : 'No';
284
- $server_data[ 'php_fsockopen' ] = function_exists( 'fsockopen' ) ? 'Yes' : 'No';
285
- $server_data[ 'php_curl' ] = function_exists( 'curl_init' ) ? 'Yes' : 'No';
286
-
287
- return $server_data;
288
- }
289
-
290
- /**
291
- * Get all plugins grouped into activated or deactivated.
292
- * @return array $active_plugins
293
- * @return array $plugins
294
- * @since 3.9
295
- */
296
- private static function wcal_ts_get_all_plugins() {
297
- // Ensure get_plugins function is loaded
298
- if ( ! function_exists( 'get_plugins' ) ) {
299
- include ABSPATH . '/wp-admin/includes/plugin.php';
300
- }
301
-
302
- $plugins = get_plugins();
303
- $active_plugins_keys = get_option( 'active_plugins', array() );
304
- $active_plugins = array();
305
-
306
- foreach ( $plugins as $k => $v ) {
307
- // Take care of formatting the data how we want it.
308
- $formatted = array();
309
- $formatted[ 'name' ] = strip_tags( $v[ 'Name' ] );
310
- if ( isset( $v[ 'Version' ] ) ) {
311
- $formatted[ 'version' ] = strip_tags( $v[ 'Version' ] );
312
- }
313
- if ( isset( $v[ 'Author' ] ) ) {
314
- $formatted[ 'author' ] = strip_tags( $v[ 'Author' ] );
315
- }
316
- if ( isset( $v[ 'Network' ] ) ) {
317
- $formatted[ 'network' ] = strip_tags( $v[ 'Network' ] );
318
- }
319
- if ( isset( $v[ 'PluginURI' ] ) ) {
320
- $formatted[ 'plugin_uri' ] = strip_tags( $v[ 'PluginURI' ] );
321
- }
322
- if ( in_array( $k, $active_plugins_keys ) ) {
323
- // Remove active plugins from list so we can show active and inactive separately
324
- unset( $plugins[ $k ] );
325
- $active_plugins[ $k ] = $formatted;
326
- } else {
327
- $plugins[ $k ] = $formatted;
328
- }
329
- }
330
-
331
- return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins );
332
- }
333
-
334
- /**
335
- * Get abandoned orders counts.
336
- * @globals mixed $wpdb
337
- * @return string | int $wcal_order_count
338
- * @since 3.9
339
- */
340
- private static function wcal_ts_get_abandoned_order_counts() {
341
- global $wpdb;
342
- $wcal_order_count = 0;
343
-
344
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
345
- $cut_off_time = $ac_cutoff_time * 60;
346
- $current_time = current_time( 'timestamp' );
347
- $compare_time = $current_time - $cut_off_time;
348
-
349
- $blank_cart_info = '{"cart":[]}';
350
- $blank_cart_info_guest = '[]';
351
-
352
- $wcal_query = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest'";
353
-
354
- $wcal_order_count = $wpdb->get_var( $wcal_query );
355
-
356
- return $wcal_order_count;
357
- }
358
-
359
-
360
- /**
361
- * Get recovered orders counts.
362
- * @globals mixed $wpdb
363
- * @return string | int $wcal_recovered_order_count
364
- * @since 3.9
365
- */
366
- private static function wcal_ts_get_recovered_order_counts(){
367
-
368
- global $wpdb;
369
- $wcal_recovered_order_count = 0;
370
-
371
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
372
- $cut_off_time = $ac_cutoff_time * 60;
373
- $current_time = current_time( 'timestamp' );
374
- $compare_time = $current_time - $cut_off_time;
375
-
376
- $wcal_recovery_query = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE recovered_cart > 0 AND abandoned_cart_time <= '$compare_time'";
377
-
378
- $wcal_recovered_order_count = $wpdb->get_var( $wcal_recovery_query );
379
-
380
- return $wcal_recovered_order_count;
381
- }
382
-
383
- /**
384
- * Get Total abandoned orders amount.
385
- * @globals mixed $wpdb
386
- * @return string | int $wcal_abandoned_orders_amount
387
- * @since 3.9
388
- */
389
- private static function wcal_ts_get_abandoned_order_total_amount(){
390
- global $wpdb;
391
- $wcal_abandoned_orders_amount = 0;
392
-
393
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
394
- $cut_off_time = $ac_cutoff_time * 60;
395
- $current_time = current_time( 'timestamp' );
396
- $compare_time = $current_time - $cut_off_time;
397
-
398
- $blank_cart_info = '{"cart":[]}';
399
- $blank_cart_info_guest = '[]';
400
-
401
- $wcal_abandoned_query = "SELECT abandoned_cart_info FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest'";
402
-
403
- $wcal_abandoned_query_result = $wpdb->get_results( $wcal_abandoned_query );
404
-
405
- $wcal_abandoned_orders_amount = self::wcal_get_abandoned_amount( $wcal_abandoned_query_result );
406
-
407
- return $wcal_abandoned_orders_amount;
408
- }
409
-
410
- /**
411
- * Get Total abandoned orders amount.
412
- * @globals mixed $wpdb
413
- * @param array | object $wcal_abandoned_query_result
414
- * @return string | int $wcal_abandoned_orders_amount
415
- * @since 3.9
416
- */
417
- private static function wcal_get_abandoned_amount( $wcal_abandoned_query_result ){
418
-
419
- $wcal_abandoned_orders_amount = 0;
420
- foreach ( $wcal_abandoned_query_result as $wcal_abandoned_query_key => $wcal_abandoned_query_value ) {
421
- # code...
422
- $cart_info = json_decode( $wcal_abandoned_query_value->abandoned_cart_info );
423
-
424
- $cart_details = array();
425
- if( isset( $cart_info->cart ) ){
426
- $cart_details = $cart_info->cart;
427
- }
428
-
429
- if( count( $cart_details ) > 0 ) {
430
- foreach( $cart_details as $k => $v ) {
431
- if( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
432
- $wcal_abandoned_orders_amount = $wcal_abandoned_orders_amount + $v->line_total + $v->line_subtotal_tax;
433
- } else {
434
- $wcal_abandoned_orders_amount = $wcal_abandoned_orders_amount + $v->line_total;
435
- }
436
- }
437
- }
438
- }
439
- return $wcal_abandoned_orders_amount;
440
- }
441
-
442
- /**
443
- * Get recovered orders total amount.
444
- * @globals mixed $wpdb
445
- * @return string | int $wcal_recovered_orders_amount
446
- * @since 3.9
447
- */
448
- private static function wcal_ts_get_recovered_order_total_amount() {
449
-
450
- global $wpdb;
451
- $wcal_recovered_orders_amount = 0;
452
-
453
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
454
- $cut_off_time = $ac_cutoff_time * 60;
455
- $current_time = current_time( 'timestamp' );
456
- $compare_time = $current_time - $cut_off_time;
457
-
458
- $wcal_recovery_query_amount = "SELECT recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE recovered_cart > 0 AND abandoned_cart_time <= '$compare_time'";
459
-
460
- $wcal_recovered_order_amount_result = $wpdb->get_results( $wcal_recovery_query_amount );
461
-
462
- $wcal_recovered_orders_amount = self::wcal_get_recovered_amount ($wcal_recovered_order_amount_result );
463
-
464
- return $wcal_recovered_orders_amount;
465
- }
466
-
467
- /**
468
- * Get recovered orders total amount.
469
- * @globals mixed $wpdb
470
- * @param array | object $wcal_data
471
- * @return string | int $wcal_recovered_orders_amount
472
- * @since 3.9
473
- */
474
-
475
- private static function wcal_get_recovered_amount ( $wcal_data ){
476
-
477
- $wcal_recovered_orders_amount = 0;
478
-
479
- foreach ($wcal_data as $wcal_data_key => $wcal_data_value) {
480
-
481
- $wcal_order_total = get_post_meta( $wcal_data_value->recovered_cart , '_order_total', true);
482
- $wcal_recovered_orders_amount = $wcal_recovered_orders_amount + $wcal_order_total;
483
- }
484
- return $wcal_recovered_orders_amount;
485
- }
486
-
487
- /**
488
- * Get sent email total count.
489
- * @globals mixed $wpdb
490
- * @return string | int $wcal_sent_emails_count
491
- * @since 3.9
492
- */
493
- private static function wcal_ts_get_sent_emails_total_count(){
494
-
495
- global $wpdb;
496
- $wcal_sent_emails_count = 0;
497
- $wcal_sent_emails_query = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_sent_history_lite`";
498
- $wcal_sent_emails_count = $wpdb->get_var( $wcal_sent_emails_query );
499
- return $wcal_sent_emails_count;
500
- }
501
-
502
- /**
503
- * Get email templates total count.
504
- * @globals mixed $wpdb
505
- * @return array $wcal_templates_data
506
- * @since 3.9
507
- */
508
- private static function wcal_ts_get_email_templates_data(){
509
-
510
- global $wpdb;
511
- $wcal_email_templates_count = 0;
512
- $wcal_email_templates_query = "SELECT id, is_active, is_wc_template,frequency, day_or_hour FROM `" . $wpdb->prefix . "ac_email_templates_lite`";
513
- $wcal_email_templates_results = $wpdb->get_results( $wcal_email_templates_query );
514
-
515
- $wcal_email_templates_count = count( $wcal_email_templates_results );
516
-
517
- $wcal_templates_data = array();
518
- $wcal_templates_data ['total_templates'] = $wcal_email_templates_count;
519
-
520
- foreach ($wcal_email_templates_results as $wcal_email_templates_results_key => $wcal_email_templates_results_value ) {
521
-
522
- $wcal_template_time = $wcal_email_templates_results_value->frequency . ' ' .$wcal_email_templates_results_value->day_or_hour ;
523
-
524
- $wcal_get_total_email_sent_for_template = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_sent_history_lite` WHERE template_id = ". $wcal_email_templates_results_value->id;
525
- $wcal_get_total_email_sent_for_template_count = $wpdb->get_var( $wcal_get_total_email_sent_for_template );
526
-
527
- $wcal_templates_data [ "template_id_" . $wcal_email_templates_results_value->id ] ['is_activate'] = ( $wcal_email_templates_results_value->is_active == 1 ) ? 'Active' : 'Deactive';
528
- $wcal_templates_data [ "template_id_" . $wcal_email_templates_results_value->id ] ['is_wc_template'] = ( $wcal_email_templates_results_value->is_wc_template == 1 ) ? 'Yes' : 'No';
529
- $wcal_templates_data [ "template_id_" . $wcal_email_templates_results_value->id ] ['template_time'] = $wcal_template_time;
530
- $wcal_templates_data [ "template_id_" . $wcal_email_templates_results_value->id ] ['total_email_sent'] = $wcal_get_total_email_sent_for_template_count;
531
- }
532
-
533
- return $wcal_templates_data;
534
- }
535
-
536
- /**
537
- * Get logged-in users total abandoned count.
538
- * @globals mixed $wpdb
539
- * @return string | int $wcal_logged_in_user_query_count
540
- * @since 3.9
541
- */
542
- private static function wcal_ts_get_logged_in_users_abandoned_cart_total_count (){
543
-
544
- global $wpdb;
545
- $wcal_logged_in_user_query_count = 0;
546
-
547
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
548
- $cut_off_time = $ac_cutoff_time * 60;
549
- $current_time = current_time( 'timestamp' );
550
- $compare_time = $current_time - $cut_off_time;
551
-
552
- $blank_cart_info = '{"cart":[]}';
553
- $blank_cart_info_guest = '[]';
554
-
555
- $wcal_logged_in_user_query = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND user_id < 63000000 AND user_id != 0";
556
-
557
- $wcal_logged_in_user_query_count = $wpdb->get_var( $wcal_logged_in_user_query );
558
-
559
- return $wcal_logged_in_user_query_count;
560
- }
561
-
562
- /**
563
- * Get Guest users total abandoned count.
564
- * @globals mixed $wpdb
565
- * @return string | int $wcal_guest_user_query_count
566
- * @since 3.9
567
- */
568
- private static function wcal_ts_get_guest_users_abandoned_cart_total_count(){
569
- global $wpdb;
570
- $wcal_guest_user_query_count = 0;
571
-
572
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
573
- $cut_off_time = $ac_cutoff_time * 60;
574
- $current_time = current_time( 'timestamp' );
575
- $compare_time = $current_time - $cut_off_time;
576
-
577
- $blank_cart_info = '{"cart":[]}';
578
- $blank_cart_info_guest = '[]';
579
-
580
- $wcal_guest_user_query = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND user_id >= 63000000 AND user_id != 0";
581
-
582
- $wcal_guest_user_query_count = $wpdb->get_var( $wcal_guest_user_query );
583
-
584
- return $wcal_guest_user_query_count;
585
- }
586
-
587
- /**
588
- * Get logged-in users total abandoned amount.
589
- * @globals mixed $wpdb
590
- * @return string | int $wcal_abandoned_orders_amount
591
- * @since 3.9
592
- */
593
- private static function wcal_ts_get_logged_in_users_abandoned_cart_total_amount (){
594
-
595
- global $wpdb;
596
- $wcal_abandoned_orders_amount = 0;
597
-
598
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
599
- $cut_off_time = $ac_cutoff_time * 60;
600
- $current_time = current_time( 'timestamp' );
601
- $compare_time = $current_time - $cut_off_time;
602
-
603
- $blank_cart_info = '{"cart":[]}';
604
- $blank_cart_info_guest = '[]';
605
-
606
- $wcal_abandoned_query = "SELECT abandoned_cart_info FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND user_id < 63000000 AND user_id != 0 ";
607
-
608
- $wcal_abandoned_query_result = $wpdb->get_results( $wcal_abandoned_query );
609
-
610
- $wcal_abandoned_orders_amount = self::wcal_get_abandoned_amount( $wcal_abandoned_query_result );
611
-
612
- return $wcal_abandoned_orders_amount;
613
- }
614
-
615
- /**
616
- * Get Guest users total abandoned amount.
617
- * @globals mixed $wpdb
618
- * @return string | int $wcal_abandoned_orders_amount
619
- * @since 3.9
620
- */
621
- private static function wcal_ts_get_guest_users_abandoned_cart_total_amount (){
622
-
623
- global $wpdb;
624
- $wcal_abandoned_orders_amount = 0;
625
-
626
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
627
- $cut_off_time = $ac_cutoff_time * 60;
628
- $current_time = current_time( 'timestamp' );
629
- $compare_time = $current_time - $cut_off_time;
630
-
631
- $blank_cart_info = '{"cart":[]}';
632
- $blank_cart_info_guest = '[]';
633
-
634
- $wcal_abandoned_query = "SELECT abandoned_cart_info FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND user_id >= 63000000 AND user_id != 0 ";
635
-
636
- $wcal_abandoned_query_result = $wpdb->get_results( $wcal_abandoned_query );
637
-
638
- $wcal_abandoned_orders_amount = self::wcal_get_abandoned_amount( $wcal_abandoned_query_result );
639
-
640
- return $wcal_abandoned_orders_amount;
641
- }
642
-
643
- /**
644
- * Get logged-in users total recovered amount.
645
- * @globals mixed $wpdb
646
- * @return string | int $wcal_recovered_orders_amount
647
- * @since 3.9
648
- */
649
- private static function wcal_ts_get_logged_in_users_recovered_cart_total_amount(){
650
-
651
- global $wpdb;
652
- $wcal_recovered_orders_amount = 0;
653
-
654
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
655
- $cut_off_time = $ac_cutoff_time * 60;
656
- $current_time = current_time( 'timestamp' );
657
- $compare_time = $current_time - $cut_off_time;
658
-
659
- $wcal_recovery_query_amount = "SELECT recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE recovered_cart > 0 AND abandoned_cart_time <= '$compare_time' AND user_id < 63000000 AND user_id != 0 ";
660
-
661
- $wcal_recovered_order_amount_result = $wpdb->get_results( $wcal_recovery_query_amount );
662
-
663
- $wcal_recovered_orders_amount = self::wcal_get_recovered_amount ($wcal_recovered_order_amount_result );
664
-
665
- return $wcal_recovered_orders_amount;
666
-
667
- }
668
-
669
-
670
- /**
671
- * Get Guest users total recovered amount.
672
- * @globals mixed $wpdb
673
- * @return string | int $wcal_recovered_orders_amount
674
- * @since 3.9
675
- */
676
- private static function wcal_ts_get_guest_users_recovered_cart_total_amount (){
677
-
678
- global $wpdb;
679
- $wcal_recovered_orders_amount = 0;
680
-
681
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
682
- $cut_off_time = $ac_cutoff_time * 60;
683
- $current_time = current_time( 'timestamp' );
684
- $compare_time = $current_time - $cut_off_time;
685
-
686
- $wcal_recovery_query_amount = "SELECT recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE recovered_cart > 0 AND abandoned_cart_time <= '$compare_time' AND user_id >= 63000000 AND user_id != 0 ";
687
-
688
- $wcal_recovered_order_amount_result = $wpdb->get_results( $wcal_recovery_query_amount );
689
-
690
- $wcal_recovered_orders_amount = self::wcal_get_recovered_amount ($wcal_recovered_order_amount_result );
691
-
692
- return $wcal_recovered_orders_amount;
693
-
694
- }
695
- /**
696
- * Get all options of the plugin.
697
- * @return array
698
- * @since 3.9
699
- */
700
- private static function wcal_ts_get_all_plugin_options_values() {
701
-
702
- return array(
703
- 'wcal_cart_cut_off_time' => get_option( 'ac_lite_cart_abandoned_time' ),
704
- 'wcal_admin_recovery_email' => get_option( 'ac_lite_email_admin_on_recovery' ),
705
- 'wcal_capture_visitors_cart' => get_option( 'ac_lite_track_guest_cart_from_cart_page' )
706
- );
707
- }
708
-
709
- /**
710
- * Get WooCommerce version.
711
- * @return string | int
712
- * @since 3.9
713
- */
714
- private static function wcal_ts_get_wc_plugin_version() {
715
- return WC()->version;
716
- }
717
-
718
- /**
719
- * Get License Key for the plugin.
720
- * @return string
721
- * @since 3.9
722
- */
723
- private static function wcal_ts_get_plugin_license_key() {
724
- return 'Abandoned Cart Lite';
725
- }
726
-
727
- /**
728
- * Get the plugin version.
729
- * @return string | int $wcal_plugin_version
730
- * @since 3.9
731
- */
732
- private static function wcal_ts_get_plugin_version() {
733
- $wcal_plugin_version = self::wcal_plugin_get_version();
734
- return $wcal_plugin_version;
735
- }
736
-
737
- /**
738
- * Get the plugin version.
739
- * @return string | int $plugin_version
740
- * @since 3.9
741
- */
742
- public static function wcal_plugin_get_version() {
743
- $plugin_path = dirname ( dirname ( dirname ( __FILE__ ) ) ) ;
744
- $plugin_path_with_base_file_name = $plugin_path . "/woocommerce-ac.php";
745
- $plugin_data = get_plugin_data( $plugin_path_with_base_file_name );
746
- $plugin_version = $plugin_data['Version'];
747
-
748
- return $plugin_version;
749
- }
750
-
751
- }
752
- Class_Wcal_Ts_Tracker::init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
woocommerce-abandoned-cart/includes/component/README.md ADDED
@@ -0,0 +1 @@
 
1
+ # ts-plugin-features-boilerplate
woocommerce-abandoned-cart/includes/component/WooCommerce-Check/Instructions ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ Add a notice if the WooCommerce is not active.
2
+
3
+ To add this feature to the plugin, you can follow the below steps:
4
+
5
+ 1. Copy the ts-woo-active.php file into your plugin file.
6
+
7
+ 2. Include the file ts-woo-active.php once when on the admin page. This can be done with is_admin() function.
8
+
9
+ 3. Change the value of the $plugin_name and $plugin_file variable of the TS_Woo_Active class with the name of your plugin.
10
+
11
+ 4. Now if the WooCommerce plugin is inactive, then our plugin will be inactive automatically with a notice displayed.
woocommerce-abandoned-cart/includes/component/WooCommerce-Check/ts-woo-active.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ /**
7
+ * TS_Woo_Active Class
8
+ *
9
+ * @class TS_Woo_Active
10
+ */
11
+
12
+ class TS_Woo_Active {
13
+
14
+ /**
15
+ * @var string The name of the plugin
16
+ * @access public
17
+ */
18
+ public $plugin_name = '';
19
+
20
+ /**
21
+ * Store the plugin name.
22
+ * @var string Path of the plugin name.
23
+ * @access public
24
+ */
25
+ public $plugin_file = '';
26
+
27
+ /**
28
+ * Store the plguin locale.
29
+ * @var string Used Plugin locale.
30
+ * @access public
31
+ */
32
+ public $ts_locale = '';
33
+
34
+ public function __construct( $ts_plugin_name = '' , $ts_file_name = '', $ts_locale = '' ) {
35
+
36
+ $this->plugin_name = $ts_plugin_name;
37
+ $this->plugin_file = $ts_file_name;
38
+ $this->ts_locale = $ts_locale;
39
+
40
+ //Check for WooCommerce plugin
41
+ if ( '' != $this->plugin_file ) {
42
+ add_action( 'admin_init', array( &$this, 'ts_check_if_woocommerce_active' ) );
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Checks if the WooCommerce plugin is active or not. If it is not active then it will display a notice.
48
+ */
49
+ public function ts_check_if_woocommerce_active() {
50
+ if ( ! $this->ts_check_woo_installed() ) {
51
+ if ( is_plugin_active( $this->plugin_file ) ) {
52
+ deactivate_plugins( $this->plugin_file );
53
+ add_action( 'admin_notices', array( &$this, 'ts_disabled_notice' ) );
54
+ if ( isset( $_GET[ 'activate' ] ) ) {
55
+ unset( $_GET[ 'activate' ] );
56
+ }
57
+ }
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Check if WooCommerce is active.
63
+ */
64
+ public function ts_check_woo_installed() {
65
+ if ( class_exists( 'WooCommerce' ) ) {
66
+ return true;
67
+ } else {
68
+ return false;
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Display a notice in the admin plugins page if the plugin is activated while WooCommerce is deactivated.
74
+ */
75
+ public function ts_disabled_notice() {
76
+ $class = 'notice notice-error';
77
+ $message = __( $this->plugin_name . ' plugin requires WooCommerce installed and activate.', $this->ts_locale );
78
+ printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
79
+ }
80
+ }
woocommerce-abandoned-cart/includes/component/deactivate-survey-popup/Instructions ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Add a popup with some questions when the plugin is deactivated.
2
+
3
+ To add this feature to the plugin, you can follow the below steps:
4
+
5
+ 1. Copy the class-ts-deactivation.php file.
6
+
7
+ 2. Include the file class-ts-deactivation.php once when on the admin page. This can be done with is_admin() function.
8
+
9
+ 3. You need to pass the 2 parameters to the init function of the TS_deactivate class. You need to change the value of the variable as per the respective plugin.
10
+
11
+ $wcap_file_name = 'woocommerce-abandon-cart-pro/woocommerce-ac.php';
12
+ $wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
13
+
14
+ $wcap_deativate = new TS_deactivate;
15
+ $wcap_deativate->init( $wcap_file_name, $wcap_plugin_name );
16
+
17
+ 4. In respective plugin you have to add the filter as below:
18
+ The filter name: ts_deativate_plugin_questions
19
+
20
+ Please follow the below Standard method to add your plugin specific deactivate questions.
21
+
22
+ Note: Dont chnage the below things in the function:
23
+
24
+ 1. Main index: 0,1,2,3
25
+ 2. The "id" paramter value in sub array.
26
+
27
+ add_filter ( 'ts_deativate_plugin_questions', array( 'Wcap_Common', 'wcap_deactivate_add_questions' ), 10, 1 );
28
+
29
+ /**
30
+ * It will add the Questions while admin deactivate the plugin.
31
+ * @hook ts_deativate_plugin_questions
32
+ * @param array $wcap_add_questions Blank array
33
+ * @return array $wcap_add_questions List of all questions.
34
+ */
35
+ public static function wcap_deactivate_add_questions ( $wcap_add_questions ) {
36
+
37
+ $wcap_add_questions = array(
38
+ 0 => array(
39
+ 'id' => 4,
40
+ 'text' => __( "Custom Delivery Settings are not working", "woocommerce-ac" ),
41
+ 'input_type' => '',
42
+ 'input_placeholder' => ''
43
+ ),
44
+ 1 => array(
45
+ 'id' => 5,
46
+ 'text' => __( "Minimum Delivery Time (in hours) is not working as expected", "woocommerce-ac" ),
47
+ 'input_type' => '',
48
+ 'input_placeholder' => ''
49
+ ),
50
+ 2 => array(
51
+ 'id' => 6,
52
+ 'text' => __( "Shipping Days feature is not working", "woocommerce-ac" ),
53
+ 'input_type' => '',
54
+ 'input_placeholder' => ''
55
+ ),
56
+ 3 => array(
57
+ 'id' => 7,
58
+ 'text' => __( "The plugin is not compatible with another plugin", "woocommerce-ac" ),
59
+ 'input_type' => 'textfield',
60
+ 'input_placeholder' => __( "Which Plugin?", "ts-deactivation-survey" )
61
+ )
62
+
63
+ );
64
+ return $wcap_add_questions;
65
+ }
66
+
67
+ Once the above changes are done. Data will be stored in the tychesod_tracking database in the staging cpanel.
68
+
69
+ - The ts_tracking_data table will store the unique tracking id, site URL and admin email address.
70
+
71
+ - The ts_deactivation_survery table will store the meta for the reason for deactivating the plugin. Here tracking_id will be same as tracking id in ts_tracking_data.
72
+
73
+ - The ts_tracking_plugins table will store the plugin name from which the action is performed. Here tracking_id will be same as tracking id in ts_tracking_data.
woocommerce-abandoned-cart/includes/component/deactivate-survey-popup/class-ts-deactivation.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Contains the logic for deactivation popups
5
+ * @since 1.0.0
6
+ */
7
+ class TS_deactivate {
8
+ public static $ts_deactivation_str;
9
+
10
+ public static $ts_generic_questions;
11
+
12
+ public static $ts_plugin_specific_questions;
13
+
14
+ /**
15
+ * URL to the Tracker API endpoint.
16
+ * @var string
17
+ */
18
+
19
+ private static $api_url = 'http://trackingdev.tychesoftwares.com/v1/';
20
+
21
+ /**
22
+ * @var string Plugin name
23
+ * @access public
24
+ */
25
+
26
+ public static $plugin_name = '';
27
+
28
+ /**
29
+ * @var string Plugin file name
30
+ * @access public
31
+ */
32
+ public static $ts_plugin_file_name = '';
33
+
34
+ /**
35
+ * @var string Plugin URL
36
+ * @access public
37
+ */
38
+ public static $ts_plugin_url = '';
39
+
40
+ /**
41
+ * Initialization of hooks where we prepare the functionality to ask use for survey
42
+ */
43
+ public static function init( $ts_plugin_file_name = '', $ts_plugin_name = '' ) {
44
+ self::$ts_plugin_file_name = $ts_plugin_file_name;
45
+ self::$plugin_name = $ts_plugin_name;
46
+ self::$ts_plugin_url = untrailingslashit( plugin_dir_path ( __FILE__ ) );
47
+
48
+ self::ts_load_all_str();
49
+ add_action( 'admin_footer', array( __CLASS__, 'maybe_load_deactivate_options' ) );
50
+ add_action( 'wp_ajax_ts_submit_uninstall_reason', array( __CLASS__, '_submit_uninstall_reason_action' ) );
51
+
52
+ add_filter( 'plugin_action_links_' . self::$ts_plugin_file_name, array( __CLASS__, 'ts_plugin_settings_link' ) );
53
+ }
54
+
55
+ /**
56
+ * Settings link on Plugins page
57
+ *
58
+ * @access public
59
+ * @param array $links
60
+ * @return array
61
+ */
62
+ public static function ts_plugin_settings_link( $links ) {
63
+
64
+ if ( isset ( $links['deactivate'] ) ) {
65
+ $links['deactivate'] .= '<i class="ts-slug" data-slug="' . self::$ts_plugin_file_name . '"></i>';
66
+ }
67
+ return $links;
68
+ }
69
+
70
+ /**
71
+ * Localizes all the string used
72
+ */
73
+ public static function ts_load_all_str() {
74
+ self::$ts_deactivation_str = array(
75
+ "deactivation-share-reason" => __( "If you have a moment, please let us know why you are deactivating", "ts-deactivation-survey" ),
76
+ "deactivation-modal-button-submit" => __( "Submit & Deactivate", "ts-deactivation-survey" ),
77
+ "deactivation-modal-button-deactivate" => __( "Deactivate", "ts-deactivation-survey" ),
78
+ "deactivation-modal-button-cancel" => __( "Cancel", "ts-deactivation-survey" ),
79
+ "deactivation-modal-button-confirm" => __( 'Yes - Deactivate', 'ts-deactivation-survey' ),
80
+ );
81
+
82
+ self::$ts_generic_questions = array(
83
+ "reason-found-a-better-plugin" => __( "I found a better plugin", "ts-deactivation-survey" ),
84
+ "placeholder-plugin-name" => __( "What's the plugin's name?", "ts-deactivation-survey" ),
85
+ "reason-needed-for-a-short-period" => __( "I only needed the plugin for a short period", "ts-deactivation-survey" ),
86
+ "reason-not-working" => __( "The plugin is not working", "ts-deactivation-survey" ),
87
+ "placeholder-share-what-didnt-work" => __( "Kindly share what didn't work so we can fix it for future users...", "ts-deactivation-survey" ),
88
+ "reason-great-but-need-specific-feature" => __( "The plugin is great, but I need specific feature that you don't support", "ts-deactivation-survey" ),
89
+ "placeholder-feature" => __( "What feature?", "ts-deactivation-survey" ),
90
+ "reason-dont-like-to-share-my-information" => __( "I don't like to share my information with you", "ts-deactivation-survey" ),
91
+ "reason-other" => _x( "Other", "the text of the 'other' reason for deactivating the plugin that is shown in the modal box.", "ts-deactivation-survey" ),
92
+ );
93
+ }
94
+
95
+ /**
96
+ * Checking current page and pushing html, js and css for this task
97
+ * @global string $pagenow current admin page
98
+ * @global array $VARS global vars to pass to view file
99
+ */
100
+ public static function maybe_load_deactivate_options() {
101
+ global $pagenow;
102
+ if ( $pagenow == "plugins.php" ) {
103
+ global $VARS;
104
+ $VARS = array( 'slug' => "asvbsd", 'reasons' => self::deactivate_options() );
105
+ include_once self::$ts_plugin_url . "/template/ts-deactivate-modal.php";
106
+ }
107
+ }
108
+
109
+ /**
110
+ * deactivation reasons in array format
111
+ * @return array reasons array
112
+ * @since 1.0.0
113
+ */
114
+ public static function deactivate_options() {
115
+
116
+ self::$ts_plugin_specific_questions = apply_filters( 'ts_deativate_plugin_questions', array () );
117
+
118
+
119
+ $reason_found_better_plugin = array(
120
+ 'id' => 2,
121
+ 'text' => self::$ts_generic_questions[ 'reason-found-a-better-plugin' ],
122
+ 'input_type' => 'textfield',
123
+ 'input_placeholder' => self::$ts_generic_questions[ 'placeholder-plugin-name' ]
124
+ );
125
+
126
+ $reason_not_working = array(
127
+ 'id' => 3,
128
+ 'text' => self::$ts_generic_questions[ 'reason-not-working' ],
129
+ 'input_type' => 'textfield',
130
+ 'input_placeholder' => self::$ts_generic_questions[ 'placeholder-share-what-didnt-work' ]
131
+ );
132
+
133
+ $reason_great_but_need_specific_feature = array(
134
+ 'id' => 8,
135
+ 'text' => self::$ts_generic_questions[ 'reason-great-but-need-specific-feature' ],
136
+ 'input_type' => 'textfield',
137
+ 'input_placeholder' => self::$ts_generic_questions[ 'placeholder-feature' ]
138
+ );
139
+
140
+ $reason_plugin_not_compatible = isset ( self::$ts_plugin_specific_questions[ 3 ] ) ? self::$ts_plugin_specific_questions[ 3 ] : '' ;
141
+
142
+ $reason_other = array(
143
+ 'id' => 10,
144
+ 'text' => self::$ts_generic_questions[ 'reason-other' ],
145
+ 'input_type' => 'textfield',
146
+ 'input_placeholder' => ''
147
+ );
148
+
149
+ $long_term_user_reasons = array(
150
+ array(
151
+ 'id' => 1,
152
+ 'text' => self::$ts_generic_questions[ 'reason-needed-for-a-short-period' ],
153
+ 'input_type' => '',
154
+ 'input_placeholder' => ''
155
+ ),
156
+ $reason_found_better_plugin,
157
+ $reason_not_working,
158
+ isset ( self::$ts_plugin_specific_questions[ 0 ] ) ? self::$ts_plugin_specific_questions[ 0 ] : '',
159
+ isset ( self::$ts_plugin_specific_questions[ 1 ] ) ? self::$ts_plugin_specific_questions[ 1 ] : '',
160
+ isset ( self::$ts_plugin_specific_questions[ 2 ] ) ? self::$ts_plugin_specific_questions[ 2 ] : '',
161
+ $reason_plugin_not_compatible,
162
+ $reason_great_but_need_specific_feature,
163
+ array(
164
+ 'id' => 9,
165
+ 'text' => self::$ts_generic_questions[ 'reason-dont-like-to-share-my-information' ],
166
+ 'input_type' => '',
167
+ 'input_placeholder' => ''
168
+ )
169
+ );
170
+
171
+
172
+ $uninstall_reasons[ 'default' ] = $long_term_user_reasons;
173
+
174
+ $uninstall_reasons = apply_filters( 'ts_uninstall_reasons', $uninstall_reasons );
175
+ array_push( $uninstall_reasons['default'], $reason_other );
176
+
177
+ return $uninstall_reasons;
178
+ }
179
+
180
+ /**
181
+ * get exact str against the slug
182
+ *
183
+ * @param type $slug
184
+ *
185
+ * @return type
186
+ */
187
+ public static function load_str( $slug ) {
188
+ return self::$ts_deactivation_str[ $slug ];
189
+ }
190
+
191
+ /**
192
+ * Called after the user has submitted his reason for deactivating the plugin.
193
+ *
194
+ * @since 1.1.2
195
+ */
196
+ public static function _submit_uninstall_reason_action() {
197
+ if ( ! isset( $_POST[ 'reason_id' ] ) ) {
198
+ exit;
199
+ }
200
+
201
+ $plugin_data = array();
202
+
203
+ $plugin_data[ 'url' ] = home_url();
204
+ $plugin_data[ 'email' ] = apply_filters( 'ts_tracker_admin_email', get_option( 'admin_email' ) );
205
+
206
+ $reason_info = isset( $_REQUEST[ 'reason_info' ] ) ? trim( stripslashes( $_REQUEST[ 'reason_info' ] ) ) : '';
207
+
208
+ $plugin_data[ 'reason_id' ] = $_POST[ 'reason_id' ];
209
+ $plugin_data[ 'reason_info' ] = substr( $reason_info, 0, 128 );
210
+ $plugin_data[ 'reason_text' ] = $_POST[ 'reason_text' ];
211
+
212
+ $plugin_data[ 'ts_meta_data_table_name' ] = 'ts_deactivation_survey';
213
+ $plugin_data[ 'ts_plugin_name' ] = self::$plugin_name;
214
+
215
+ wp_safe_remote_post( self::$api_url, array(
216
+ 'method' => 'POST',
217
+ 'timeout' => 45,
218
+ 'redirection' => 5,
219
+ 'httpversion' => '1.0',
220
+ 'blocking' => false,
221
+ 'headers' => array( 'user-agent' => 'TSTracker/' . md5( esc_url( home_url( '/' ) ) ) . ';' ),
222
+ 'body' => json_encode( $plugin_data ),
223
+ 'cookies' => array(),
224
+ )
225
+ );
226
+ // Print '1' for successful operation.
227
+ echo 1;
228
+ exit;
229
+ }
230
+
231
+ }
woocommerce-abandoned-cart/includes/component/deactivate-survey-popup/template/ts-deactivate-modal.php ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ $slug = $VARS[ 'slug' ];
7
+ $confirmation_message = '';
8
+ $reasons = $VARS['reasons']['default'];
9
+ $reasons_list_items_html = '';
10
+ $plugin_customized_reasons = array();
11
+ $incr = 0;
12
+
13
+ foreach ( $reasons as $reason ) {
14
+ $list_item_classes = 'reason' . ( ! empty( $reason['input_type'] ) ? ' has-input' : '' ) . ( ( isset( $reason[ 'html' ] ) && ( ! empty( $reason[ 'html' ] ) ) ) ? ' has_html' : '' );
15
+
16
+ $reason_html = ( isset( $reason['html'] ) && ( ! empty( $reason['html'] ) ) ) ? '<div class="reason_html">' . $reason['html'] . '</div>' : '';
17
+
18
+ $ts_reason_input_type = ( isset( $reason['input_type'] ) && ( ! empty( $reason['input_type'] ) ) ) ? $reason['input_type'] : '';
19
+
20
+ $ts_reason_input_placeholder = ( isset( $reason['input_placeholder'] ) && ( ! empty( $reason['input_placeholder'] ) ) ) ? $reason['input_placeholder'] : '';
21
+
22
+ $ts_reason_id = ( isset( $reason['id'] ) && ( ! empty( $reason['id'] ) ) ) ? $reason['id'] : '';
23
+
24
+ $ts_reason_text = ( isset( $reason['text'] ) && ( ! empty( $reason['text'] ) ) ) ? $reason['text'] : '';
25
+
26
+ $selected = "";
27
+ if ( $incr == 0 ) {
28
+ $selected = "checked";
29
+ }
30
+
31
+ $reasons_list_items_html .= '<li class="' . $list_item_classes . '" data-input-type="' . $ts_reason_input_type . '" data-input-placeholder="' . $ts_reason_input_placeholder . '"><label><span><input type="radio" name="selected-reason" value="' . $ts_reason_id . '" ' . $selected . '/></span><span>' . $ts_reason_text . '</span></label>' . $reason_html . '</li>';
32
+ $incr ++;
33
+ }
34
+
35
+ ?>
36
+ <style>
37
+ .ts-modal {
38
+ position: fixed;
39
+ overflow: auto;
40
+ height: 100%;
41
+ width: 100%;
42
+ top: 0;
43
+ z-index: 100000;
44
+ display: none;
45
+ background: rgba(0, 0, 0, 0.6)
46
+ }
47
+
48
+ .ts-modal .ts-modal-dialog {
49
+ background: transparent;
50
+ position: absolute;
51
+ left: 50%;
52
+ margin-left: -298px;
53
+ padding-bottom: 30px;
54
+ top: -100%;
55
+ z-index: 100001;
56
+ width: 596px
57
+ }
58
+
59
+ .ts-modal li.reason.has_html .reason_html {
60
+ display: none;
61
+ border: 1px solid #ddd;
62
+ padding: 4px 6px;
63
+ margin: 6px 0 0 20px;
64
+ }
65
+
66
+ .ts-modal li.reason.has_html.li-active .reason_html {
67
+ display: block;
68
+ }
69
+
70
+ @media (max-width: 650px) {
71
+ .ts-modal .ts-modal-dialog {
72
+ margin-left: -50%;
73
+ box-sizing: border-box;
74
+ padding-left: 10px;
75
+ padding-right: 10px;
76
+ width: 100%
77
+ }
78
+
79
+ .ts-modal .ts-modal-dialog .ts-modal-panel > h3 > strong {
80
+ font-size: 1.3em
81
+ }
82
+
83
+ .ts-modal .ts-modal-dialog li.reason {
84
+ margin-bottom: 10px
85
+ }
86
+
87
+ .ts-modal .ts-modal-dialog li.reason .reason-input {
88
+ margin-left: 29px
89
+ }
90
+
91
+ .ts-modal .ts-modal-dialog li.reason label {
92
+ display: table
93
+ }
94
+
95
+ .ts-modal .ts-modal-dialog li.reason label > span {
96
+ display: table-cell;
97
+ font-size: 1.3em
98
+ }
99
+ }
100
+
101
+ .ts-modal.active {
102
+ display: block
103
+ }
104
+
105
+ .ts-modal.active:before {
106
+ display: block
107
+ }
108
+
109
+ .ts-modal.active .ts-modal-dialog {
110
+ top: 10%
111
+ }
112
+
113
+ .ts-modal .ts-modal-body, .ts-modal .ts-modal-footer {
114
+ border: 0;
115
+ background: #fefefe;
116
+ padding: 20px
117
+ }
118
+
119
+ .ts-modal .ts-modal-body {
120
+ border-bottom: 0
121
+ }
122
+
123
+ .ts-modal .ts-modal-body h2 {
124
+ font-size: 20px
125
+ }
126
+
127
+ .ts-modal .ts-modal-body > div {
128
+ margin-top: 10px
129
+ }
130
+
131
+ .ts-modal .ts-modal-body > div h2 {
132
+ font-weight: bold;
133
+ font-size: 20px;
134
+ margin-top: 0
135
+ }
136
+
137
+ .ts-modal .ts-modal-footer {
138
+ border-top: #eeeeee solid 1px;
139
+ text-align: right
140
+ }
141
+
142
+ .ts-modal .ts-modal-footer > .button {
143
+ margin: 0 7px
144
+ }
145
+
146
+ .ts-modal .ts-modal-footer > .button:first-child {
147
+ margin: 0
148
+ }
149
+
150
+ .ts-modal .ts-modal-panel:not(.active) {
151
+ display: none
152
+ }
153
+
154
+ .ts-modal .reason-input {
155
+ margin: 3px 0 3px 22px
156
+ }
157
+
158
+ .ts-modal .reason-input input, .ts-modal .reason-input textarea {
159
+ width: 100%
160
+ }
161
+
162
+ body.has-ts-modal {
163
+ overflow: hidden
164
+ }
165
+
166
+ #the-list .deactivate > .ts-slug {
167
+ display: none
168
+ }
169
+
170
+ .ts-modal li.reason-hide {
171
+ display: none;
172
+ }
173
+
174
+ </style>
175
+ <script type="text/javascript">
176
+ var currentPluginName = "";
177
+ var TSCustomReasons = {};
178
+ var TSDefaultReason = {};
179
+ ( function ($) {
180
+ var $deactivateLinks = {};
181
+ var reasonsHtml = <?php echo json_encode( $reasons_list_items_html ); ?>,
182
+ modalHtml =
183
+ '<div class="ts-modal<?php echo ( $confirmation_message == "" ) ? ' no-confirmation-message' : ''; ?>">'
184
+ + ' <div class="ts-modal-dialog">'
185
+ + ' <div class="ts-modal-body">'
186
+ + ' <div class="ts-modal-panel" data-panel-id="confirm"><p><?php echo $confirmation_message; ?></p></div>'
187
+ + ' <div class="ts-modal-panel active" data-panel-id="reasons"><h3><strong><?php printf( TS_deactivate::load_str( 'deactivation-share-reason' ) ); ?>:</strong></h3><ul id="reasons-list">' + reasonsHtml + '</ul></div>'
188
+ + ' </div>'
189
+ + ' <div class="ts-modal-footer">'
190
+ + ' <a href="#" class="button button-secondary button-deactivate"></a>'
191
+ + ' <a href="#" class="button button-primary button-close"><?php printf( TS_deactivate::load_str( 'deactivation-modal-button-cancel' ) ); ?></a>'
192
+ + ' </div>'
193
+ + ' </div>'
194
+ + '</div>',
195
+ $modal = $(modalHtml),
196
+
197
+ $deactivateLink = $('#the-list .deactivate > .ts-slug').prev();
198
+
199
+ for( var i = 0; i < $deactivateLink.length; i++ ) {
200
+ $deactivateLinks[ $( $deactivateLink[i] ).siblings( ".ts-slug" ).attr( 'data-slug' ) ] = $deactivateLink[i].href;
201
+ }
202
+
203
+ $modal.appendTo( $( 'body' ) );
204
+
205
+ registerEventHandlers();
206
+
207
+ function registerEventHandlers() {
208
+ $deactivateLink.on( "click", function (evt) {
209
+ evt.preventDefault();
210
+ currentPluginName = $(this).siblings( ".ts-slug" ).attr( 'data-slug' );
211
+ showModal();
212
+ });
213
+
214
+ $modal.on( 'click', '.button', function (evt) {
215
+ evt.preventDefault();
216
+ if ($(this).hasClass( 'disabled' ) ) {
217
+ return;
218
+ }
219
+
220
+ var _parent = $(this).parents( '.ts-modal:first' );
221
+ var _this = $(this);
222
+
223
+ if( _this.hasClass( 'allow-deactivate' ) ) {
224
+ var $radio = $('input[type="radio"]:checked');
225
+ var $selected_reason = $radio.parents('li:first'),
226
+ $input = $selected_reason.find('textarea, input[type="text"]');
227
+ if( $radio.length == 0 ) {
228
+ var data = {
229
+ 'action': 'ts_submit_uninstall_reason',
230
+ 'reason_id': 0,
231
+ 'reason_text': "Deactivated without any option",
232
+ 'plugin_basename': currentPluginName,
233
+ };
234
+ } else {
235
+ var data = {
236
+ 'action': 'ts_submit_uninstall_reason',
237
+ 'reason_id': (0 !== $radio.length) ? $radio.val() : '',
238
+ 'reason_text': $selected_reason.text(),
239
+ 'reason_info': (0 !== $input.length) ? $input.val().trim() : '',
240
+ 'plugin_basename': currentPluginName,
241
+ };
242
+ }
243
+
244
+ $.ajax({
245
+ url: ajaxurl,
246
+ method: 'POST',
247
+ data: data,
248
+ beforeSend: function () {
249
+ _parent.find('.button').addClass('disabled');
250
+ _parent.find('.button-secondary').text('Processing...');
251
+ },
252
+ complete: function () {
253
+ // Do not show the dialog box, deactivate the plugin.
254
+ window.location.href = $deactivateLinks[currentPluginName];
255
+ }
256
+ });
257
+ }
258
+ });
259
+
260
+ $modal.on('click', 'input[type="radio"]', function () {
261
+ console.log( this );
262
+ var _parent = $(this).parents('li:first');
263
+ var _parent_ul = $(this).parents('ul#reasons-list');
264
+
265
+ _parent_ul.children("li.li-active").removeClass("li-active");
266
+
267
+ $modal.find('.reason-input').remove();
268
+ $modal.find('.button-deactivate').text('<?php printf( TS_deactivate::load_str( 'deactivation-modal-button-submit' ) ); ?>');
269
+
270
+ if (_parent.hasClass('has_html')) {
271
+ _parent.addClass('li-active');
272
+ }
273
+ if (_parent.hasClass('has-input')) {
274
+ var inputType = _parent.data('input-type'),
275
+ inputPlaceholder = _parent.data('input-placeholder'),
276
+ reasonInputHtml = '<div class="reason-input">' + (('textfield' === inputType) ? '<input type="text" />' : '<textarea rows="5"></textarea>') + '</div>';
277
+
278
+ _parent.append($(reasonInputHtml));
279
+ _parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
280
+ }
281
+ });
282
+
283
+ // If the user has clicked outside the window, cancel it.
284
+ $modal.on('click', function (evt) {
285
+ var $target = $(evt.target);
286
+
287
+ // If the user has clicked anywhere in the modal dialog, just return.
288
+ if ($target.hasClass('ts-modal-body') || $target.hasClass('ts-modal-footer')) {
289
+ return;
290
+ }
291
+
292
+ // If the user has not clicked the close button and the clicked element is inside the modal dialog, just return.
293
+ if (!$target.hasClass('button-close') && ($target.parents('.ts-modal-body').length > 0 || $target.parents('.ts-modal-footer').length > 0)) {
294
+ return;
295
+ }
296
+
297
+ closeModal();
298
+ });
299
+ }
300
+
301
+ function showModal() {
302
+ resetModal();
303
+
304
+ // Display the dialog box.
305
+ $modal.addClass('active');
306
+
307
+ $('body').addClass('has-ts-modal');
308
+ }
309
+
310
+ function closeModal() {
311
+ $modal.removeClass('active');
312
+
313
+ $('body').removeClass('has-ts-modal');
314
+ }
315
+
316
+ function resetModal() {
317
+ if (TSCustomReasons.hasOwnProperty(currentPluginName) === true) {
318
+ $modal.find("ul#reasons-list").html(TSCustomReasons[currentPluginName]);
319
+ } else {
320
+ $modal.find("ul#reasons-list").html(reasonsHtml);
321
+
322
+ }
323
+ var defaultSelect = TSDefaultReason[currentPluginName];
324
+ $modal.find('.button').removeClass('disabled');
325
+
326
+ // Remove all input fields ( textfield, textarea ).
327
+ $modal.find('.reason-input').remove();
328
+
329
+ var $deactivateButton = $modal.find('.button-deactivate');
330
+ $modal.find(".reason-hide").hide();
331
+ /*
332
+ * If the modal dialog has no confirmation message, that is, it has only one panel, then ensure
333
+ * that clicking the deactivate button will actually deactivate the plugin.
334
+ */
335
+ if ($modal.hasClass('no-confirmation-message')) {
336
+ $deactivateButton.addClass('allow-deactivate');
337
+ showPanel('reasons');
338
+ }
339
+ }
340
+
341
+ function showPanel(panelType) {
342
+ $modal.find('.ts-modal-panel').removeClass('active ');
343
+ $modal.find('[data-panel-id="' + panelType + '"]').addClass('active');
344
+
345
+ updateButtonLabels();
346
+ }
347
+
348
+ function updateButtonLabels() {
349
+ var $deactivateButton = $modal.find('.button-deactivate');
350
+
351
+ // Reset the deactivate button's text.
352
+ if ('confirm' === getCurrentPanel()) {
353
+ $deactivateButton.text('<?php printf( TS_deactivate::load_str( 'deactivation-modal-button-confirm' ) ); ?>');
354
+ } else {
355
+ var $radio = $('input[type="radio"]:checked');
356
+ if( $radio.length == 0 ) {
357
+ $deactivateButton.text('<?php printf( TS_deactivate::load_str( 'deactivation-modal-button-deactivate' ) ); ?>');
358
+ } else {
359
+ var _parent = $( $radio ).parents('li:first');
360
+ var _parent_ul = $( $radio ).parents('ul#reasons-list');
361
+
362
+ _parent_ul.children("li.li-active").removeClass("li-active");
363
+
364
+ $modal.find('.reason-input').remove();
365
+ $modal.find('.button-deactivate').text('<?php printf( TS_deactivate::load_str( 'deactivation-modal-button-submit' ) ); ?>');
366
+
367
+ if (_parent.hasClass('has_html')) {
368
+ _parent.addClass('li-active');
369
+ }
370
+
371
+ if (_parent.hasClass('has-input')) {
372
+ var inputType = _parent.data('input-type'),
373
+ inputPlaceholder = _parent.data('input-placeholder'),
374
+ reasonInputHtml = '<div class="reason-input">' + (('textfield' === inputType) ? '<input type="text" />' : '<textarea rows="5"></textarea>') + '</div>';
375
+
376
+ _parent.append($(reasonInputHtml));
377
+ _parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
378
+ }
379
+ }
380
+ }
381
+ }
382
+
383
+ function getCurrentPanel() {
384
+ return $modal.find('.ts-modal-panel.active').attr('data-panel-id');
385
+ }
386
+ })(jQuery);
387
+ </script>
woocommerce-abandoned-cart/includes/component/faq_support/Instructions ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Add FAQ's submenu or tab in the plugin.
2
+
3
+ To add this feature to the plugin, you can follow the below steps:
4
+
5
+ 1. Copy the ts-faq-support.php file into your plugin folder. And faq-page folder into templates folder.
6
+
7
+ 2. Include the ts-faq-support.php file once when on the admin page. This can be done with is_admin() function.
8
+
9
+ 3. You need to pass the 7 parameters to the default constructor of the TS_Welcome class. You need to change the value of the variable value as per the respective plugin.
10
+
11
+ $wcap_plugin_prefix = 'wcap';
12
+ $wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
13
+ $wcap_blog_post_link = 'https://www.tychesoftwares.com/order-delivery-date-usage-tracking/';
14
+ $wcap_locale = 'woocommerce-ac';
15
+ $wcap_plugin_folder_name = 'woocommerce-abandon-cart-pro/';
16
+ $wcap_plugins_page = 'admin.php?page=woocommerce_ac_page';
17
+ $wcap_plugin_slug = 'woocommerce_ac_page';
18
+
19
+ $ts_pro_faq = self::wcap_get_faq ();
20
+ new TS_Faq_Support( $wcap_plugin_name, $wcap_plugin_prefix, $wcap_plugins_page, $wcap_locale, $wcap_plugin_folder_name, $wcap_plugin_slug, $ts_pro_faq );
21
+
22
+ Here , $ts_pro_faq is an array.
23
+
24
+ The structure of the array is like below:
25
+
26
+ $ts_faq = array(
27
+ 1 => array (
28
+ 'question' => '',
29
+ 'answer' => ''
30
+ )
31
+ );
32
+
33
+ Here Index start from 1. Do not change it. We need to display 10 Questions and answers, so you can add 10 questions and answers in the above format.
34
+
35
+ 4. You need to create 3 do_action in your respective plugin. And it should follow below standard.
36
+
37
+ 1. {{plugin-prefix}}_add_settings_tab
38
+ 2. {{plugin-prefix}}_add_tab_content
39
+ 3. {{plugin-prefix}}_add_submenu
40
+
41
+ 5. {{plugin-prefix}}_add_settings_tab : This do_action will be placed after your plguins tab. It will allow to add new tab.
42
+
43
+ 6. {{plugin-prefix}}_add_tab_content : This do_action will be placed where you display the content of the tab.
44
+
45
+ 7. {{plugin-prefix}}_add_submenu : This do_action will be placed where you have screated sub menu of your plguin.
46
+
47
+ 8. You need to update all faq of the plugins.
woocommerce-abandoned-cart/includes/component/faq_support/templates/faq-page/faq-page.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ & Support page
4
+ */
5
+ ?>
6
+ <style>
7
+ .faq-ts-accordion {
8
+ background-color: #ccc;
9
+ color: #444;
10
+ cursor: pointer;
11
+ padding: 18px;
12
+ width: 100%;
13
+ border: none;
14
+ text-align: left;
15
+ outline: none;
16
+ font-size: 15px;
17
+ transition: 0.4s;
18
+ margin-bottom: 5px;
19
+ }
20
+ .active, .faq-ts-accordion:hover {
21
+ background-color: #ccc;
22
+ }
23
+ .faq-ts-accordion:after {
24
+ content: '\002B';
25
+ color: #777;
26
+ font-weight: bold;
27
+ float: right;
28
+ margin-left: 5px;
29
+ }
30
+ .active:after {
31
+ content: "\2212";
32
+ }
33
+ .panel {
34
+ padding: 0 18px;
35
+ display: none;
36
+ background-color: light-grey;
37
+ overflow: hidden;
38
+ }
39
+ .main-panel {
40
+ width: 650px !important;
41
+ }
42
+ .support-panel {
43
+ padding: 5px;
44
+ }
45
+ .dashicons-external {
46
+ content: "\f504";
47
+ }
48
+ .dashicons-editor-help {
49
+ content: "\f223";
50
+ }
51
+ div.panel.show {
52
+ display: block !important;
53
+ }
54
+
55
+ </style>
56
+
57
+ <div class="main-panel">
58
+ <h3>Frequently Asked Questions for <?php echo $ts_plugin_name; ?> Plugin</h3>
59
+ <button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[1]['question'] ?></strong></button>
60
+ <div class="panel">
61
+ <p><?php echo $ts_faq[1]['answer'] ?></p>
62
+ </div>
63
+
64
+ <button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[2]['question'] ?></strong></button>
65
+ <div class="panel">
66
+ <p><?php echo $ts_faq[2]['answer'] ?></p>
67
+ </div>
68
+
69
+ <button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[3]['question'] ?></strong></button>
70
+ <div class="panel">
71
+ <p><?php echo $ts_faq[3]['answer'] ?></p>
72
+ </div>
73
+
74
+ <button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[4]['question'] ?></strong></button>
75
+ <div class="panel">
76
+ <p><?php echo $ts_faq[4]['answer'] ?></p>
77
+ </div>
78
+
79
+ <button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[5]['question'] ?></strong></button>
80
+ <div class="panel">
81
+ <p><?php echo $ts_faq[5]['answer'] ?></p>
82
+ </div>
83
+
84
+ <button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[6]['question'] ?></strong></button>
85
+ <div class="panel">
86
+ <p><?php echo $ts_faq[6]['answer'] ?></p>
87
+ </div>
88
+
89
+ <button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[7]['question'] ?></strong></button>
90
+ <div class="panel">
91
+ <p><?php echo $ts_faq[7]['answer'] ?></p>
92
+ </div>
93
+
94
+ <button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[8]['question'] ?></strong></button>
95
+ <div class="panel">
96
+ <p><?php echo $ts_faq[8]['answer'] ?></p>
97
+ </div>
98
+
99
+ <button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[9]['question'] ?></strong></button>
100
+ <div class="panel">
101
+ <p><?php echo $ts_faq[9]['answer'] ?></p>
102
+ </div>
103
+ <button class="faq-ts-accordion"><span class="dashicons dashicons-editor-help"></span><strong><?php echo $ts_faq[10]['question'] ?></strong></button>
104
+ <div class="panel">
105
+ <p><?php echo $ts_faq[10]['answer'] ?></p>
106
+ </div>
107
+ </div>
108
+
109
+ <div class="support-panel">
110
+ <p style="font-size: 19px">
111
+ If your queries are not answered here, you can send an email directly to <strong>support@tychesoftwares.freshdesk.com</strong> for some additional requirements.
112
+ </p>
113
+ </div>
114
+ <script>
115
+ var acc = document.getElementsByClassName("faq-ts-accordion");
116
+ var i;
117
+
118
+ for (i = 0; i < acc.length; i++) {
119
+ acc[i].onclick = function() {
120
+ hideAll();
121
+
122
+ this.classList.toggle("active");
123
+ this.nextElementSibling.classList.toggle("show");
124
+ }
125
+ }
126
+
127
+ function hideAll() {
128
+ for (i = 0; i < acc.length; i++) {
129
+ acc[i].classList.toggle( "active", false);
130
+ acc[i].nextElementSibling.classList.toggle( "show", false );
131
+ }
132
+ }
133
+
134
+ </script>
woocommerce-abandoned-cart/includes/component/faq_support/ts-faq-support.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * @since 1.0.0
6
+ */
7
+ class TS_Faq_Support {
8
+ /**
9
+ * @var string The capability users should have to view the page
10
+ */
11
+ public static $minimum_capability = 'manage_options';
12
+
13
+ /**
14
+ * @var string Plugin name
15
+ * @access public
16
+ */
17
+
18
+ public static $plugin_name = '';
19
+
20
+ /**
21
+ * @var string Plugin prefix
22
+ * @access public
23
+ */
24
+ public static $plugin_prefix = '';
25
+
26
+ /**
27
+ * @var string Plugins page path
28
+ * @access public
29
+ */
30
+ public static $plugin_page = '';
31
+
32
+ /**
33
+ * @var string Plugins plugin local
34
+ * @access public
35
+ */
36
+ public static $plugin_locale = '';
37
+
38
+ /**
39
+ * @var string Plugin folder name
40
+ * @access public
41
+ */
42
+ public static $plugin_folder = '';
43
+ /**
44
+ * @var string Plugin url
45
+ * @access public
46
+ */
47
+ public static $plugin_url = '';
48
+ /**
49
+ * @var string Template path
50
+ * @access public
51
+ */
52
+ public static $template_base = '';
53
+ /**
54
+ * @var string Slug on Main menu
55
+ * @access public
56
+ */
57
+ public static $plugin_slug = '';
58
+
59
+ /**
60
+ * @var array List of all questions and answers.
61
+ * @access public
62
+ */
63
+ public static $ts_faq = array ();
64
+ /**
65
+ * @var string Slug for FAQ submenu
66
+ * @access public
67
+ */
68
+ public static $ts_faq_submenu_slug = '';
69
+ /**
70
+ * Initialization of hooks where we prepare the functionality to ask use for survey
71
+ */
72
+ public function __construct( $ts_plugin_mame = '', $ts_plugin_prefix = '', $ts_plugin_page = '', $ts_plugin_locale = '', $ts_plugin_folder_name = '', $ts_plugin_slug = '', $ts_faq_array = array(), $faq_submenu_slug = '' ) {
73
+
74
+ self::$plugin_name = $ts_plugin_mame;
75
+ self::$plugin_prefix = $ts_plugin_prefix;
76
+ self::$plugin_page = $ts_plugin_page;
77
+ self::$plugin_locale = $ts_plugin_locale;
78
+ self::$plugin_slug = $ts_plugin_slug;
79
+ self::$ts_faq = $ts_faq_array;
80
+ self::$ts_faq_submenu_slug = ( '' == $faq_submenu_slug ) ? self::$plugin_slug : $faq_submenu_slug ;
81
+
82
+
83
+ //Add a sub menu in the main menu of the plugin if added.
84
+ add_action( self::$plugin_prefix . '_add_submenu', array( &$this, 'ts_add_submenu' ) );
85
+
86
+ //Add a tab for FAQ & Support along with other plugin settings tab.
87
+ add_action( self::$plugin_prefix . '_add_settings_tab', array( &$this, 'ts_add_new_settings_tab' ) );
88
+ add_action( self::$plugin_prefix . '_add_tab_content', array( &$this, 'ts_add_tab_content' ) );
89
+
90
+ add_action ( self::$plugin_prefix . '_add_meta_footer', array( &$this, 'ts_add_meta_footer_text' ), 10, 1 );
91
+
92
+ add_action( 'admin_menu', array( &$this, 'ts_admin_menus' ) );
93
+ add_action( 'admin_head', array( &$this, 'admin_head' ) );
94
+
95
+ self::$plugin_folder = $ts_plugin_folder_name;
96
+ self::$plugin_url = $this->ts_get_plugin_url();
97
+ self::$template_base = $this->ts_get_template_path();
98
+
99
+ }
100
+
101
+
102
+ public static function ts_add_meta_footer_text () {
103
+ ?>
104
+ <tr> <td> <br></td> </tr>
105
+
106
+ <tr>
107
+ <td colspan="2">
108
+ You have any queries? Please check our <a href=<?php echo admin_url( 'index.php?page='.self::$plugin_prefix .'_faq_page' ) ; ?> >FAQ</a> page.
109
+ </td>
110
+ <tr>
111
+ <?php
112
+ }
113
+
114
+ /**
115
+ * Register the Dashboard Page which is later hidden but this pages
116
+ * is used to render the Welcome page.
117
+ *
118
+ * @access public
119
+ * @since 7.7
120
+ * @return void
121
+ */
122
+ public function ts_admin_menus() {
123
+
124
+ // About Page
125
+ add_dashboard_page(
126
+ sprintf( esc_html__( 'Frequently Asked Questions for %s', self::$plugin_locale ), self::$plugin_name ),
127
+ esc_html__( 'Frequently Asked Questions for ' . self::$plugin_name, self::$plugin_locale ),
128
+ self::$minimum_capability,
129
+ self::$plugin_prefix . '_faq_page',
130
+ array( $this, 'ts_faq_support_page' )
131
+ );
132
+
133
+ }
134
+
135
+ /**
136
+ * Hide Individual Dashboard Pages
137
+ *
138
+ * @access public
139
+ * @since 7.7
140
+ * @return void
141
+ */
142
+ public function admin_head() {
143
+ remove_submenu_page( 'index.php', self::$plugin_prefix . '_faq_page' );
144
+ }
145
+ /**
146
+ * Adds a subment to the main menu of the plugin
147
+ *
148
+ * @since 7.7
149
+ */
150
+
151
+ public function ts_add_submenu() {
152
+ $page = add_submenu_page( self::$plugin_slug,
153
+ 'FAQ & Support',
154
+ 'FAQ & Support',
155
+ 'manage_woocommerce',
156
+ self::$ts_faq_submenu_slug .
157
+ '&action=faq_support_page',
158
+ array( &$this, 'ts_add_tab_content' )
159
+ );
160
+
161
+ }
162
+
163
+ /**
164
+ * Add a new tab on the settings page.
165
+ *
166
+ * @since 7.7
167
+ */
168
+ public function ts_add_new_settings_tab() {
169
+ $faq_support_page = '';
170
+ if( isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] == 'faq_support_page' ) {
171
+ $faq_support_page = "nav-tab-active";
172
+ }
173
+ $ts_plugins_page_url = self::$plugin_page . "&action=faq_support_page" ;
174
+ ?>
175
+ <a href="<?php echo $ts_plugins_page_url; ?>" class="nav-tab <?php echo $faq_support_page; ?>"> <?php _e( 'FAQ & Support', self::$plugin_locale ); ?> </a>
176
+ <?php
177
+
178
+
179
+ }
180
+
181
+ /**
182
+ * Add content to the new tab added.
183
+ *
184
+ * @since 7.7
185
+ */
186
+
187
+ public function ts_add_tab_content() {
188
+ if( isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] == 'faq_support_page' ) {
189
+ $this->ts_faq_support_page();
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Adds a page to display the FAQ's and support information
195
+ *
196
+ * @since 7.7
197
+ */
198
+ public function ts_faq_support_page() {
199
+ ob_start();
200
+ wc_get_template( 'faq-page/faq-page.php',
201
+ array(
202
+ 'ts_plugin_name' => self::$plugin_name,
203
+ 'ts_faq' => self::$ts_faq
204
+ ),
205
+ self::$plugin_folder,
206
+ self::$template_base );
207
+ echo ob_get_clean();
208
+ }
209
+
210
+ /**
211
+ * This function returns the plugin url
212
+ *
213
+ * @access public
214
+ * @since 7.7
215
+ * @return string
216
+ */
217
+ public function ts_get_plugin_url() {
218
+ return plugins_url() . '/' . self::$plugin_folder;
219
+ }
220
+
221
+ /**
222
+ * This function returns the template directory path
223
+ *
224
+ * @access public
225
+ * @since 7.7
226
+ * @return string
227
+ */
228
+ public function ts_get_template_path() {
229
+ return untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/';
230
+ }
231
+ }
woocommerce-abandoned-cart/includes/component/pro-notices-in-lite/Instructions ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Add some notices of Pro plugins in the lite plugins.
2
+
3
+ To add this feature to the plugin, you can follow the below steps:
4
+
5
+ 1. Copy the ts-pro-notices.php file into your plugin folder.
6
+
7
+ 2. Include the file once when on the admin page. This can be done with is_admin() function.
8
+
9
+ 3. You need to pass the 3 parameters to the default constructor of the ts_pro_notices class. You need to change the value of the variable as per the respective plugin.
10
+
11
+ $wcap_plugin_prefix = 'wcap';
12
+ $wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
13
+ $wcap_lite_plugin_prefix = 'wcal';
14
+
15
+ new ts_pro_notices( $wcap_plugin_name, $wcap_lite_plugin_prefix, $wcap_plugin_prefix );
16
+
17
+ 4. You need to add one do_action in your lite plguin. This do_action will be placed under the "register_activation_hook" hook of the plguin.
18
+
19
+ The do_action will be like {{plugin-prefix}}_activate
20
+
21
+ For an ex:
22
+
23
+ do_action( 'wcal_activate' );
24
+
25
+ Here, 'wcal' is tge prefix of the AC Lite.
26
+
27
+ 5. Then you need create an array of the notices.
28
+
29
+ $ts_pro_notices = array (
30
+ 1 => $message_first,
31
+ 2 => $message_two,
32
+ 3 => $message_three,
33
+ 4 => $message_four,
34
+ 5 => $message_five,
35
+ 6 => $message_six,
36
+ 7 => $message_seven,
37
+ 8 => $message_eight,
38
+ 9 => $message_nine,
39
+ ) ;
40
+
41
+ Here, you dont need to change the index, you just need to change the message variable.
woocommerce-abandoned-cart/includes/component/pro-notices-in-lite/ts-pro-notices.php ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ts_pro_notices {
4
+
5
+ /**
6
+ * Plugin's Name
7
+ *
8
+ * @access public
9
+ * @since 3.5
10
+ */
11
+ public static $plugin_name = "";
12
+
13
+ /**
14
+ * Plugin's unique prefix
15
+ *
16
+ * @access public
17
+ * @since 3.5
18
+ */
19
+
20
+ public static $plugin_prefix = '';
21
+
22
+ /**
23
+ * Pro plugin's unique prefix
24
+ *
25
+ * @access public
26
+ * @since 3.5
27
+ */
28
+
29
+ public static $pro_plugin_prefix = '';
30
+
31
+ /**
32
+ * @var array Collection of all messages.
33
+ * @access public
34
+ */
35
+ public static $ts_pro_notices = array ();
36
+
37
+ /**
38
+ * @var string file name
39
+ * @access public
40
+ */
41
+ public static $ts_file_name = '';
42
+
43
+ /**
44
+ * @var string Pro version file name
45
+ * @access public
46
+ */
47
+ public static $ts_pro_file_name = '';
48
+
49
+
50
+ /**
51
+ * Default Constructor
52
+ *
53
+ * @since 3.5
54
+ */
55
+
56
+ public function __construct( $ts_plugin_name = '', $ts_plugin_prefix = '', $ts_pro_plugin_prefix = '', $ts_notices = array(), $ts_file = '', $ts_pro_file = '' ) {
57
+ self::$plugin_name = $ts_plugin_name;
58
+ self::$plugin_prefix = $ts_plugin_prefix;
59
+ self::$pro_plugin_prefix = $ts_pro_plugin_prefix;
60
+ self::$ts_pro_notices = $ts_notices;
61
+ self::$ts_file_name = $ts_file;
62
+ self::$ts_pro_file_name = $ts_pro_file;
63
+
64
+ //Initialize settings
65
+ register_activation_hook( __FILE__, array( &$this, 'ts_notices_activate' ) );
66
+
67
+ //Add pro notices
68
+ add_action( 'admin_notices', array( 'ts_pro_notices', 'ts_notices_of_pro' ) );
69
+ add_action( 'admin_init', array( 'ts_pro_notices', 'ts_ignore_pro_notices' ) );
70
+
71
+ add_action( self::$plugin_prefix . '_activate', array( 'ts_pro_notices', 'ts_activate_time' ) );
72
+ }
73
+
74
+ public static function ts_activate_time () {
75
+
76
+ if( !get_option( 'wcal_activate_time' ) ) {
77
+ add_option( 'wcal_activate_time', current_time( 'timestamp' ) );
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Add an option which stores the timestamp when the plugin is first activated
83
+ *
84
+ * @since 3.5
85
+ */
86
+ public static function ts_notices_activate() {
87
+ //Pro admin Notices
88
+ if( !get_option( self::$plugin_prefix . 'activate_time' ) ) {
89
+ add_option( self::$plugin_prefix . '_activate_time', current_time( 'timestamp' ) );
90
+ }
91
+ }
92
+
93
+ public static function ts_notices_of_pro() {
94
+ $activate_time = get_option ( self::$plugin_prefix . '_activate_time' );
95
+ $sixty_days = strtotime ( '+60 Days', $activate_time );
96
+ $current_time = current_time ( 'timestamp' );
97
+ $add_query_arguments = '';
98
+ $message = '';
99
+
100
+ if( !is_plugin_active( self::$ts_pro_file_name ) &&
101
+ ( false === $activate_time || ( $activate_time > 0 && $current_time >= $sixty_days ) ) ) {
102
+ global $current_user ;
103
+ $user_id = $current_user->ID;
104
+
105
+ if( ! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) ) {
106
+
107
+ $add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_first_notice_ignore', '0' );
108
+
109
+ $class = 'updated notice-info point-notice one';
110
+ $style = 'position:relative';
111
+ $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
112
+ printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[1], $cancel_button );
113
+ }
114
+
115
+ if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) &&
116
+ ! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore' )
117
+ ) {
118
+
119
+ $first_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore_time' );
120
+ // $fifteen_days = strtotime( '+15 Days', $first_ignore_time[0] );
121
+
122
+ $fifteen_days = strtotime( '+2 Minutes', $first_ignore_time[0] );
123
+
124
+ if ( $current_time > $fifteen_days ) {
125
+
126
+ $add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_second_notice_ignore', '0' );
127
+
128
+ $class = 'updated notice-info point-notice two';
129
+ $style = 'position:relative';
130
+ $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
131
+ printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[2], $cancel_button );
132
+ }
133
+ }
134
+
135
+ if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) &&
136
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore' ) &&
137
+ ! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore' )
138
+ ) {
139
+
140
+ $second_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore_time' );
141
+ $ts_fifteen_days = strtotime( '+15 Days', $second_ignore_time[0] );
142
+
143
+ if ( $current_time > $ts_fifteen_days ) {
144
+
145
+ $add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_third_notice_ignore', '0' );
146
+
147
+ $class = 'updated notice-info point-notice';
148
+ $style = 'position:relative';
149
+ $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
150
+ printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[3], $cancel_button );
151
+ }
152
+ }
153
+
154
+ if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) &&
155
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore' ) &&
156
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore' ) &&
157
+ ! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore' )
158
+ ) {
159
+
160
+ $third_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore_time' );
161
+ $ts_fifteen_days = strtotime( '+15 Days', $third_ignore_time[0] );
162
+
163
+ if ( $current_time > $ts_fifteen_days ) {
164
+
165
+ $add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_fourth_notice_ignore', '0' );
166
+
167
+ $class = 'updated notice-info point-notice';
168
+ $style = 'position:relative';
169
+ $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
170
+ printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[4], $cancel_button );
171
+ }
172
+ }
173
+
174
+ if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) &&
175
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore' ) &&
176
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore' ) &&
177
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore' ) &&
178
+ ! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fifth_notice_ignore' )
179
+ ) {
180
+
181
+ $fourth_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore_time' );
182
+ $ts_fifteen_days = strtotime( '+15 Days', $fourth_ignore_time[0] );
183
+
184
+ if ( $current_time > $ts_fifteen_days ) {
185
+
186
+ $add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_fifth_notice_ignore', '0' );
187
+
188
+ $class = 'updated notice-info point-notice';
189
+ $style = 'position:relative';
190
+ $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
191
+ printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[5], $cancel_button );
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Display Other plugin notices.
197
+ */
198
+
199
+ if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore' ) &&
200
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore' ) &&
201
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore' ) &&
202
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore' ) &&
203
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fifth_notice_ignore' )
204
+ ) {
205
+ $fifth_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fifth_notice_ignore_time' );
206
+
207
+ self::ts_display_other_pro_plugin_notices( $current_time, $activate_time, $fifth_ignore_time [ 0 ] );
208
+ }
209
+ }
210
+
211
+ /**
212
+ * What happen if the respective plugin is activated.
213
+ * AC - With latest version, Lite will be deactivated. With old version, it will be deactivated.
214
+ * Ordd, Prdd - Both version can be activated.
215
+ *
216
+ * Question: How do you show this notice if Pro version is active? What all condition you consider. How many days you will consider?
217
+ *
218
+ */
219
+ $seven_days = strtotime ( '+7 Days', $activate_time );
220
+ if( is_plugin_active( self::$ts_pro_file_name ) &&
221
+ ( false === $activate_time || ( $activate_time > 0 && $current_time >= $seven_days ) ) ) {
222
+
223
+ self::ts_display_other_pro_plugin_notices( $current_time, $activate_time );
224
+ }
225
+
226
+ }
227
+
228
+ /**
229
+ * It will display the all othe pro plugin notices
230
+ *
231
+ */
232
+ public static function ts_display_other_pro_plugin_notices ( $current_time, $activate_time, $ts_consider_time = '' ) {
233
+
234
+ if ( ! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore' )
235
+ ) {
236
+
237
+ if ( '' != $ts_consider_time ) {
238
+ /**
239
+ * This is fifth ignore notice time plus 7 days
240
+ */
241
+ $ts_consider_time = strtotime( '+7 Days', $ts_consider_time );
242
+ }
243
+ if ( $current_time > $ts_consider_time ) {
244
+ $add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_sixth_notice_ignore', '0' );
245
+
246
+ $class = 'updated notice-info point-notice';
247
+ $style = 'position:relative';
248
+ $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
249
+ printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[6], $cancel_button );
250
+ }
251
+
252
+ }
253
+
254
+ if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore' ) &&
255
+ ! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_seventh_notice_ignore' )
256
+ ) {
257
+
258
+ $sixth_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore_time' );
259
+ $ts_seven_days = strtotime( '+7 Days', $sixth_ignore_time[0] );
260
+ if ( $current_time > $ts_seven_days ) {
261
+
262
+ $add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_seventh_notice_ignore', '0' );
263
+
264
+ $class = 'updated notice-info point-notice';
265
+ $style = 'position:relative';
266
+ $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
267
+ printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[7], $cancel_button );
268
+ }
269
+ }
270
+
271
+ if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore' ) &&
272
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_seventh_notice_ignore' ) &&
273
+ ! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eigth_notice_ignore' )
274
+ ) {
275
+
276
+ $seventh_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_seventh_notice_ignore_time' );
277
+ $ts_seven_days = strtotime( '+7 Days', $seventh_ignore_time[0] );
278
+ if ( $current_time > $ts_seven_days ) {
279
+
280
+ $add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_eigth_notice_ignore', '0' );
281
+
282
+ $class = 'updated notice-info point-notice';
283
+ $style = 'position:relative';
284
+ $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
285
+ printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[8], $cancel_button );
286
+ }
287
+ }
288
+
289
+ if ( get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore' ) &&
290
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_seventh_notice_ignore' ) &&
291
+ get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eigth_notice_ignore' ) &&
292
+ ! get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_ninth_notice_ignore' )
293
+ ) {
294
+
295
+ $eigth_ignore_time = get_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eigth_notice_ignore_time' );
296
+ $ts_seven_days = strtotime( '+7 Days', $eigth_ignore_time[0] );
297
+ if ( $current_time > $ts_seven_days ) {
298
+
299
+ $add_query_arguments = add_query_arg( self::$pro_plugin_prefix . '_ninth_notice_ignore', '0' );
300
+
301
+ $class = 'updated notice-info point-notice';
302
+ $style = 'position:relative';
303
+ $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
304
+ printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, self::$ts_pro_notices[9], $cancel_button );
305
+ }
306
+
307
+ }
308
+ }
309
+
310
+ /**
311
+ * Ignore pro notice
312
+ */
313
+ public static function ts_ignore_pro_notices() {
314
+
315
+ // If user clicks to ignore the notice, add that to their user meta
316
+ if ( isset( $_GET[ self::$pro_plugin_prefix . '_first_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_first_notice_ignore' ] ) {
317
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore', 'true', true );
318
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_first_notice_ignore_time', current_time( 'timestamp' ), true );
319
+ wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_first_notice_ignore' ) );
320
+
321
+ }
322
+
323
+ if ( isset( $_GET[ self::$pro_plugin_prefix . '_second_notice_ignore'] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_second_notice_ignore'] ) {
324
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore', 'true', true );
325
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_second_notice_ignore_time', current_time( 'timestamp' ), true );
326
+ wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_second_notice_ignore' ) );
327
+ }
328
+
329
+ if ( isset( $_GET[ self::$pro_plugin_prefix . '_third_notice_ignore'] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_third_notice_ignore'] ) {
330
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore', 'true', true );
331
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_third_notice_ignore_time', current_time( 'timestamp' ), true );
332
+ wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_third_notice_ignore' ) );
333
+ }
334
+
335
+ if ( isset( $_GET[ self::$pro_plugin_prefix . '_fourth_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_fourth_notice_ignore' ] ) {
336
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore', 'true', true );
337
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fourth_notice_ignore_time', current_time( 'timestamp' ), true );
338
+ wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_fourth_notice_ignore' ) );
339
+ }
340
+
341
+ if ( isset( $_GET[ self::$pro_plugin_prefix . '_fifth_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_fifth_notice_ignore' ] ) {
342
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fifth_notice_ignore', 'true', true );
343
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_fifth_notice_ignore_time', current_time( 'timestamp' ), true );
344
+ wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_fifth_notice_ignore' ) );
345
+ }
346
+
347
+ if ( isset( $_GET[ self::$pro_plugin_prefix . '_sixth_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_sixth_notice_ignore' ] ) {
348
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore', 'true', true );
349
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_sixth_notice_ignore_time', current_time( 'timestamp' ), true );
350
+ wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_sixth_notice_ignore' ) );
351
+ }
352
+
353
+ if ( isset( $_GET[ self::$pro_plugin_prefix . '_seventh_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_seventh_notice_ignore' ] ) {
354
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_seventh_notice_ignore', 'true', true );
355
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_seventh_notice_ignore_time', current_time( 'timestamp' ), true );
356
+ wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_seventh_notice_ignore' ) );
357
+ }
358
+
359
+ if ( isset( $_GET[ self::$pro_plugin_prefix . '_eigth_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_eigth_notice_ignore' ] ) {
360
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eigth_notice_ignore', 'true', true );
361
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_eigth_notice_ignore_time', current_time( 'timestamp' ), true );
362
+ wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_eigth_notice_ignore' ) );
363
+ }
364
+
365
+ if ( isset( $_GET[ self::$pro_plugin_prefix . '_ninth_notice_ignore' ] ) && '0' === $_GET[ self::$pro_plugin_prefix . '_ninth_notice_ignore' ] ) {
366
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_ninth_notice_ignore', 'true', true );
367
+ add_user_meta( get_current_user_id(), self::$pro_plugin_prefix . '_ninth_notice_ignore_time', current_time( 'timestamp' ), true );
368
+ wp_safe_redirect( remove_query_arg( self::$pro_plugin_prefix . '_ninth_notice_ignore' ) );
369
+ }
370
+ }
371
+ }
372
+
woocommerce-abandoned-cart/includes/component/tracking data/Instructions ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Add a notice to ask customers to collect non-sensitive data for the plugin and provide them with 20% coupon code if they allow us to collect data.
2
+
3
+ To add this feature to the plugin, you can follow the below steps:
4
+
5
+ 1. Copy the ts-tracking.php file and class-ts-tracker.php file into your plugin folder.
6
+
7
+ 2. Include the file ts-tracking.php once when on the admin page. This can be done with is_admin() function.
8
+
9
+ 3. You need to pass the 5 parameters to the default constructor of the TS_tracking class. You need to change the value of the variable as per the respective plugin.
10
+
11
+ $wcap_plugin_prefix = 'wcap';
12
+ $wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
13
+ $wcap_blog_post_link = 'https://www.tychesoftwares.com/order-delivery-date-usage-tracking/';
14
+ $wcap_locale = 'woocommerce-ac';
15
+ WCAP_PLUGIN_URL = untrailingslashit(plugins_url('/', __FILE__)) ;
16
+
17
+ new TS_tracking( $wcap_plugin_prefix, $wcap_plugin_name, $wcap_blog_post_link, $wcap_locale, WCAP_PLUGIN_URL );
18
+
19
+ 4. Then you need to pass 2 parameters to the TS_Tracker class. You need to change the value of the variable as per the respective plugin.
20
+
21
+ $wcap_plugin_prefix = 'wcap';
22
+ $wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
23
+ new TS_Tracker( $wcap_plugin_prefix, $wcap_plugin_name );
24
+
25
+ 5. We are using these class for tracking the data from the websites, so to track the data from the site we need to add the plugin data.
26
+
27
+ To get the data from the website you need to use 2 filters.
28
+
29
+ 1. ts_tracker_data : It will be called when admin allows tracking the data.
30
+
31
+ 2. ts_tracker_opt_out_data : It will be called when an admin does not allow to track the data
32
+
33
+ Both filters have 1 argument, you need to add all the data as per the plugin.
34
+
35
+ 6. We need to give the table name in the tracking data. You need to pass that in above both filter.
36
+
37
+ IMP: ts_meta_data_table_name - this should contain the table name which will store the plugin specific data. This should not be skipped.
38
+
39
+ Like: $plugin_data[ 'ts_meta_data_table_name' ] = 'ts_tracking_wcap_meta_data';
40
+
41
+ Here, key 'ts_meta_data_table_name' should remain same, you just need to change the table name.
42
+
43
+ Here, in the AC pro case, I have given table name as 'ts_tracking_{{prefix-of-plugin}}_meta_data
44
+
45
+ 7. Here we need 1 js file and 1 image for the tracking of the data. So I have added in the same folder, so the code structure is kept as per the current location.
46
+
47
+ If you move the js file and the image to another place then you need to change that in the 'ts-tracking.php' file.
48
+
49
+ You need to change the line number #75 for js file.
50
+ You need to change the line number #127 for the image.
51
+
52
+ 8. It is also have the ajax function which will be named as
53
+
54
+ 'wp_ajax_{{plugin-prefix}}_admin_notices'
woocommerce-abandoned-cart/includes/component/tracking data/assets/images/site-logo-new.jpg ADDED
Binary file
woocommerce-abandoned-cart/includes/component/tracking data/assets/js/dismiss-notice.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * This function allows to dismiss the notices which are shown from the plugin.
3
+ *
4
+ * @namespace orddd_notice_dismissible
5
+ * @since 6.8
6
+ */
7
+ // Make notices dismissible
8
+ jQuery(document).ready( function() {
9
+ jQuery( '.notice.is-dismissible' ).each( function() {
10
+ var $this = jQuery( this ),
11
+ $button = jQuery( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ),
12
+ btnText = commonL10n.dismiss || '';
13
+
14
+ // Ensure plain text
15
+ $button.find( '.screen-reader-text' ).text( btnText );
16
+
17
+ $this.append( $button );
18
+
19
+ /**
20
+ * Event when close icon is clicked.
21
+ * @fires event:notice-dismiss
22
+ * @since 6.8
23
+ */
24
+ $button.on( 'click.notice-dismiss', function( event ) {
25
+ event.preventDefault();
26
+ $this.fadeTo( 100 , 0, function() {
27
+ //alert();
28
+ jQuery(this).slideUp( 100, function() {
29
+ jQuery(this).remove();
30
+ var data = {
31
+ action: ts_dismiss_notice.ts_prefix_of_plugin + "_admin_notices"
32
+ };
33
+ var admin_url = ts_dismiss_notice.ts_admin_url;
34
+
35
+ jQuery.post( admin_url , data, function( response ) {
36
+ });
37
+ });
38
+ });
39
+ });
40
+ });
41
+ });
woocommerce-abandoned-cart/includes/component/tracking data/class-ts-tracker.php ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The tracker class adds functionality to track usage of the plugin based on if the customer opted in.
4
+ * No personal information is tracked, only general settings, order and user counts and admin email for
5
+ * discount code.
6
+ *
7
+ * @class TS_Tracker
8
+ * @version 6.8
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ class TS_Tracker {
16
+
17
+ /**
18
+ * URL to the Tracker API endpoint.
19
+ * @var string
20
+ */
21
+
22
+ private static $api_url = 'http://tracking.tychesoftwares.com/v1/';
23
+
24
+ /**
25
+ * @var string Plugin prefix
26
+ * @access public
27
+ */
28
+
29
+ public static $plugin_prefix = '';
30
+
31
+ /**
32
+ * @var string Plugin name
33
+ * @access public
34
+ */
35
+
36
+ public static $plugin_name = '';
37
+
38
+ /**
39
+ * Hook into cron event.
40
+ */
41
+ public function __construct( $ts_plugin_prefix = '', $ts_plugin_name = '' ) {
42
+
43
+ self::$plugin_prefix = $ts_plugin_prefix;
44
+ self::$plugin_name = $ts_plugin_name;
45
+
46
+ add_action( self::$plugin_prefix . '_ts_tracker_send_event', array( __CLASS__, 'ts_send_tracking_data' ) );
47
+ }
48
+
49
+ /**
50
+ * Decide whether to send tracking data or not.
51
+ *
52
+ * @param boolean $override
53
+ */
54
+ public static function ts_send_tracking_data( $override = false ) {
55
+ if ( ! apply_filters( 'ts_tracker_send_override', $override ) ) {
56
+ // Send a maximum of once per week by default.
57
+ $last_send = self::ts_get_last_send_time();
58
+ if ( $last_send && $last_send > apply_filters( 'ts_tracker_last_send_interval', strtotime( '-1 week' ) ) ) {
59
+ return;
60
+ }
61
+ } else {
62
+ // Make sure there is at least a 1 hour delay between override sends, we don't want duplicate calls due to double clicking links.
63
+ $last_send = self::ts_get_last_send_time();
64
+ if ( $last_send && $last_send > strtotime( '-1 hours' ) ) {
65
+ return;
66
+ }
67
+ }
68
+
69
+ $allow_tracking = get_option( self::$plugin_prefix . '_allow_tracking' );
70
+ if ( 'yes' == $allow_tracking ) {
71
+ $override = true;
72
+ }
73
+
74
+ // Update time first before sending to ensure it is set
75
+ update_option( 'ts_tracker_last_send', time() );
76
+
77
+ if( $override == false ) {
78
+ $params = array();
79
+ $params[ 'tracking_usage' ] = 'no';
80
+ $params[ 'url' ] = home_url();
81
+ $params[ 'email' ] = '';
82
+
83
+ $params = apply_filters( 'ts_tracker_opt_out_data', $params );
84
+ } else {
85
+ $params = self::ts_get_tracking_data();
86
+ }
87
+
88
+ wp_safe_remote_post( self::$api_url, array(
89
+ 'method' => 'POST',
90
+ 'timeout' => 45,
91
+ 'redirection' => 5,
92
+ 'httpversion' => '1.0',
93
+ 'blocking' => false,
94
+ 'headers' => array( 'user-agent' => 'TSTracker/' . md5( esc_url( home_url( '/' ) ) ) . ';' ),
95
+ 'body' => json_encode( $params ),
96
+ 'cookies' => array(),
97
+ )
98
+ );
99
+ }
100
+
101
+ /**
102
+ * Get the last time tracking data was sent.
103
+ * @return int|bool
104
+ */
105
+ private static function ts_get_last_send_time() {
106
+ return apply_filters( 'ts_tracker_last_send_time', get_option( 'ts_tracker_last_send', false ) );
107
+ }
108
+
109
+ /**
110
+ * Get all the tracking data.
111
+ * @return array
112
+ */
113
+ private static function ts_get_tracking_data() {
114
+ $data = array();
115
+
116
+ // General site info
117
+ $data[ 'url' ] = home_url();
118
+ $data[ 'email' ] = apply_filters( 'ts_tracker_admin_email', get_option( 'admin_email' ) );
119
+
120
+ // WordPress Info
121
+ $data[ 'wp' ] = self::ts_get_wordpress_info();
122
+
123
+ $data[ 'theme_info' ] = self::ts_get_theme_info();
124
+
125
+ // Server Info
126
+ $data[ 'server' ] = self::ts_get_server_info();
127
+
128
+ // Plugin info
129
+ $all_plugins = self::ts_get_all_plugins();
130
+ $data[ 'active_plugins' ] = $all_plugins[ 'active_plugins' ];
131
+ $data[ 'inactive_plugins' ] = $all_plugins[ 'inactive_plugins' ];
132
+
133
+ //WooCommerce version
134
+ $data[ 'wc_plugin_version' ] = self::ts_get_wc_plugin_version();
135
+
136
+
137
+
138
+ return apply_filters( 'ts_tracker_data', $data );
139
+ }
140
+
141
+ /**
142
+ * Get Selected city of the WooCommerce store.
143
+ * @return string $ts_city Name of the city
144
+ */
145
+ private static function ts_get_wc_city () {
146
+ $ts_city = get_option ( 'woocommerce_store_city' );
147
+ return $ts_city;
148
+ }
149
+
150
+ /**
151
+ * Get Selected country of the WooCommerce store.
152
+ * @return string $ts_country Name of the city
153
+ */
154
+ private static function ts_get_wc_country () {
155
+ $ts_country = get_option ( 'woocommerce_default_country' );
156
+ return $ts_country;
157
+ }
158
+
159
+ /**
160
+ * Get WordPress related data.
161
+ * @return array
162
+ */
163
+ private static function ts_get_wordpress_info() {
164
+ $wp_data = array();
165
+
166
+ $memory = wc_let_to_num( WP_MEMORY_LIMIT );
167
+
168
+ if ( function_exists( 'memory_get_usage' ) ) {
169
+ $system_memory = wc_let_to_num( @ini_get( 'memory_limit' ) );
170
+ $memory = max( $memory, $system_memory );
171
+ }
172
+
173
+ $wp_data[ 'memory_limit' ] = size_format( $memory );
174
+ $wp_data[ 'debug_mode' ] = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? 'Yes' : 'No';
175
+ $wp_data[ 'locale' ] = get_locale();
176
+ $wp_data[ 'wp_version' ] = get_bloginfo( 'version' );
177
+ $wp_data[ 'multisite' ] = is_multisite() ? 'Yes' : 'No';
178
+ $wp_data[ 'blogdescription' ] = get_option ( 'blogdescription' );
179
+ $wp_data[ 'blogname' ] = get_option ( 'blogname' );
180
+ $wp_data[ 'wc_city' ] = self::ts_get_wc_city();
181
+ $wp_data[ 'wc_country' ] = self::ts_get_wc_country();
182
+
183
+ return $wp_data;
184
+ }
185
+
186
+ /**
187
+ * Get the current theme info, theme name and version.
188
+ * @return array
189
+ */
190
+ public static function ts_get_theme_info() {
191
+ $theme_data = wp_get_theme();
192
+ $theme_child_theme = is_child_theme() ? 'Yes' : 'No';
193
+
194
+ return array( 'theme_name' => $theme_data->Name,
195
+ 'theme_version' => $theme_data->Version,
196
+ 'child_theme' => $theme_child_theme );
197
+ }
198
+
199
+ /**
200
+ * Get server related info.
201
+ * @return array
202
+ */
203
+ private static function ts_get_server_info() {
204
+ global $wpdb;
205
+ $server_data = array();
206
+
207
+ if ( isset( $_SERVER[ 'SERVER_SOFTWARE' ] ) && ! empty( $_SERVER[ 'SERVER_SOFTWARE' ] ) ) {
208
+ $server_data[ 'software' ] = $_SERVER[ 'SERVER_SOFTWARE' ];
209
+ }
210
+
211
+ if ( function_exists( 'phpversion' ) ) {
212
+ $server_data[ 'php_version' ] = phpversion();
213
+ }
214
+
215
+ if ( function_exists( 'ini_get' ) ) {
216
+ $server_data[ 'php_post_max_size' ] = size_format( wc_let_to_num( ini_get( 'post_max_size' ) ) );
217
+ $server_data[ 'php_time_limt' ] = ini_get( 'max_execution_time' );
218
+ $server_data[ 'php_max_input_vars' ] = ini_get( 'max_input_vars' );
219
+ $server_data[ 'php_suhosin' ] = extension_loaded( 'suhosin' ) ? 'Yes' : 'No';
220
+ }
221
+
222
+ $server_data[ 'mysql_version' ] = $wpdb->db_version();
223
+
224
+ $server_data[ 'php_max_upload_size' ] = size_format( wp_max_upload_size() );
225
+ $server_data[ 'php_default_timezone' ] = date_default_timezone_get();
226
+ $server_data[ 'php_soap' ] = class_exists( 'SoapClient' ) ? 'Yes' : 'No';
227
+ $server_data[ 'php_fsockopen' ] = function_exists( 'fsockopen' ) ? 'Yes' : 'No';
228
+ $server_data[ 'php_curl' ] = function_exists( 'curl_init' ) ? 'Yes' : 'No';
229
+
230
+ return $server_data;
231
+ }
232
+
233
+ /**
234
+ * Get all plugins grouped into activated or not.
235
+ * @return array
236
+ */
237
+ private static function ts_get_all_plugins() {
238
+ // Ensure get_plugins function is loaded
239
+ if ( ! function_exists( 'get_plugins' ) ) {
240
+ include ABSPATH . '/wp-admin/includes/plugin.php';
241
+ }
242
+
243
+ $plugins = get_plugins();
244
+ $active_plugins_keys = get_option( 'active_plugins', array() );
245
+ $active_plugins = array();
246
+
247
+ foreach ( $plugins as $k => $v ) {
248
+ // Take care of formatting the data how we want it.
249
+ $formatted = array();
250
+ $formatted[ 'name' ] = strip_tags( $v[ 'Name' ] );
251
+ if ( isset( $v[ 'Version' ] ) ) {
252
+ $formatted[ 'version' ] = strip_tags( $v[ 'Version' ] );
253
+ }
254
+ if ( isset( $v[ 'Author' ] ) ) {
255
+ $formatted[ 'author' ] = strip_tags( $v[ 'Author' ] );
256
+ }
257
+ if ( isset( $v[ 'Network' ] ) ) {
258
+ $formatted[ 'network' ] = strip_tags( $v[ 'Network' ] );
259
+ }
260
+ if ( isset( $v[ 'PluginURI' ] ) ) {
261
+ $formatted[ 'plugin_uri' ] = strip_tags( $v[ 'PluginURI' ] );
262
+ }
263
+ if ( in_array( $k, $active_plugins_keys ) ) {
264
+ // Remove active plugins from list so we can show active and inactive separately
265
+ unset( $plugins[ $k ] );
266
+ $active_plugins[ $k ] = $formatted;
267
+ } else {
268
+ $plugins[ $k ] = $formatted;
269
+ }
270
+ }
271
+
272
+ return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins );
273
+ }
274
+
275
+ /**
276
+ * Sends current WooCommerce version
277
+ * @return string
278
+ */
279
+ private static function ts_get_wc_plugin_version() {
280
+ return WC()->version;
281
+ }
282
+ }
woocommerce-abandoned-cart/includes/component/tracking data/ts-tracking.php ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ include_once( 'class-ts-tracker.php' );
7
+
8
+ /** Adds the Tracking non-senstive data notice
9
+ *
10
+ * @since 6.8
11
+ */
12
+ class TS_tracking {
13
+
14
+ /**
15
+ * @var string Plugin prefix
16
+ * @access public
17
+ */
18
+
19
+ public static $plugin_prefix = '';
20
+
21
+ /**
22
+ * @var string Plugin Name
23
+ * @access public
24
+ */
25
+
26
+ public static $plugin_name = '';
27
+
28
+ /**
29
+ * @var string Tracking data blog post link
30
+ * @access public
31
+ */
32
+
33
+ public static $blog_post_link = '';
34
+
35
+ /**
36
+ * @var string Plugin context
37
+ * @access public
38
+ */
39
+
40
+ public static $plugin_context = '';
41
+
42
+ /**
43
+ * @var string Plugin url
44
+ * @access public
45
+ */
46
+ public static $plugin_url = '';
47
+
48
+ /**
49
+ * @var string File path
50
+ * @access public
51
+ */
52
+ public static $ts_file_path = '' ;
53
+ /**
54
+ * @var string plugin locale
55
+ * @access public
56
+ */
57
+ public static $ts_plugin_locale = '';
58
+
59
+ /**
60
+ * @var string Settings page
61
+ * @access public
62
+ */
63
+ public static $ts_settings_page = '';
64
+
65
+ /**
66
+ * @var string On which setting page need to add setting
67
+ * @access public
68
+ */
69
+ public static $ts_add_setting_on_page = '';
70
+ /**
71
+ * @var string On which section setting need to add
72
+ * @access public
73
+ */
74
+ public static $ts_add_setting_on_section = '';
75
+ /**
76
+ * @var string Register setting
77
+ * @access public
78
+ */
79
+ public static $ts_register_setting = '';
80
+ /**
81
+ * Default Constructor
82
+ *
83
+ */
84
+ public function __construct( $ts_plugin_prefix = '', $ts_plugin_name = '', $ts_blog_post_link = '', $ts_plugin_context = '', $ts_plugin_url = '', $setting_page = '', $add_setting = '', $setting_section = '', $setting_register = '' ) {
85
+
86
+ self::$plugin_prefix = $ts_plugin_prefix;
87
+ self::$plugin_name = $ts_plugin_name;
88
+ self::$blog_post_link = $ts_blog_post_link;
89
+ self::$plugin_url = $ts_plugin_url;
90
+ self::$ts_plugin_locale = $ts_plugin_context;
91
+ self::$ts_settings_page = $setting_page;
92
+ self::$ts_add_setting_on_page = $add_setting;
93
+ self::$ts_add_setting_on_section = $setting_section;
94
+ self::$ts_register_setting = $setting_register;
95
+
96
+ self::$ts_file_path = untrailingslashit( plugins_url( '/', __FILE__) ) ;
97
+ //Tracking Data
98
+ add_action( 'admin_notices', array( 'TS_tracking', 'ts_track_usage_data' ) );
99
+ add_action( 'admin_footer', array( 'TS_tracking', 'ts_admin_notices_scripts' ) );
100
+ add_action( 'wp_ajax_'.self::$plugin_prefix.'_admin_notices', array( 'TS_tracking', 'ts_admin_notices' ) );
101
+
102
+ add_filter( 'cron_schedules', array( 'TS_tracking', 'ts_add_cron_schedule' ) );
103
+
104
+ add_action( self::$plugin_prefix . '_add_new_settings', array( 'TS_tracking', 'ts_add_reset_tracking_setting' ) );
105
+
106
+ add_action ( 'admin_init', array( 'TS_tracking', 'ts_reset_tracking_setting' ) ) ;
107
+
108
+ self::ts_schedule_cron_job();
109
+ }
110
+
111
+ /**
112
+ * It will delete the tracking option from the database.
113
+ */
114
+ public static function ts_reset_tracking_setting () {
115
+
116
+ if ( isset ( $_GET [ 'ts_action' ] ) && 'reset_tracking' == $_GET [ 'ts_action' ] ) {
117
+ delete_option( self::$plugin_prefix . '_allow_tracking' );
118
+ delete_option( 'ts_tracker_last_send' );
119
+ $ts_url = remove_query_arg( 'ts_action' );
120
+ wp_safe_redirect( $ts_url );
121
+ }
122
+ }
123
+
124
+ /**
125
+ * It will add the settinig, which will allow store owner to reset the tracking data. Which will result into stop trakcing the data.
126
+ * @hook self::$plugin_prefix . '_add_new_settings'
127
+ *
128
+ */
129
+ public static function ts_add_reset_tracking_setting () {
130
+
131
+ add_settings_field(
132
+ 'ts_reset_tracking',
133
+ __( 'Reset usage tracking', self::$ts_plugin_locale ),
134
+ array( 'TS_tracking', 'ts_rereset_tracking_callback' ),
135
+ self::$ts_add_setting_on_page,
136
+ self::$ts_add_setting_on_section,
137
+ array( 'This will reset your usage tracking settings, causing it to show the opt-in banner again and not sending any data.', self::$ts_plugin_locale )
138
+ );
139
+
140
+ register_setting(
141
+ self::$ts_register_setting,
142
+ 'ts_reset_tracking'
143
+ );
144
+ }
145
+
146
+ public static function ts_reset_tracking_setting_section_callback ( ) {
147
+
148
+ }
149
+
150
+ /**
151
+ * It will add the Reset button on the settings page.
152
+ * @param array $args
153
+ */
154
+ public static function ts_rereset_tracking_callback ( $args ) {
155
+ $wcap_restrict_domain_address = get_option( 'wcap_restrict_domain_address' );
156
+ $domain_value = isset( $wcap_restrict_domain_address ) ? esc_attr( $wcap_restrict_domain_address ) : '';
157
+ // Next, we update the name attribute to access this element's ID in the context of the display options array
158
+ // We also access the show_header element of the options collection in the call to the checked() helper function
159
+ $ts_action = self::$ts_settings_page . "&amp;ts_action=reset_tracking";
160
+ printf( '<a href="'.$ts_action.'" class="button button-large reset_tracking">Reset</a>' );
161
+
162
+ // Here, we'll take the first argument of the array and add it to a label next to the checkbox
163
+ $html = '<label for="wcap_restrict_domain_address_label"> ' . $args[0] . '</label>';
164
+ echo $html;
165
+ }
166
+
167
+ /**
168
+ * It will add a cron job for sending the tarcking data.
169
+ * By default it will set once in a week interval.
170
+ * @hook cron_schedules
171
+ * @param array $schedules
172
+ * @return array $schedules
173
+ */
174
+ public static function ts_add_cron_schedule( $schedules ) {
175
+ $schedules[ 'once_in_week' ] = array(
176
+ 'interval' => 604800, // one week in seconds
177
+ 'display' => __( 'Once in a Week', self::$ts_plugin_locale )
178
+ );
179
+
180
+ return $schedules;
181
+ }
182
+
183
+ /**
184
+ * To capture the data from the client site.
185
+ */
186
+ public static function ts_schedule_cron_job () {
187
+ if ( ! wp_next_scheduled( self::$plugin_prefix . '_ts_tracker_send_event' ) ) {
188
+ wp_schedule_event( time(), 'once_in_week', self::$plugin_prefix . '_ts_tracker_send_event' );
189
+ }
190
+ }
191
+
192
+ /**
193
+ * Load the js file in the admin
194
+ *
195
+ * @since 6.8
196
+ * @access public
197
+ */
198
+ public static function ts_admin_notices_scripts() {
199
+
200
+ wp_enqueue_script(
201
+ 'ts_dismiss_notice',
202
+ self::$ts_file_path . '/assets/js/dismiss-notice.js',
203
+ '',
204
+ '',
205
+ false
206
+ );
207
+
208
+ wp_localize_script( 'ts_dismiss_notice', 'ts_dismiss_notice', array (
209
+ 'ts_prefix_of_plugin' => self::$plugin_prefix,
210
+ 'ts_admin_url' => admin_url( 'admin-ajax.php' )
211
+ ) );
212
+ }
213
+
214
+ /**
215
+ * Called when the dismiss icon is clicked on the notice.
216
+ *
217
+ * @since 6.8
218
+ * @access public
219
+ */
220
+
221
+ public static function ts_admin_notices() {
222
+ update_option( self::$plugin_prefix . '_allow_tracking', 'dismissed' );
223
+ TS_Tracker::ts_send_tracking_data( false );
224
+ die();
225
+ }
226
+
227
+ /**
228
+ * Send the data tracking data to the server.
229
+ *
230
+ * @access public
231
+ *
232
+ */
233
+
234
+ private static function ts_tracking_actions() {
235
+ if ( isset( $_GET[ self::$plugin_prefix . '_tracker_optin' ] ) && isset( $_GET[ self::$plugin_prefix . '_tracker_nonce' ] ) && wp_verify_nonce( $_GET[ self::$plugin_prefix . '_tracker_nonce' ], self::$plugin_prefix . '_tracker_optin' ) ) {
236
+ update_option( self::$plugin_prefix . '_allow_tracking', 'yes' );
237
+ TS_Tracker::ts_send_tracking_data( true );
238
+ header( 'Location: ' . $_SERVER[ 'HTTP_REFERER' ] );
239
+ } elseif ( isset( $_GET[ self::$plugin_prefix . '_tracker_optout' ] ) && isset( $_GET[ self::$plugin_prefix . '_tracker_nonce' ] ) && wp_verify_nonce( $_GET[ self::$plugin_prefix . '_tracker_nonce' ], self::$plugin_prefix . '_tracker_optout' ) ) {
240
+ update_option( self::$plugin_prefix . '_allow_tracking', 'no' );
241
+ TS_Tracker::ts_send_tracking_data( false );
242
+ header( 'Location: ' . $_SERVER[ 'HTTP_REFERER' ] );
243
+ }
244
+ }
245
+
246
+ /**
247
+ * Adds a data usage tracking notice in the admin
248
+ *
249
+ * @access public
250
+ * @since 6.8
251
+ */
252
+
253
+ public static function ts_track_usage_data() {
254
+ $admin_url = get_admin_url();
255
+ echo '<input type="hidden" id="admin_url" value="' . $admin_url . '"/>';
256
+ self::ts_tracking_actions();
257
+ if ( 'unknown' === get_option( self::$plugin_prefix . '_allow_tracking', 'unknown' ) ) : ?>
258
+ <div class="<?php echo self::$plugin_prefix; ?>-message <?php echo self::$plugin_prefix; ?>-tracker notice notice-info is-dismissible" style="position: relative;">
259
+ <div style="position: absolute;"><img class="site-logo" src= " <?php echo self::$ts_file_path . '/assets/images/site-logo-new.jpg '; ?> "></div>
260
+ <p style="margin: 10px 0 10px 130px; font-size: medium;">
261
+ <?php print( __( 'Want to help make ' . self::$plugin_name . ' even more awesome? Allow ' . self::$plugin_name . ' to collect non-sensitive diagnostic data and usage information and get 20% off on your next purchase. <a href="' . self::$blog_post_link . '">Find out more</a>.', self::$plugin_context ) ); ?></p>
262
+ <p class="submit">
263
+ <a class="button-primary button button-large" href="<?php echo esc_url( wp_nonce_url( add_query_arg( self::$plugin_prefix . '_tracker_optin', 'true' ), self::$plugin_prefix . '_tracker_optin', self::$plugin_prefix . '_tracker_nonce' ) ); ?>"><?php esc_html_e( 'Allow', self::$plugin_context ); ?></a>
264
+ <a class="button-secondary button button-large skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( self::$plugin_prefix . '_tracker_optout', 'true' ), self::$plugin_prefix . '_tracker_optout', self::$plugin_prefix . '_tracker_nonce' ) ); ?>"><?php esc_html_e( 'No thanks', self::$plugin_context ); ?></a>
265
+ </p>
266
+ </div>
267
+ <?php endif;
268
+ }
269
+ }
woocommerce-abandoned-cart/includes/component/welcome-page/Instructions ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Welcome page feature allows you to add an introduction page when a plugin is installed and active for the first time or when it is updated.
2
+
3
+ To add this feature to the plugin, you can follow the below steps:
4
+
5
+ 1. Copy the ts-welcome.php file into your plugin folder.
6
+
7
+ 2. Copy the files in the template folder to template in the plugin.
8
+
9
+ 3. Include the file once when on the admin page. This can be done with is_admin() function.
10
+
11
+ 4. You need to pass the 6 parameters to the default constructor of the TS_Welcome class. You need to change the value of the variable value as per the respective plugin.
12
+
13
+ $wcap_plugin_prefix = 'wcap';
14
+ $wcap_plugin_name = 'Abandoned Cart Pro for WooCommerce';
15
+ $wcap_blog_post_link = 'https://www.tychesoftwares.com/order-delivery-date-usage-tracking/';
16
+ $wcap_locale = 'woocommerce-ac';
17
+ define('WCAP_PLUGIN_PATH' , untrailingslashit(plugin_dir_path(__FILE__)) );
18
+ $wcap_plugin_folder_name = 'woocommerce-abandon-cart-pro/';
19
+ $wcap_plugin_dir_name = WCAP_PLUGIN_PATH . '/woocommerce-ac.php' ;
20
+ $wcap_get_previous_version = get_option( 'woocommerce_ac_db_version' );
21
+
22
+ new TS_Welcome ( $wcap_plugin_name, $wcap_plugin_prefix, $wcap_locale, $wcap_plugin_folder_name, $wcap_plugin_dir_name, $wcap_get_previous_version );
23
+
24
+ 5. Add the below code in the uninstall.php file of the plugin.
25
+
26
+ delete_option( '{{plugin-prefix}}_pro_welcome_page_shown' );
27
+ delete_option( '{{plugin-prefix}}_pro_welcome_page_shown_time' );
28
+
29
+ 6. You need to update the Template as per your update of the plguin. You just need to update the template content.
30
+
31
+ Note:
32
+
33
+ 1. Please put your all images in the images folder of this folder.
34
+ 2. You can use the $ts_dir_image_path for img src. Like <img src="<?php echo $ts_dir_image_path . 'custom-delivery-settings.png'?>"
35
+ 3. Please change the Utm parameters
36
+
37
+ You just need to append the image name.
woocommerce-abandoned-cart/includes/component/welcome-page/assets/images/abandon-cart-cut-off-time.png ADDED
Binary file
woocommerce-abandoned-cart/includes/component/welcome-page/assets/images/abandoned-cart-lite-email-templates.png ADDED
Binary file
woocommerce-abandoned-cart/includes/component/welcome-page/assets/images/email-templates-send-time.png ADDED
Binary file
woocommerce-abandoned-cart/includes/component/welcome-page/assets/images/icon-256x256.png ADDED
Binary file
woocommerce-abandoned-cart/includes/component/welcome-page/assets/images/site-logo-new.jpg ADDED
Binary file
woocommerce-abandoned-cart/includes/component/welcome-page/templates/social-media-elements.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Welcome page on activate or updation of the plugin
4
+ */
5
+ ?>
6
+ <div class="social-items-wrap">
7
+ <iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Ftychesoftwares&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=220596284639969" scrolling="no" frameborder="0" style="border:none;overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
8
+ <a href="https://twitter.com/tychesoftwares" class="twitter-follow-button" data-show-count="false"><?php
9
+ printf(
10
+ esc_html_e( 'Follow %s', 'tychesoftwares' ),
11
+ '@tychesoftwares'
12
+ );
13
+ ?></a>
14
+ <script>!function (d, s, id) {
15
+ var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
16
+ if (!d.getElementById(id)) {
17
+ js = d.createElement(s);
18
+ js.id = id;
19
+ js.src = p + '://platform.twitter.com/widgets.js';
20
+ fjs.parentNode.insertBefore(js, fjs);
21
+ }
22
+ }(document, 'script', 'twitter-wjs');
23
+ </script>
24
+ </div>
woocommerce-abandoned-cart/includes/component/welcome-page/templates/welcome/welcome-page.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Welcome page on activate or updation of the plugin
4
+ */
5
+ ?>
6
+ <style>
7
+ .feature-section .feature-section-item {
8
+ float:left;
9
+ width:48%;
10
+ }
11
+ </style>
12
+
13
+ <div class="wrap about-wrap">
14
+ <?php echo $get_welcome_header; ?>
15
+ <div style="float:left;width: 80%;">
16
+ <p class="about-text" style="margin-right:20px;"><?php
17
+ printf(
18
+ __( "Thank you for activating or updating to the latest version of " . $plugin_name . "! If you're a first time user, welcome! You're well to accept deliveries with customer preferred delivery date." )
19
+ );
20
+ ?>
21
+ </p>
22
+ </div>
23
+
24
+ <div class="wcal-badge"><img src="<?php echo $badge_url; ?>" style="width:150px;"/></div>
25
+
26
+ <p>&nbsp;</p>
27
+
28
+ <div class="feature-section clearfix introduction">
29
+
30
+ <h3><?php esc_html_e( "Get Started with Abandoned Cart Lite", 'woocommerce-abandoned-cart' ); ?></h3>
31
+
32
+ <div class="video feature-section-item" style="float:left;padding-right:10px;">
33
+ <img src="<?php echo $ts_dir_image_path . 'abandoned-cart-lite-email-templates.png' ?>"
34
+ alt="<?php esc_attr_e( 'WooCommerce Abandoned Cart Lite', 'woocommerce-abandoned-cart' ); ?>" style="width:600px;">
35
+ </div>
36
+
37
+ <div class="content feature-section-item last-feature">
38
+ <h3><?php esc_html_e( 'Activate Email Template', 'woocommerce-abandoned-cart' ); ?></h3>
39
+
40
+ <p><?php esc_html_e( 'To start sending out abandoned cart notification emails, simply activate the email template from under WooCommerce -> Abandoned Carts -> Email Templates page.', 'woocommerce-abandoned-cart' ); ?></p>
41
+ <a href="admin.php?page=woocommerce_ac_page&action=emailtemplates" target="_blank" class="button-secondary">
42
+ <?php esc_html_e( 'Click Here to go to Email Templates page', 'woocommerce-abandoned-cart' ); ?>
43
+ <span class="dashicons dashicons-external"></span>
44
+ </a>
45
+ </div>
46
+ </div>
47
+
48
+ <!-- /.intro-section -->
49
+
50
+ <div class="content">
51
+
52
+ <h3><?php esc_html_e( "Know more about Abandoned Cart Pro", 'woocommerce-abandoned-cart' ); ?></h3>
53
+
54
+ <p><?php _e( 'The Abandoned Cart Pro plugin gives you features where you are able to recover more sales compared to the Lite plugin. Here are some notable features the Pro version provides.' ); ?></p>
55
+
56
+ <div class="feature-section clearfix introduction">
57
+ <div class="video feature-section-item" style="float:left;padding-right:10px;">
58
+ <img src="https://www.tychesoftwares.com/wp-content/uploads/2017/08/atc_frontend.png"
59
+ alt="<?php esc_attr_e( 'WooCommerce Abandoned Cart Lite', 'woocommerce-abandoned-cart' ); ?>" style="width:500px;">
60
+ </div>
61
+
62
+ <div class="content feature-section-item last-feature">
63
+ <h3><?php esc_html_e( 'Capture Visitor Emails on click of Add to Cart button', 'woocommerce-abandoned-cart' ); ?></h3>
64
+
65
+ <p><?php esc_html_e( 'The ability to capture the email address early in the order process is very important to reduce cart abandonment by unknown users as well as to be able to recover their carts if they abandon it. This ultimately leads to increase in your store sales.', 'woocommerce-abandoned-cart' ); ?></p>
66
+ <a href="https://www.tychesoftwares.com/capture-guest-user-email-address-before-checkout-page-with-woocommerce-abandoned-cart-pro/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank" class="button-secondary">
67
+ <?php esc_html_e( 'Learn More', 'woocommerce-abandoned-cart' ); ?>
68
+ <span class="dashicons dashicons-external"></span>
69
+ </a>
70
+ </div>
71
+ </div>
72
+
73
+ <div class="feature-section clearfix">
74
+ <div class="content feature-section-item">
75
+
76
+ <h3><?php esc_html_e( 'Set different cut-off times for visitors & logged-in users', 'woocommerce-abandoned-cart' ); ?></h3>
77
+
78
+ <p><?php esc_html_e( 'The provision for setting two separate cut-off times for different roles is mainly because sometimes if the store admin wants the visitor carts to be captured earlier than the registered user carts, then these different settings can play an important role.', 'woocommerce-abandoned-cart' ); ?></p>
79
+ <a href="https://www.tychesoftwares.com/capturing-abandoned-carts-woocommerce-abandoned-cart-pro-plugin/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank" class="button-secondary">
80
+ <?php esc_html_e( 'Learn More', 'woocommerce-abandoned-cart' ); ?>
81
+ <span class="dashicons dashicons-external"></span>
82
+ </a>
83
+ </div>
84
+
85
+ <div class="content feature-section-item last-feature">
86
+ <img src="<?php echo $ts_dir_image_path . 'abandon-cart-cut-off-time.png'; ?>" alt="<?php esc_attr_e( 'WooCommerce Abandoned Cart Lite', 'woocommerce-abandoned-cart' ); ?>" style="width:450px;">
87
+ </div>
88
+ </div>
89
+
90
+
91
+ <div class="feature-section clearfix introduction">
92
+ <div class="video feature-section-item" style="float:left;padding-right:10px;">
93
+ <img src="<?php echo $ts_dir_image_path . 'email-templates-send-time.png'; ?>" alt="<?php esc_attr_e( 'WooCommerce Abandoned Cart Lite', 'woocommerce-abandoned-cart' ); ?>" style="width:450px;">
94
+ </div>
95
+
96
+ <div class="content feature-section-item last-feature">
97
+ <h3><?php esc_html_e( 'Send abandoned cart recovery email in minutes of cart being abandoned', 'woocommerce-abandoned-cart' ); ?></h3>
98
+
99
+ <p><?php esc_html_e( 'The ability to send the abandoned cart recovery email within first few minutes of cart being abandoned is a big advantage. In the Lite plugin, the earliest an email can be sent is after 1 hour. Whereas in the Pro version, the first recovery email gets sent 15 minutes after the cart is abandoned. This increases the recovery chances manifold.', 'woocommerce-abandoned-cart' ); ?></p>
100
+ <a href="https://www.tychesoftwares.com/understanding-the-default-email-templates-of-abandoned-cart-pro-for-woocommerce-plugin/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank" class="button-secondary">
101
+ <?php esc_html_e( 'Learn More', 'woocommerce-abandoned-cart' ); ?>
102
+ <span class="dashicons dashicons-external"></span>
103
+ </a>
104
+ </div>
105
+ </div>
106
+ </div>
107
+
108
+ <div class="feature-section clearfix">
109
+ <div class="content feature-section-item">
110
+ <h3><?php esc_html_e( 'Getting to Know Tyche Softwares', 'woocommerce-ac' ); ?></h3>
111
+ <ul class="ul-disc">
112
+ <li><a href="https://tychesoftwares.com/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=OrderDeliveryDateProPlugin" target="_blank"><?php esc_html_e( 'Visit the Tyche Softwares Website', 'woocommerce-ac' ); ?></a></li>
113
+ <li><a href="https://tychesoftwares.com/premium-plugins/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=OrderDeliveryDateProPlugin" target="_blank"><?php esc_html_e( 'View all Premium Plugins', 'woocommerce-ac' ); ?></a>
114
+ <ul class="ul-disc">
115
+ <li><a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=OrderDeliveryDateProPlugin" target="_blank">Abandoned Cart Pro Plugin for WooCommerce</a></li>
116
+ <li><a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-booking-plugin/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=OrderDeliveryDateProPlugin" target="_blank">Booking & Appointment Plugin for WooCommerce</a></li>
117
+ <li><a href="https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=OrderDeliveryDateProPlugin" target="_blank">Order Delivery Date for WooCommerce</a></li>
118
+ <li><a href="https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=OrderDeliveryDateProPlugin" target="_blank">Product Delivery Date for WooCommerce</a></li>
119
+ <li><a href="https://www.tychesoftwares.com/store/premium-plugins/deposits-for-woocommerce/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=OrderDeliveryDateProPlugin" target="_blank">Deposits for WooCommerce</a></li>
120
+ </ul>
121
+ </li>
122
+ <li><a href="https://tychesoftwares.com/about/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=OrderDeliveryDateProPlugin" target="_blank"><?php esc_html_e( 'Meet the team', $plugin_context ); ?></a></li>
123
+ </ul>
124
+
125
+ </div>
126
+
127
+ <div class="content feature-section-item">
128
+ <h3><?php esc_html_e( 'Current Offers', $plugin_context ); ?></h3>
129
+ <p>We do not have any offers going on right now</p>
130
+ </div>
131
+
132
+ </div>
133
+ <!-- /.feature-section -->
134
+ </div>
woocommerce-abandoned-cart/includes/component/welcome-page/ts-welcome.php ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Welcome Page Class
5
+ *
6
+ * Displays on plugin activation or updation
7
+ */
8
+
9
+ // Exit if accessed directly.
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ /**
15
+ * TS_Welcome Class
16
+ *
17
+ * A general class for About page.
18
+ *
19
+ * @since 7.7
20
+ */
21
+
22
+ class TS_Welcome {
23
+
24
+ /**
25
+ * @var string The capability users should have to view the page
26
+ */
27
+ public $minimum_capability = 'manage_options';
28
+
29
+ /**
30
+ * @var string The name of the plugin
31
+ * @access public
32
+ */
33
+ public static $plugin_name = "";
34
+
35
+ /**
36
+ * @var string Unique prefix of the plugin
37
+ * @access public
38
+ */
39
+
40
+ public static $plugin_prefix = '';
41
+
42
+ /**
43
+ * @var Plugin Context
44
+ * @access public
45
+ */
46
+
47
+ public static $plugin_context = '';
48
+
49
+ /**
50
+ * @var string Folder of the plugin
51
+ * @access public
52
+ */
53
+ public static $plugin_folder = '';
54
+
55
+ /**
56
+ * @var string Plugin live version
57
+ * @access public
58
+ */
59
+
60
+ public static $plugin_version = '';
61
+
62
+ /**
63
+ * @var string Plugin previous version
64
+ * @access public
65
+ */
66
+ public static $previous_plugin_version = '';
67
+ /**
68
+ * @var string Plugin Url
69
+ * @access public
70
+ */
71
+ public static $plugin_url = '';
72
+ /**
73
+ * @var string Template base path
74
+ * @access public
75
+ */
76
+ public static $template_base = '';
77
+ /**
78
+ * @var string Plugin dir name with plugin file name
79
+ * @access public
80
+ */
81
+ public static $plugin_file_path = '';
82
+ /**
83
+ * Get things started
84
+ *
85
+ * @since 7.7
86
+ */
87
+ public function __construct( $ts_plugin_name = '', $ts_plugin_prefix = '', $ts_plugin_context = '', $ts_plugin_folder_name = '', $ts_plugin_dir_name = '' , $ts_previous_version = '' ) {
88
+ self::$plugin_name = $ts_plugin_name;
89
+ self::$plugin_prefix = $ts_plugin_prefix;
90
+ self::$plugin_context = $ts_plugin_context;
91
+ self::$plugin_folder = $ts_plugin_folder_name;
92
+ self::$plugin_file_path = $ts_plugin_dir_name;
93
+
94
+ //Update plugin
95
+ add_action( 'admin_init', array( &$this, 'ts_update_db_check' ) );
96
+
97
+ add_action( 'admin_menu', array( $this, 'admin_menus' ) );
98
+ add_action( 'admin_head', array( $this, 'admin_head' ) );
99
+
100
+ if ( !isset( $_GET[ 'page' ] ) ||
101
+ ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] != self::$plugin_prefix . '-pro-about' ) ) {
102
+ add_action( 'admin_init', array( $this, 'ts_pro_welcome' ) );
103
+ }
104
+
105
+ self::$plugin_version = $this->ts_get_version();
106
+
107
+ self::$previous_plugin_version = $ts_previous_version;
108
+ self::$plugin_url = $this->ts_get_plugin_url();
109
+ self::$template_base = $this->ts_get_template_path();
110
+ }
111
+
112
+ /**
113
+ * This function returns the plugin version number.
114
+ *
115
+ * @access public
116
+ * @since 7.7
117
+ * @return $plugin_version
118
+ */
119
+ public function ts_get_version() {
120
+ $plugin_version = '';
121
+
122
+ $plugin_data = get_file_data( self::$plugin_file_path, array( 'Version' => 'Version' ) );
123
+ if ( ! empty( $plugin_data['Version'] ) ) {
124
+ $plugin_version = $plugin_data[ 'Version' ];
125
+ }
126
+ return $plugin_version;;
127
+ }
128
+
129
+ /**
130
+ * This function returns the plugin url
131
+ *
132
+ * @access public
133
+ * @since 7.7
134
+ * @return string
135
+ */
136
+ public function ts_get_plugin_url() {
137
+ return plugins_url() . '/' . self::$plugin_folder . '/';
138
+ }
139
+
140
+ /**
141
+ * This function returns the template directory path
142
+ *
143
+ * @access public
144
+ * @since 7.7
145
+ * @return string
146
+ */
147
+ public function ts_get_template_path() {
148
+
149
+ return untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/';
150
+ }
151
+
152
+ /**
153
+ * Register the Dashboard Page which is later hidden but this pages
154
+ * is used to render the Welcome page.
155
+ *
156
+ * @access public
157
+ * @since 7.7
158
+ * @return void
159
+ */
160
+ public function admin_menus() {
161
+ $display_version = self::$plugin_version;
162
+
163
+ // About Page
164
+ add_dashboard_page(
165
+ sprintf( esc_html__( 'Welcome to %s %s', self::$plugin_context ), self::$plugin_name, $display_version ),
166
+ esc_html__( 'Welcome to ' . self::$plugin_name, self::$plugin_context ),
167
+ $this->minimum_capability,
168
+ self::$plugin_prefix . '-pro-about',
169
+ array( $this, 'about_screen' )
170
+ );
171
+
172
+ }
173
+
174
+ /**
175
+ * Hide Individual Dashboard Pages
176
+ *
177
+ * @access public
178
+ * @since 7.7
179
+ * @return void
180
+ */
181
+ public function admin_head() {
182
+ remove_submenu_page( 'index.php', self::$plugin_prefix . '-pro-about' );
183
+ }
184
+
185
+ /**
186
+ * Render About Screen
187
+ *
188
+ * @access public
189
+ * @since 7.7
190
+ * @return void
191
+ */
192
+ public function about_screen() {
193
+ $display_version = self::$plugin_version;
194
+ $ts_file_path = plugin_dir_url( __FILE__ ) ;
195
+ // Badge for welcome page
196
+ $badge_url = $ts_file_path . '/assets/images/icon-256x256.png';
197
+
198
+ ob_start();
199
+ wc_get_template( 'welcome/welcome-page.php', array(
200
+ 'plugin_name' => self::$plugin_name,
201
+ 'plugin_url' => self::$plugin_url,
202
+ 'display_version' => $display_version,
203
+ 'badge_url' => $badge_url,
204
+ 'ts_dir_image_path' => $ts_file_path . '/assets/images/',
205
+ 'plugin_context' => self::$plugin_context,
206
+ 'get_welcome_header' => $this->get_welcome_header()
207
+ ), self::$plugin_folder, self::$template_base );
208
+ echo ob_get_clean();
209
+
210
+ add_option( self::$plugin_prefix . '_pro_welcome_page_shown', 'yes' );
211
+ add_option( self::$plugin_prefix . '_pro_welcome_page_shown_time', current_time( 'timestamp' ) );
212
+ }
213
+
214
+ /**
215
+ * The header section for the welcome screen.
216
+ *
217
+ * @since 7.7
218
+ */
219
+ public function get_welcome_header() {
220
+ // Badge for welcome page
221
+ $ts_file_path = plugin_dir_url( __FILE__ ) ;
222
+
223
+ // Badge for welcome page
224
+ $badge_url = $ts_file_path . '/assets/images/icon-256x256.png';
225
+ ?>
226
+ <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
227
+ <?php $this->social_media_elements();
228
+ }
229
+
230
+ /**
231
+ * Social Media Like Buttons
232
+ *
233
+ * Various social media elements to Tyche Softwares
234
+ */
235
+ public function social_media_elements() {
236
+ ob_start();
237
+ wc_get_template( '/social-media-elements.php',
238
+ array(),
239
+ self::$plugin_folder,
240
+ self::$template_base );
241
+ echo ob_get_clean();
242
+ }
243
+ /**
244
+ * Sends user to the Welcome page on first activation of the plugin as well as each
245
+ * time the plugin is updated is upgraded to a new version
246
+ *
247
+ * @access public
248
+ * @since 7.7
249
+ *
250
+ * @return void
251
+ */
252
+ public function ts_pro_welcome() {
253
+
254
+ // Bail if activating from network, or bulk
255
+ if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) {
256
+ return;
257
+ }
258
+
259
+ if( !get_option( self::$plugin_prefix . '_pro_welcome_page_shown' ) ) {
260
+ wp_safe_redirect( admin_url( 'index.php?page=' . self::$plugin_prefix . '-pro-about' ) );
261
+ exit;
262
+ }
263
+ }
264
+
265
+ /**
266
+ * Executed when the plugin is updated using the Automatic Updater.
267
+ */
268
+ public function ts_update_db_check() {
269
+
270
+ if ( self::$plugin_version != self::$previous_plugin_version ) {
271
+ delete_option( self::$plugin_prefix . '_pro_welcome_page_shown' );
272
+ delete_option( self::$plugin_prefix . '_pro_welcome_page_shown_time' );
273
+ }
274
+ }
275
+ }
woocommerce-abandoned-cart/includes/wcal-common.php CHANGED
@@ -12,6 +12,459 @@
12
  */
13
  class wcal_common {
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  /**
16
  * It will fetch the total count for the abandoned cart section.
17
  * @param string $get_section_result Name of the section for which we need result
@@ -32,22 +485,22 @@ class wcal_common {
32
 
33
  switch ( $get_section_result ) {
34
  case 'wcal_all_abandoned':
35
- $query_ac = "SELECT COUNT(`id`) as cnt FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE ( user_type = 'REGISTERED' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '%$blank_cart%' AND abandoned_cart_time <= '$compare_time' AND recovered_cart = 0 ) OR ( user_type = 'GUEST' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '%$blank_cart%' AND abandoned_cart_time <= '$compare_time' AND recovered_cart = 0 ) ORDER BY recovered_cart desc ";
36
  $return_abandoned_count = $wpdb->get_var( $query_ac );
37
  break;
38
 
39
  case 'wcal_all_registered':
40
- $query_ac = "SELECT COUNT(`id`) FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE ( user_type = 'REGISTERED' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '%$blank_cart%' AND abandoned_cart_time <= '$compare_time' AND recovered_cart = 0 ) ORDER BY recovered_cart desc ";
41
  $return_abandoned_count = $wpdb->get_var( $query_ac );
42
  break;
43
 
44
  case 'wcal_all_guest':
45
- $query_ac = "SELECT COUNT(`id`) FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE ( user_type = 'GUEST' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '%$blank_cart%' AND abandoned_cart_time <= '$compare_time' AND recovered_cart = 0 AND user_id >= 63000000 ) ORDER BY recovered_cart desc ";
46
  $return_abandoned_count = $wpdb->get_var( $query_ac );
47
  break;
48
 
49
  case 'wcal_all_visitor':
50
- $query_ac = "SELECT COUNT(`id`) FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE ( user_type = 'GUEST' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '%$blank_cart%' AND abandoned_cart_time <= '$compare_time' AND recovered_cart = 0 AND user_id = 0 ) ORDER BY recovered_cart desc ";
51
  $return_abandoned_count = $wpdb->get_var( $query_ac );
52
  break;
53
 
@@ -131,5 +584,158 @@ class wcal_common {
131
 
132
  <?php
133
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  }
135
  ?>
12
  */
13
  class wcal_common {
14
 
15
+ /**
16
+ * Get abandoned orders counts.
17
+ * @globals mixed $wpdb
18
+ * @return string | int $wcal_order_count
19
+ * @since 3.9
20
+ */
21
+ private static function wcal_ts_get_abandoned_order_counts() {
22
+ global $wpdb;
23
+ $wcal_order_count = 0;
24
+
25
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
26
+ $cut_off_time = $ac_cutoff_time * 60;
27
+ $current_time = current_time( 'timestamp' );
28
+ $compare_time = $current_time - $cut_off_time;
29
+
30
+ $blank_cart_info = '{"cart":[]}';
31
+ $blank_cart_info_guest = '[]';
32
+
33
+ $wcal_query = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest'";
34
+
35
+ $wcal_order_count = $wpdb->get_var( $wcal_query );
36
+
37
+ return $wcal_order_count;
38
+ }
39
+
40
+
41
+ /**
42
+ * Get recovered orders counts.
43
+ * @globals mixed $wpdb
44
+ * @return string | int $wcal_recovered_order_count
45
+ * @since 3.9
46
+ */
47
+ private static function wcal_ts_get_recovered_order_counts(){
48
+
49
+ global $wpdb;
50
+ $wcal_recovered_order_count = 0;
51
+
52
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
53
+ $cut_off_time = $ac_cutoff_time * 60;
54
+ $current_time = current_time( 'timestamp' );
55
+ $compare_time = $current_time - $cut_off_time;
56
+
57
+ $wcal_recovery_query = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE recovered_cart > 0 AND abandoned_cart_time <= '$compare_time'";
58
+
59
+ $wcal_recovered_order_count = $wpdb->get_var( $wcal_recovery_query );
60
+
61
+ return $wcal_recovered_order_count;
62
+ }
63
+
64
+ /**
65
+ * Get Total abandoned orders amount.
66
+ * @globals mixed $wpdb
67
+ * @return string | int $wcal_abandoned_orders_amount
68
+ * @since 3.9
69
+ */
70
+ private static function wcal_ts_get_abandoned_order_total_amount(){
71
+ global $wpdb;
72
+ $wcal_abandoned_orders_amount = 0;
73
+
74
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
75
+ $cut_off_time = $ac_cutoff_time * 60;
76
+ $current_time = current_time( 'timestamp' );
77
+ $compare_time = $current_time - $cut_off_time;
78
+
79
+ $blank_cart_info = '{"cart":[]}';
80
+ $blank_cart_info_guest = '[]';
81
+
82
+ $wcal_abandoned_query = "SELECT abandoned_cart_info FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest'";
83
+
84
+ $wcal_abandoned_query_result = $wpdb->get_results( $wcal_abandoned_query );
85
+
86
+ $wcal_abandoned_orders_amount = self::wcal_get_abandoned_amount( $wcal_abandoned_query_result );
87
+
88
+ return $wcal_abandoned_orders_amount;
89
+ }
90
+
91
+ /**
92
+ * Get Total abandoned orders amount.
93
+ * @globals mixed $wpdb
94
+ * @param array | object $wcal_abandoned_query_result
95
+ * @return string | int $wcal_abandoned_orders_amount
96
+ * @since 3.9
97
+ */
98
+ private static function wcal_get_abandoned_amount( $wcal_abandoned_query_result ){
99
+
100
+ $wcal_abandoned_orders_amount = 0;
101
+ foreach ( $wcal_abandoned_query_result as $wcal_abandoned_query_key => $wcal_abandoned_query_value ) {
102
+ # code...
103
+ $cart_info = json_decode( $wcal_abandoned_query_value->abandoned_cart_info );
104
+
105
+ $cart_details = array();
106
+ if( isset( $cart_info->cart ) ){
107
+ $cart_details = $cart_info->cart;
108
+ }
109
+
110
+ if( count( $cart_details ) > 0 ) {
111
+ foreach( $cart_details as $k => $v ) {
112
+ if( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
113
+ $wcal_abandoned_orders_amount = $wcal_abandoned_orders_amount + $v->line_total + $v->line_subtotal_tax;
114
+ } else {
115
+ $wcal_abandoned_orders_amount = $wcal_abandoned_orders_amount + $v->line_total;
116
+ }
117
+ }
118
+ }
119
+ }
120
+ return $wcal_abandoned_orders_amount;
121
+ }
122
+
123
+ /**
124
+ * Get recovered orders total amount.
125
+ * @globals mixed $wpdb
126
+ * @return string | int $wcal_recovered_orders_amount
127
+ * @since 3.9
128
+ */
129
+ private static function wcal_ts_get_recovered_order_total_amount() {
130
+
131
+ global $wpdb;
132
+ $wcal_recovered_orders_amount = 0;
133
+
134
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
135
+ $cut_off_time = $ac_cutoff_time * 60;
136
+ $current_time = current_time( 'timestamp' );
137
+ $compare_time = $current_time - $cut_off_time;
138
+
139
+ $wcal_recovery_query_amount = "SELECT recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE recovered_cart > 0 AND abandoned_cart_time <= '$compare_time'";
140
+
141
+ $wcal_recovered_order_amount_result = $wpdb->get_results( $wcal_recovery_query_amount );
142
+
143
+ $wcal_recovered_orders_amount = self::wcal_get_recovered_amount ($wcal_recovered_order_amount_result );
144
+
145
+ return $wcal_recovered_orders_amount;
146
+ }
147
+
148
+ /**
149
+ * Get recovered orders total amount.
150
+ * @globals mixed $wpdb
151
+ * @param array | object $wcal_data
152
+ * @return string | int $wcal_recovered_orders_amount
153
+ * @since 3.9
154
+ */
155
+
156
+ private static function wcal_get_recovered_amount ( $wcal_data ){
157
+
158
+ $wcal_recovered_orders_amount = 0;
159
+
160
+ foreach ($wcal_data as $wcal_data_key => $wcal_data_value) {
161
+
162
+ $wcal_order_total = get_post_meta( $wcal_data_value->recovered_cart , '_order_total', true);
163
+ $wcal_recovered_orders_amount = $wcal_recovered_orders_amount + $wcal_order_total;
164
+ }
165
+ return $wcal_recovered_orders_amount;
166
+ }
167
+
168
+ /**
169
+ * Get sent email total count.
170
+ * @globals mixed $wpdb
171
+ * @return string | int $wcal_sent_emails_count
172
+ * @since 3.9
173
+ */
174
+ private static function wcal_ts_get_sent_emails_total_count(){
175
+
176
+ global $wpdb;
177
+ $wcal_sent_emails_count = 0;
178
+ $wcal_sent_emails_query = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_sent_history_lite`";
179
+ $wcal_sent_emails_count = $wpdb->get_var( $wcal_sent_emails_query );
180
+ return $wcal_sent_emails_count;
181
+ }
182
+
183
+ /**
184
+ * Get email templates total count.
185
+ * @globals mixed $wpdb
186
+ * @return array $wcal_templates_data
187
+ * @since 3.9
188
+ */
189
+ private static function wcal_ts_get_email_templates_data(){
190
+
191
+ global $wpdb;
192
+ $wcal_email_templates_count = 0;
193
+ $wcal_email_templates_query = "SELECT id, is_active, is_wc_template,frequency, day_or_hour FROM `" . $wpdb->prefix . "ac_email_templates_lite`";
194
+ $wcal_email_templates_results = $wpdb->get_results( $wcal_email_templates_query );
195
+
196
+ $wcal_email_templates_count = count( $wcal_email_templates_results );
197
+
198
+ $wcal_templates_data = array();
199
+ $wcal_templates_data ['total_templates'] = $wcal_email_templates_count;
200
+
201
+ foreach ($wcal_email_templates_results as $wcal_email_templates_results_key => $wcal_email_templates_results_value ) {
202
+
203
+ $wcal_template_time = $wcal_email_templates_results_value->frequency . ' ' .$wcal_email_templates_results_value->day_or_hour ;
204
+
205
+ $wcal_get_total_email_sent_for_template = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_sent_history_lite` WHERE template_id = ". $wcal_email_templates_results_value->id;
206
+ $wcal_get_total_email_sent_for_template_count = $wpdb->get_var( $wcal_get_total_email_sent_for_template );
207
+
208
+ $wcal_templates_data [ "template_id_" . $wcal_email_templates_results_value->id ] ['is_activate'] = ( $wcal_email_templates_results_value->is_active == 1 ) ? 'Active' : 'Deactive';
209
+ $wcal_templates_data [ "template_id_" . $wcal_email_templates_results_value->id ] ['is_wc_template'] = ( $wcal_email_templates_results_value->is_wc_template == 1 ) ? 'Yes' : 'No';
210
+ $wcal_templates_data [ "template_id_" . $wcal_email_templates_results_value->id ] ['template_time'] = $wcal_template_time;
211
+ $wcal_templates_data [ "template_id_" . $wcal_email_templates_results_value->id ] ['total_email_sent'] = $wcal_get_total_email_sent_for_template_count;
212
+ }
213
+
214
+ return $wcal_templates_data;
215
+ }
216
+
217
+ /**
218
+ * Get logged-in users total abandoned count.
219
+ * @globals mixed $wpdb
220
+ * @return string | int $wcal_logged_in_user_query_count
221
+ * @since 3.9
222
+ */
223
+ private static function wcal_ts_get_logged_in_users_abandoned_cart_total_count (){
224
+
225
+ global $wpdb;
226
+ $wcal_logged_in_user_query_count = 0;
227
+
228
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
229
+ $cut_off_time = $ac_cutoff_time * 60;
230
+ $current_time = current_time( 'timestamp' );
231
+ $compare_time = $current_time - $cut_off_time;
232
+
233
+ $blank_cart_info = '{"cart":[]}';
234
+ $blank_cart_info_guest = '[]';
235
+
236
+ $wcal_logged_in_user_query = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND user_id < 63000000 AND user_id != 0";
237
+
238
+ $wcal_logged_in_user_query_count = $wpdb->get_var( $wcal_logged_in_user_query );
239
+
240
+ return $wcal_logged_in_user_query_count;
241
+ }
242
+
243
+ /**
244
+ * Get Guest users total abandoned count.
245
+ * @globals mixed $wpdb
246
+ * @return string | int $wcal_guest_user_query_count
247
+ * @since 3.9
248
+ */
249
+ private static function wcal_ts_get_guest_users_abandoned_cart_total_count(){
250
+ global $wpdb;
251
+ $wcal_guest_user_query_count = 0;
252
+
253
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
254
+ $cut_off_time = $ac_cutoff_time * 60;
255
+ $current_time = current_time( 'timestamp' );
256
+ $compare_time = $current_time - $cut_off_time;
257
+
258
+ $blank_cart_info = '{"cart":[]}';
259
+ $blank_cart_info_guest = '[]';
260
+
261
+ $wcal_guest_user_query = "SELECT COUNT(id) FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND user_id >= 63000000 AND user_id != 0";
262
+
263
+ $wcal_guest_user_query_count = $wpdb->get_var( $wcal_guest_user_query );
264
+
265
+ return $wcal_guest_user_query_count;
266
+ }
267
+
268
+ /**
269
+ * Get logged-in users total abandoned amount.
270
+ * @globals mixed $wpdb
271
+ * @return string | int $wcal_abandoned_orders_amount
272
+ * @since 3.9
273
+ */
274
+ private static function wcal_ts_get_logged_in_users_abandoned_cart_total_amount (){
275
+
276
+ global $wpdb;
277
+ $wcal_abandoned_orders_amount = 0;
278
+
279
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
280
+ $cut_off_time = $ac_cutoff_time * 60;
281
+ $current_time = current_time( 'timestamp' );
282
+ $compare_time = $current_time - $cut_off_time;
283
+
284
+ $blank_cart_info = '{"cart":[]}';
285
+ $blank_cart_info_guest = '[]';
286
+
287
+ $wcal_abandoned_query = "SELECT abandoned_cart_info FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND user_id < 63000000 AND user_id != 0 ";
288
+
289
+ $wcal_abandoned_query_result = $wpdb->get_results( $wcal_abandoned_query );
290
+
291
+ $wcal_abandoned_orders_amount = self::wcal_get_abandoned_amount( $wcal_abandoned_query_result );
292
+
293
+ return $wcal_abandoned_orders_amount;
294
+ }
295
+
296
+ /**
297
+ * Get Guest users total abandoned amount.
298
+ * @globals mixed $wpdb
299
+ * @return string | int $wcal_abandoned_orders_amount
300
+ * @since 3.9
301
+ */
302
+ private static function wcal_ts_get_guest_users_abandoned_cart_total_amount (){
303
+
304
+ global $wpdb;
305
+ $wcal_abandoned_orders_amount = 0;
306
+
307
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
308
+ $cut_off_time = $ac_cutoff_time * 60;
309
+ $current_time = current_time( 'timestamp' );
310
+ $compare_time = $current_time - $cut_off_time;
311
+
312
+ $blank_cart_info = '{"cart":[]}';
313
+ $blank_cart_info_guest = '[]';
314
+
315
+ $wcal_abandoned_query = "SELECT abandoned_cart_info FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_time <= '$compare_time' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND user_id >= 63000000 AND user_id != 0 ";
316
+
317
+ $wcal_abandoned_query_result = $wpdb->get_results( $wcal_abandoned_query );
318
+
319
+ $wcal_abandoned_orders_amount = self::wcal_get_abandoned_amount( $wcal_abandoned_query_result );
320
+
321
+ return $wcal_abandoned_orders_amount;
322
+ }
323
+
324
+ /**
325
+ * Get logged-in users total recovered amount.
326
+ * @globals mixed $wpdb
327
+ * @return string | int $wcal_recovered_orders_amount
328
+ * @since 3.9
329
+ */
330
+ private static function wcal_ts_get_logged_in_users_recovered_cart_total_amount(){
331
+
332
+ global $wpdb;
333
+ $wcal_recovered_orders_amount = 0;
334
+
335
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
336
+ $cut_off_time = $ac_cutoff_time * 60;
337
+ $current_time = current_time( 'timestamp' );
338
+ $compare_time = $current_time - $cut_off_time;
339
+
340
+ $wcal_recovery_query_amount = "SELECT recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE recovered_cart > 0 AND abandoned_cart_time <= '$compare_time' AND user_id < 63000000 AND user_id != 0 ";
341
+
342
+ $wcal_recovered_order_amount_result = $wpdb->get_results( $wcal_recovery_query_amount );
343
+
344
+ $wcal_recovered_orders_amount = self::wcal_get_recovered_amount ($wcal_recovered_order_amount_result );
345
+
346
+ return $wcal_recovered_orders_amount;
347
+
348
+ }
349
+
350
+
351
+ /**
352
+ * Get Guest users total recovered amount.
353
+ * @globals mixed $wpdb
354
+ * @return string | int $wcal_recovered_orders_amount
355
+ * @since 3.9
356
+ */
357
+ private static function wcal_ts_get_guest_users_recovered_cart_total_amount (){
358
+
359
+ global $wpdb;
360
+ $wcal_recovered_orders_amount = 0;
361
+
362
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
363
+ $cut_off_time = $ac_cutoff_time * 60;
364
+ $current_time = current_time( 'timestamp' );
365
+ $compare_time = $current_time - $cut_off_time;
366
+
367
+ $wcal_recovery_query_amount = "SELECT recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE recovered_cart > 0 AND abandoned_cart_time <= '$compare_time' AND user_id >= 63000000 AND user_id != 0 ";
368
+
369
+ $wcal_recovered_order_amount_result = $wpdb->get_results( $wcal_recovery_query_amount );
370
+
371
+ $wcal_recovered_orders_amount = self::wcal_get_recovered_amount ($wcal_recovered_order_amount_result );
372
+
373
+ return $wcal_recovered_orders_amount;
374
+
375
+ }
376
+ /**
377
+ * Get all options of the plugin.
378
+ * @return array
379
+ * @since 3.9
380
+ */
381
+ private static function wcal_ts_get_all_plugin_options_values() {
382
+
383
+ return array(
384
+ 'wcal_cart_cut_off_time' => get_option( 'ac_lite_cart_abandoned_time' ),
385
+ 'wcal_admin_recovery_email' => get_option( 'ac_lite_email_admin_on_recovery' ),
386
+ 'wcal_capture_visitors_cart' => get_option( 'ac_lite_track_guest_cart_from_cart_page' )
387
+ );
388
+ }
389
+
390
+
391
+ /**
392
+ * If admin allow to track the data the it will gather all information and return back.
393
+ * @hook ts_tracker_data
394
+ * @param array $data
395
+ * @return array $data
396
+ * @since 3.9
397
+ */
398
+ public static function ts_add_plugin_tracking_data ( $data ){
399
+
400
+ if ( isset( $_GET[ 'wcal_tracker_optin' ] ) && isset( $_GET[ 'wcal_tracker_nonce' ] ) && wp_verify_nonce( $_GET[ 'wcal_tracker_nonce' ], 'wcal_tracker_optin' ) ) {
401
+
402
+ $plugin_data[ 'ts_meta_data_table_name'] = 'ts_wcal_tracking_meta_data';
403
+
404
+ $plugin_data[ 'ts_plugin_name' ] = 'Abandoned Cart Lite for WooCommerce';
405
+
406
+ // Store abandoned count info
407
+ $plugin_data[ 'abandoned_orders' ] = self::wcal_ts_get_abandoned_order_counts();
408
+
409
+ // Store recovred count info
410
+ $plugin_data[ 'recovered_orders' ] = self::wcal_ts_get_recovered_order_counts();
411
+
412
+ // store abandoned orders amount
413
+ $plugin_data[ 'abandoned_orders_amount' ] = self::wcal_ts_get_abandoned_order_total_amount();
414
+
415
+ // Store recovered count info
416
+ $plugin_data[ 'recovered_orders_amount' ] = self::wcal_ts_get_recovered_order_total_amount();
417
+
418
+ // Store abandoned cart emails sent count info
419
+ $plugin_data[ 'sent_emails' ] = self::wcal_ts_get_sent_emails_total_count();
420
+
421
+ // Store email template count info
422
+ $plugin_data[ 'email_templates_data' ] = self::wcal_ts_get_email_templates_data();
423
+
424
+ // Store only logged-in users abandoned cart count info
425
+ $plugin_data[ 'logged_in_abandoned_orders' ] = self::wcal_ts_get_logged_in_users_abandoned_cart_total_count();
426
+
427
+ // Store only logged-in users abandoned cart count info
428
+ $plugin_data[ 'guest_abandoned_orders' ] = self::wcal_ts_get_guest_users_abandoned_cart_total_count();
429
+
430
+ // Store only logged-in users abandoned cart amount info
431
+ $plugin_data[ 'logged_in_abandoned_orders_amount' ] = self::wcal_ts_get_logged_in_users_abandoned_cart_total_amount();
432
+
433
+ // store only guest users abandoned cart amount
434
+ $plugin_data[ 'guest_abandoned_orders_amount' ] = self::wcal_ts_get_guest_users_abandoned_cart_total_amount();
435
+
436
+ // Store only logged-in users recovered cart amount info
437
+ $plugin_data[ 'logged_in_recovered_orders_amount' ] = self::wcal_ts_get_logged_in_users_recovered_cart_total_amount();
438
+
439
+ // Store only guest users recovered cart amount
440
+ $plugin_data[ 'guest_recovered_orders_amount' ] = self::wcal_ts_get_guest_users_recovered_cart_total_amount();
441
+
442
+ // Get all plugin options info
443
+ $plugin_data[ 'settings' ] = self::wcal_ts_get_all_plugin_options_values();
444
+ $plugin_data[ 'plugin_version' ] = self::wcal_get_version();
445
+ $plugin_data[ 'tracking_usage' ] = get_option ('wcal_allow_tracking');
446
+
447
+ $data [ 'plugin_data' ] = $plugin_data;
448
+ }
449
+ return $data;
450
+ }
451
+
452
+ /**
453
+ * Get data when Admin dont want to share information.
454
+ * @param array $params
455
+ * @return array $params
456
+ * @since 3.9
457
+ */
458
+ public static function ts_get_data_for_opt_out( $params ){
459
+
460
+ $plugin_data[ 'ts_meta_data_table_name'] = 'ts_wcal_tracking_meta_data';
461
+ $plugin_data[ 'ts_plugin_name' ] = 'Abandoned Cart Lite for WooCommerce';
462
+
463
+ $params[ 'plugin_data' ] = $plugin_data;
464
+
465
+ return $params;
466
+ }
467
+
468
  /**
469
  * It will fetch the total count for the abandoned cart section.
470
  * @param string $get_section_result Name of the section for which we need result
485
 
486
  switch ( $get_section_result ) {
487
  case 'wcal_all_abandoned':
488
+ $query_ac = "SELECT COUNT(`id`) as cnt FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE ( user_type = 'REGISTERED' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart' AND abandoned_cart_time <= '$compare_time' AND recovered_cart = 0 ) OR ( user_type = 'GUEST' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart' AND abandoned_cart_time <= '$compare_time' AND recovered_cart = 0 ) ORDER BY recovered_cart desc ";
489
  $return_abandoned_count = $wpdb->get_var( $query_ac );
490
  break;
491
 
492
  case 'wcal_all_registered':
493
+ $query_ac = "SELECT COUNT(`id`) FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE ( user_type = 'REGISTERED' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart' AND abandoned_cart_time <= '$compare_time' AND recovered_cart = 0 ) ORDER BY recovered_cart desc ";
494
  $return_abandoned_count = $wpdb->get_var( $query_ac );
495
  break;
496
 
497
  case 'wcal_all_guest':
498
+ $query_ac = "SELECT COUNT(`id`) FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE ( user_type = 'GUEST' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart' AND abandoned_cart_time <= '$compare_time' AND recovered_cart = 0 AND user_id >= 63000000 ) ORDER BY recovered_cart desc ";
499
  $return_abandoned_count = $wpdb->get_var( $query_ac );
500
  break;
501
 
502
  case 'wcal_all_visitor':
503
+ $query_ac = "SELECT COUNT(`id`) FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE ( user_type = 'GUEST' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart' AND abandoned_cart_time <= '$compare_time' AND recovered_cart = 0 AND user_id = 0 ) ORDER BY recovered_cart desc ";
504
  $return_abandoned_count = $wpdb->get_var( $query_ac );
505
  break;
506
 
584
 
585
  <?php
586
  }
587
+ /**
588
+ * Returns an array of customer billing information.
589
+ * Should be called only for registered users.
590
+ *
591
+ * @param integer $user_id - User ID
592
+ * @return array $billing_details - Contains Billing Address Details
593
+ * @global $woocommerce
594
+ * @since 4.9
595
+ */
596
+ public static function wcal_get_billing_details( $user_id ) {
597
+ global $woocommerce;
598
+
599
+ $billing_details = array();
600
+
601
+ $user_billing_company_temp = get_user_meta( $user_id, 'billing_company' );
602
+ $user_billing_company = "";
603
+ if ( isset( $user_billing_company_temp[0] ) ){
604
+ $user_billing_company = $user_billing_company_temp[0];
605
+ }
606
+ $billing_details[ 'billing_company' ] = $user_billing_company;
607
+
608
+ $user_billing_address_1_temp = get_user_meta( $user_id, 'billing_address_1' );
609
+ $user_billing_address_1 = "";
610
+ if ( isset( $user_billing_address_1_temp[0] ) ) {
611
+ $user_billing_address_1 = $user_billing_address_1_temp[0];
612
+ }
613
+ $billing_details[ 'billing_address_1' ] = $user_billing_address_1;
614
+
615
+ $user_billing_address_2_temp = get_user_meta( $user_id, 'billing_address_2' );
616
+ $user_billing_address_2 = "";
617
+ if ( isset( $user_billing_address_2_temp[0] ) ) {
618
+ $user_billing_address_2 = $user_billing_address_2_temp[0];
619
+ }
620
+ $billing_details[ 'billing_address_2' ] = $user_billing_address_2;
621
+
622
+ $user_billing_city_temp = get_user_meta( $user_id, 'billing_city' );
623
+ $user_billing_city = "";
624
+ if ( isset( $user_billing_city_temp[0] ) ) {
625
+ $user_billing_city = $user_billing_city_temp[0];
626
+ }
627
+ $billing_details[ 'billing_city' ] = $user_billing_city;
628
+
629
+ $user_billing_postcode_temp = get_user_meta( $user_id, 'billing_postcode' );
630
+ $user_billing_postcode = "";
631
+ if ( isset( $user_billing_postcode_temp[0] ) ) {
632
+ $user_billing_postcode = $user_billing_postcode_temp[0];
633
+ }
634
+ $billing_details[ 'billing_postcode' ] = $user_billing_postcode;
635
+
636
+ $user_billing_country_temp = get_user_meta( $user_id, 'billing_country' );
637
+ $user_billing_country = "";
638
+ if ( isset( $user_billing_country_temp[0] ) && '' != $user_billing_country_temp[0] ) {
639
+ $user_billing_country = $user_billing_country_temp[0];
640
+ if ( isset( $woocommerce->countries->countries[ $user_billing_country ] ) || '' != ( $woocommerce->countries->countries[ $user_billing_country ] ) ) {
641
+ $user_billing_country = WC()->countries->countries[ $user_billing_country ];
642
+ }else {
643
+ $user_billing_country = "";
644
+ }
645
+ }
646
+ $billing_details[ 'billing_country' ] = $user_billing_country;
647
+
648
+ $user_billing_state_temp = get_user_meta( $user_id, 'billing_state' );
649
+ $user_billing_state = "";
650
+ if ( isset( $user_billing_state_temp[0] ) ) {
651
+ $user_billing_state = $user_billing_state_temp[0];
652
+ if ( isset( $woocommerce->countries->states[ $user_billing_country_temp[0] ][ $user_billing_state ] ) ) {
653
+ $user_billing_state = WC()->countries->states[ $user_billing_country_temp[0] ][ $user_billing_state ];
654
+ }else {
655
+ $user_billing_state = "";
656
+ }
657
+ }
658
+ $billing_details[ 'billing_state' ] = $user_billing_state;
659
+
660
+ return $billing_details;
661
+ }
662
+
663
+
664
+ /**
665
+ * Returns the Item Name, Qty and Total for any given product
666
+ * in the WC Cart
667
+ *
668
+ * @param stdClass $v - Cart Information from WC()->cart;
669
+ * @return array $item_details - Item Data
670
+ * @global $woocommerce
671
+ * @since 4.9
672
+ */
673
+ public static function wcal_get_cart_details( $v ) {
674
+ global $woocommerce;
675
+
676
+ $cart_total = $item_subtotal = $item_total = $line_subtotal_tax_display = $after_item_subtotal = $after_item_subtotal_display = 0;
677
+
678
+ $line_subtotal_tax = '';
679
+ $quantity_total = 0;
680
+
681
+ $item_details = array();
682
+
683
+ $quantity_total = $v->quantity;
684
+ $product_id = $v->product_id;
685
+ $prod_name = get_post( $product_id );
686
+ $product_name = $prod_name->post_title;
687
+
688
+ if ( isset( $v->variation_id ) && '' != $v->variation_id ){
689
+ $variation_id = $v->variation_id;
690
+ $variation = wc_get_product( $variation_id );
691
+ $name = $variation->get_formatted_name() ;
692
+ $explode_all = explode ( "&ndash;", $name );
693
+ if( version_compare( $woocommerce->version, '3.0.0', ">=" ) ) {
694
+ $wcap_sku = '';
695
+ if ( $variation->get_sku() ) {
696
+ $wcap_sku = "SKU: " . $variation->get_sku() . "<br>";
697
+ }
698
+ $wcap_get_formatted_variation = wc_get_formatted_variation( $variation, true );
699
+
700
+ $add_product_name = $product_name . ' - ' . $wcap_sku . $wcap_get_formatted_variation;
701
+
702
+ $pro_name_variation = (array) $add_product_name;
703
+ }else{
704
+ $pro_name_variation = array_slice( $explode_all, 1, -1 );
705
+ }
706
+ $product_name_with_variable = '';
707
+ $explode_many_varaition = array();
708
+ foreach( $pro_name_variation as $pro_name_variation_key => $pro_name_variation_value ) {
709
+ $explode_many_varaition = explode ( ",", $pro_name_variation_value );
710
+ if( !empty( $explode_many_varaition ) ) {
711
+ foreach( $explode_many_varaition as $explode_many_varaition_key => $explode_many_varaition_value ) {
712
+ $product_name_with_variable = $product_name_with_variable . html_entity_decode ( $explode_many_varaition_value ) . "<br>";
713
+ }
714
+ } else {
715
+ $product_name_with_variable = $product_name_with_variable . html_entity_decode ( $explode_many_varaition_value ) . "<br>";
716
+ }
717
+ }
718
+ $product_name = $product_name_with_variable;
719
+ }
720
+ $item_subtotal = 0;
721
+ // Item subtotal is calculated as product total including taxes
722
+ if ( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
723
+ $item_subtotal = $item_subtotal + $v->line_total + $v->line_subtotal_tax;
724
+ } else {
725
+ $item_subtotal = $item_subtotal + $v->line_total;
726
+ }
727
+ // Line total
728
+ $item_total = $item_subtotal;
729
+ $item_subtotal = $item_subtotal / $quantity_total;
730
+ $item_total = wc_price( $item_total );
731
+ $item_subtotal = wc_price( $item_subtotal );
732
+
733
+ $item_details[ 'product_name' ] = $product_name;
734
+ $item_details[ 'item_total_formatted' ] = $item_subtotal;
735
+ $item_details[ 'item_total' ] = $item_total;
736
+ $item_details[ 'qty' ] = $quantity_total;
737
+
738
+ return $item_details;
739
+ }
740
  }
741
  ?>
woocommerce-abandoned-cart/includes/wcal_admin_notice.php CHANGED
@@ -13,165 +13,6 @@ if ( ! defined( 'ABSPATH' ) ) {
13
 
14
  class Wcal_Admin_Notice {
15
 
16
- /**
17
- * It will display the four notices for the pro version of the plugin.
18
- * @since 4.3
19
- */
20
- public static function wcal_pro_notice () {
21
-
22
- $wcal_activate_time = get_option ( 'wcal_activate_time' );
23
- $wcal_sixty_days = strtotime( '+60 Days', $wcal_activate_time );
24
- $wcal_current_time = current_time( 'timestamp' );
25
-
26
- if( !is_plugin_active( 'woocommerce-abandon-cart-pro/woocommerce-ac.php' ) &&
27
- ( false === $wcal_activate_time || ( $wcal_activate_time > 0 && $wcal_current_time >= $wcal_sixty_days ) ) ) {
28
- global $current_user ;
29
- $user_id = $current_user->ID;
30
- $wcal_current_time = current_time( 'timestamp' );
31
-
32
- if ( ! get_user_meta( get_current_user_id(), 'wcal_pro_first_notice_ignore' ) ) {
33
-
34
- $class = 'updated notice-info point-notice';
35
- $style = 'position:relative';
36
-
37
- $wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/checkout?edd_action=add_to_cart&download_id=20&utm_source=wpnotice&utm_medium=first&utm_campaign=AbandonedCartLitePlugin';
38
-
39
- $message = wp_kses_post ( __( 'Thank you for using Abandoned Cart Lite for WooCommerce! You can use the Pro version for recovering more sales with some additional features. <strong><a target="_blank" href= "'.$wcal_ac_pro_link.'">Get it now!</a></strong>', 'woocommerce-abandoned-cart' ) );
40
-
41
- $add_query_arguments = add_query_arg( 'wcal_pro_first_notice_ignore', '0' );
42
- $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
43
- printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $message, $cancel_button );
44
- }
45
-
46
- if ( get_user_meta( get_current_user_id(), 'wcal_pro_first_notice_ignore' ) && ! get_user_meta( get_current_user_id(), 'wcal_pro_second_notice_ignore' ) ) {
47
-
48
- $wcal_first_ignore_time = get_user_meta( get_current_user_id(), 'wcal_pro_first_notice_ignore_time' );
49
- $wcal_fifteen_days = strtotime( '+15 Days', $wcal_first_ignore_time[0]);
50
-
51
- if ( $wcal_current_time >= $wcal_fifteen_days ){
52
- $class = 'updated notice-info point-notice';
53
- $style = 'position:relative';
54
-
55
- $wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/checkout?edd_action=add_to_cart&download_id=20&utm_source=wpnotice&utm_medium=second&utm_campaign=AbandonedCartLitePlugin';
56
-
57
- $message = wp_kses_post ( __( 'Abandoned Cart Pro plugin allows you to recover more revenue by offering discount coupons in the abandoned cart email notifications. <strong><a target="_blank" href= "'.$wcal_ac_pro_link.'">Grab it now!</a></strong>', 'woocommerce-abandoned-cart' ) );
58
-
59
- $add_query_arguments = add_query_arg( 'wcal_pro_second_notice_ignore', '0' );
60
- $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
61
- printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $message, $cancel_button );
62
- }
63
- }
64
-
65
- if ( get_user_meta( get_current_user_id(), 'wcal_pro_first_notice_ignore' ) &&
66
- get_user_meta( get_current_user_id(), 'wcal_pro_second_notice_ignore' ) &&
67
- ! get_user_meta( get_current_user_id(), 'wcal_pro_third_notice_ignore' ) &&
68
- ! is_plugin_active( 'order-delivery-date/order_delivery_date.php' ) &&
69
- ! is_plugin_active( 'order-delivery-date-for-woocommerce/order_delivery_date.php' ) ) {
70
-
71
- $wcal_second_ignore_time = get_user_meta( get_current_user_id(), 'wcal_pro_second_notice_ignore_time' );
72
- $wcal_seven_days = strtotime( '+7 Days', $wcal_second_ignore_time[0] );
73
-
74
- if ( $wcal_current_time >= $wcal_seven_days ){
75
- $class = 'updated notice-info point-notice';
76
- $style = 'position:relative';
77
-
78
- $wcal_ordd_lite_link = admin_url( '/plugin-install.php?s=order+delivery+date+tyche+softwares&tab=search&type=term' );
79
-
80
- $message = wp_kses_post ( __( 'Reduce cart abandonment rate by 57% with our FREE Order Delivery Date plugin. Also increase customer satisfaction with this simple plugin. <strong><a target="_blank" href= "'.$wcal_ordd_lite_link.'">Install Now</a></strong>.', 'woocommerce-abandoned-cart' ) );
81
- $add_query_arguments = add_query_arg( 'wcal_pro_third_notice_ignore', '0' );
82
- $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
83
- printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $message, $cancel_button );
84
- }
85
- }
86
-
87
- if ( get_user_meta( get_current_user_id(), 'wcal_pro_first_notice_ignore' ) &&
88
- get_user_meta( get_current_user_id(), 'wcal_pro_second_notice_ignore' ) &&
89
- ! get_user_meta( get_current_user_id(), 'wcal_pro_fourth_notice_ignore' ) &&
90
- ( is_plugin_active( 'order-delivery-date/order_delivery_date.php' ) ||
91
- is_plugin_active( 'order-delivery-date-for-woocommerce/order_delivery_date.php' ) ) ) {
92
-
93
- $wcal_third_ignore_time = get_user_meta( get_current_user_id(), 'wcal_pro_second_notice_ignore_time' );
94
- $wcal_seven_days = strtotime( '+15 Days', $wcal_third_ignore_time[0] );
95
-
96
- if ( $wcal_current_time >= $wcal_seven_days ){
97
- $class = 'updated notice-info point-notice';
98
- $style = 'position:relative';
99
-
100
- $wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/checkout?edd_action=add_to_cart&download_id=20&utm_source=wpnotice&utm_medium=fourth&utm_campaign=AbandonedCartLitePlugin';
101
-
102
- $wcal_pro_diff = 'https://www.tychesoftwares.com/differences-between-pro-and-lite-versions-of-abandoned-cart-for-woocommerce-plugin/';
103
-
104
- $message = wp_kses_post ( __( 'Using Abandoned Cart Pro plugin, you can add more merge tags, one-click Cart & Checkout page button, send customised abandoned cart reminder email to specific customers & <strong><a target="_blank" href= "'.$wcal_pro_diff.'">much more</a></strong>. <br>Grab 20% discount on the purchase using ACPRO20 discount code and save $24. Coupon is limited to first 20 customers only. <strong><a target="_blank" href= "'.$wcal_ac_pro_link.'">Purchase now</a></strong>.', 'woocommerce-abandoned-cart' ) );
105
-
106
- $add_query_arguments = add_query_arg( 'wcal_pro_fourth_notice_ignore', '0' );
107
-
108
- $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important ;"></a>';
109
- printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $message, $cancel_button );
110
- }
111
-
112
- }else if ( get_user_meta( get_current_user_id(), 'wcal_pro_first_notice_ignore' ) &&
113
- get_user_meta( get_current_user_id(), 'wcal_pro_second_notice_ignore' ) &&
114
- get_user_meta( get_current_user_id(), 'wcal_pro_third_notice_ignore' ) &&
115
- ! get_user_meta( get_current_user_id(), 'wcal_pro_fourth_notice_ignore' ) &&
116
- ( ! is_plugin_active( 'order-delivery-date/order_delivery_date.php' ) ||
117
- ! is_plugin_active( 'order-delivery-date-for-woocommerce/order_delivery_date.php' ) ) ) {
118
-
119
- $wcal_third_ignore_time = get_user_meta( get_current_user_id(), 'wcal_pro_third_notice_ignore_time' );
120
- $wcal_seven_days = strtotime( '+7 Days', $wcal_third_ignore_time[0] );
121
-
122
-
123
- if ( $wcal_current_time >= $wcal_seven_days ) {
124
- $class = 'updated notice-info point-notice';
125
- $style = 'position:relative';
126
-
127
- $wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/checkout?edd_action=add_to_cart&download_id=20&utm_source=wpnotice&utm_medium=fourth&utm_campaign=AbandonedCartLitePlugin';
128
-
129
- $wcal_pro_diff = 'https://www.tychesoftwares.com/differences-between-pro-and-lite-versions-of-abandoned-cart-for-woocommerce-plugin/';
130
-
131
- $message = wp_kses_post ( __( 'Using Abandoned Cart Pro plugin, you can add more merge tags, one-click Cart & Checkout page button, send customised abandoned cart reminder email to specific customers & <strong><a target="_blank" href= "'.$wcal_pro_diff.'">much more</a></strong>. <br>Grab 20% discount on the purchase using ABPRO20 discount code and save $24. Coupon is limited to first 20 customers only. <strong><a target="_blank" href= "'.$wcal_ac_pro_link.'">Purchase now</a></strong>.', 'woocommerce-abandoned-cart' ) );
132
-
133
- $add_query_arguments = add_query_arg( 'wcal_pro_fourth_notice_ignore', '0' );
134
-
135
- $cancel_button = '<a href="'.$add_query_arguments.'" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important ;"></a>';
136
- printf( '<div class="%1$s" style="%2$s"><p>%3$s %4$s</p></div>', $class, $style, $message, $cancel_button );
137
- }
138
- }
139
- }
140
- }
141
-
142
- /**
143
- * When admin ignores the notice it will handle the functionality
144
- * @since 4.3
145
- */
146
- public static function wcal_pro_notice_ignore() {
147
-
148
- // If user clicks to ignore the notice, add that to their user meta
149
- if ( isset( $_GET['wcal_pro_first_notice_ignore'] ) && '0' === $_GET['wcal_pro_first_notice_ignore'] ) {
150
- add_user_meta( get_current_user_id(), 'wcal_pro_first_notice_ignore', 'true', true );
151
- add_user_meta( get_current_user_id(), 'wcal_pro_first_notice_ignore_time', current_time( 'timestamp' ), true );
152
- wp_safe_redirect( remove_query_arg( 'wcal_pro_first_notice_ignore' ) );
153
-
154
- }
155
-
156
- if ( isset( $_GET['wcal_pro_second_notice_ignore'] ) && '0' === $_GET['wcal_pro_second_notice_ignore'] ) {
157
- add_user_meta( get_current_user_id(), 'wcal_pro_second_notice_ignore', 'true', true );
158
- add_user_meta( get_current_user_id(), 'wcal_pro_second_notice_ignore_time', current_time( 'timestamp' ), true );
159
- wp_safe_redirect( remove_query_arg( 'wcal_pro_second_notice_ignore' ) );
160
- }
161
-
162
- if ( isset( $_GET['wcal_pro_third_notice_ignore'] ) && '0' === $_GET['wcal_pro_third_notice_ignore'] ) {
163
- add_user_meta( get_current_user_id(), 'wcal_pro_third_notice_ignore', 'true', true );
164
- add_user_meta( get_current_user_id(), 'wcal_pro_third_notice_ignore_time', current_time( 'timestamp' ), true );
165
- wp_safe_redirect( remove_query_arg( 'wcal_pro_third_notice_ignore' ) );
166
- }
167
-
168
- if ( isset( $_GET['wcal_pro_fourth_notice_ignore'] ) && '0' === $_GET['wcal_pro_fourth_notice_ignore'] ) {
169
- add_user_meta( get_current_user_id(), 'wcal_pro_fourth_notice_ignore', 'true', true );
170
- add_user_meta( get_current_user_id(), 'wcal_pro_fourth_notice_ignore_time', current_time( 'timestamp' ), true );
171
- wp_safe_redirect( remove_query_arg( 'wcal_pro_fourth_notice_ignore' ) );
172
- }
173
- }
174
-
175
  /**
176
  * Show a DB Update Notice when upgrading from 4.7 to latest version
177
  *
13
 
14
  class Wcal_Admin_Notice {
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  /**
17
  * Show a DB Update Notice when upgrading from 4.7 to latest version
18
  *
woocommerce-abandoned-cart/includes/wcal_all_component.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * It will Add all the Boilerplate component when we activate the plugin.
4
+ * @author Tyche Softwares
5
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Component
6
+ *
7
+ */
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit; // Exit if accessed directly.
10
+ }
11
+ if ( ! class_exists( 'Wcal_All_Component' ) ) {
12
+ /**
13
+ * It will Add all the Boilerplate component when we activate the plugin.
14
+ *
15
+ */
16
+ class Wcal_All_Component {
17
+
18
+ /**
19
+ * It will Add all the Boilerplate component when we activate the plugin.
20
+ */
21
+ public function __construct() {
22
+
23
+ $is_admin = is_admin();
24
+
25
+ if ( true === $is_admin ) {
26
+
27
+ require_once( "component/WooCommerce-Check/ts-woo-active.php" );
28
+
29
+ require_once( "component/tracking data/ts-tracking.php" );
30
+ require_once( "component/deactivate-survey-popup/class-ts-deactivation.php" );
31
+
32
+ require_once( "component/welcome-page/ts-welcome.php" );
33
+ require_once( "component/faq_support/ts-faq-support.php" );
34
+ require_once( "component/pro-notices-in-lite/ts-pro-notices.php" );
35
+
36
+ $wcal_plugin_name = 'Abandoned Cart Lite for WooCommerce';
37
+ $wcal_locale = 'woocommerce-abandoned-cart';
38
+ $wcal_file_name = 'woocommerce-abandoned-cart/woocommerce-ac.php';
39
+ $wcal_plugin_prefix = 'wcal';
40
+ $wcal_lite_plugin_prefix = 'wcal';
41
+ $wcal_plugin_folder_name = 'woocommerce-abandoned-cart/';
42
+ $wcal_plugin_dir_name = dirname ( untrailingslashit( plugin_dir_path ( __FILE__ ) ) ) . '/woocommerce-ac.php' ;
43
+ $wcal_plugin_url = dirname ( untrailingslashit( plugins_url( '/', __FILE__ ) ) );
44
+
45
+ $wcal_get_previous_version = get_option( 'wcal_previous_version' );
46
+
47
+ $wcal_blog_post_link = 'https://www.tychesoftwares.com/abandoned-cart-lite-usage-tracking/';
48
+
49
+ $wcal_plugins_page = 'admin.php?page=woocommerce_ac_page';
50
+ $wcal_plugin_slug = 'woocommerce_ac_page';
51
+ $wcal_pro_file_name = 'woocommerce-abandon-cart-pro/woocommerce-ac.php';
52
+
53
+ $wcal_settings_page = 'admin.php?page=woocommerce_ac_page&action=emailsettings';
54
+ $wcal_setting_add_on = 'woocommerce_ac_page';
55
+ $wcal_setting_section = 'ac_lite_general_settings_section';
56
+ $wcal_register_setting = 'woocommerce_ac_settings';
57
+
58
+ new TS_Woo_Active ( $wcal_plugin_name, $wcal_file_name, $wcal_locale );
59
+
60
+ new TS_tracking ( $wcal_plugin_prefix, $wcal_plugin_name, $wcal_blog_post_link, $wcal_locale, $wcal_plugin_url, $wcal_settings_page, $wcal_setting_add_on, $wcal_setting_section, $wcal_register_setting );
61
+
62
+ new TS_Tracker ( $wcal_plugin_prefix, $wcal_plugin_name );
63
+
64
+ $wcal_deativate = new TS_deactivate;
65
+ $wcal_deativate->init ( $wcal_file_name, $wcal_plugin_name );
66
+
67
+ new TS_Welcome ( $wcal_plugin_name, $wcal_plugin_prefix, $wcal_locale, $wcal_plugin_folder_name, $wcal_plugin_dir_name, $wcal_get_previous_version );
68
+
69
+ $ts_pro_faq = self::wcal_get_faq ();
70
+ new TS_Faq_Support( $wcal_plugin_name, $wcal_plugin_prefix, $wcal_plugins_page, $wcal_locale, $wcal_plugin_folder_name, $wcal_plugin_slug, $ts_pro_faq );
71
+
72
+ $ts_pro_notices = self::wcal_get_notice_text ();
73
+ new ts_pro_notices( $wcal_plugin_name, $wcal_lite_plugin_prefix, $wcal_plugin_prefix, $ts_pro_notices, $wcal_file_name, $wcal_pro_file_name );
74
+
75
+ }
76
+ }
77
+
78
+ /**
79
+ * It will Display the notices in the admin dashboard for the pro vesion of the plugin.
80
+ * @return array $ts_pro_notices All text of the notices
81
+ */
82
+ public static function wcal_get_notice_text () {
83
+ $ts_pro_notices = array();
84
+
85
+ $wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/checkout?edd_action=add_to_cart&download_id=20&utm_source=wpnotice&utm_medium=first&utm_campaign=AbandonedCartLitePlugin';
86
+ $message_first = wp_kses_post ( __( 'Thank you for using Abandoned Cart Lite for WooCommerce! You can use the Pro version for recovering more sales with some additional features. <strong><a target="_blank" href= "'.$wcal_ac_pro_link.'">Get it now!</a></strong>', 'woocommerce-abandoned-cart' ) );
87
+
88
+ $wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/checkout?edd_action=add_to_cart&download_id=20&utm_source=wpnotice&utm_medium=second&utm_campaign=AbandonedCartLitePlugin';
89
+ $message_two = wp_kses_post ( __( 'Get an extra benefit of analysis of your Abandoned Cart data with some statistical view present on Dashboard. <strong><a target="_blank" href= "'.$wcal_ac_pro_link.'">Grab it now!</a></strong>', 'woocommerce-abandoned-cart' ) );
90
+
91
+ $wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/checkout?edd_action=add_to_cart&download_id=20&utm_source=wpnotice&utm_medium=third&utm_campaign=AbandonedCartLitePlugin';
92
+ $message_three = wp_kses_post ( __( 'Abandoned Cart Pro plugin allows you to recover more revenue by offering discount coupons in the abandoned cart email notifications. <strong><a target="_blank" href= "'.$wcal_ac_pro_link.'">Grab it now!</a></strong>.', 'woocommerce-abandoned-cart' ) );
93
+
94
+ $wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/checkout?edd_action=add_to_cart&download_id=20&utm_source=wpnotice&utm_medium=fourth&utm_campaign=AbandonedCartLitePlugin';
95
+ $message_four = wp_kses_post ( __( 'Capture guest customer emails while adding a product to cart with our Add to cart modal pop-up feature present in Abandoned Cart Pro for WooCommerce. <strong><a target="_blank" href= "'.$wcal_ac_pro_link.'">Purchase now</a></strong>.', 'woocommerce-abandoned-cart' ) );
96
+
97
+ $wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/checkout?edd_action=add_to_cart&download_id=20&utm_source=wpnotice&utm_medium=fifth&utm_campaign=AbandonedCartLitePlugin';
98
+ $wcal_pro_diff = 'https://www.tychesoftwares.com/differences-between-pro-and-lite-versions-of-abandoned-cart-for-woocommerce-plugin/';
99
+ $message_five = wp_kses_post ( __( 'Using Abandoned Cart Pro plugin, you can add more merge tags, one-click Cart & Checkout page button, send customised abandoned cart reminder email to specific customers & <strong><a target="_blank" href= "'.$wcal_pro_diff.'">much more</a></strong>. <br>Grab 20% discount on the purchase using ACPRO20 discount code and save $24. Coupon is limited to first 20 customers only. <strong><a target="_blank" href= "'.$wcal_ac_pro_link.'">Purchase now</a></strong>.', 'woocommerce-abandoned-cart' ) );
100
+
101
+ $_link = 'https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/checkout?edd_action=add_to_cart&download_id=16&utm_source=wpnotice&utm_medium=sixth&utm_campaign=AbandonedCartLitePlugin';
102
+ $message_six = wp_kses_post ( __( 'Reduce cart abandonment rate by 57% with our Order Delivery Date Pro WooCommerce plugin. You can Create Delivery Settings by Shipping Zones & Shipping Classes. <br>Use discount code "ORDPRO20" and grab 20% discount on the purchase of the plugin. The discount code is valid only for the first 20 customers. <strong><a target="_blank" href= "'.$_link.'">Purchase now</a></strong>', 'woocommerce-abandoned-cart' ) );
103
+
104
+ $_link = 'https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/checkout?edd_action=add_to_cart&download_id=16&utm_source=wpnotice&utm_medium=seventh&utm_campaign=AbandonedCartLitePlugin';
105
+ $message_seven = wp_kses_post ( __( 'Allow your customers to select the Delivery Date on Single Product Page using our Product Delivery Date pro for WooCommerce Plugin. <br>
106
+ <strong><a target="_blank" href= "'.$_link.'">Shop now</a></strong> & be one of the 20 customers to get 20% discount on the plugin price. Use the code "PRDPRO20". Hurry!!', 'woocommerce-abandoned-cart' ) );
107
+
108
+ $_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-booking-plugin/checkout?edd_action=add_to_cart&download_id=22&utm_source=wpnotice&utm_medium=eight&utm_campaign=AbandonedCartLitePlugin';
109
+ $message_eight = wp_kses_post ( __( ' Allow your customers to book an appointment or rent an apartment with our Booking and Appointment for WooCommerce plugin. You can also sell your product as a resource or integrate with a few Vendor plugins. <br>Shop now & Save 20% on the plugin with the code "BKAP20". Only for first 20 customers. <strong><a target="_blank" href= "'.$_link.'">Have it now!</a></strong>', 'woocommerce-abandoned-cart' ) );
110
+
111
+ $_link = 'https://www.tychesoftwares.com/store/premium-plugins/deposits-for-woocommerce/checkout?edd_action=add_to_cart&download_id=286371&utm_source=wpnotice&utm_medium=eight&utm_campaign=AbandonedCartLitePlugin';
112
+ $message_nine = wp_kses_post ( __( ' Allow your customers to pay deposits on products using our Deposits for WooCommerce plguin. <br>
113
+ <strong><a target="_blank" href= "'.$_link.'">Purchase now</a></strong> & Grab 20% discount with the code "DFWP20". The discount code is valid only for the first 20 customers.', 'woocommerce-abandoned-cart' ) );
114
+
115
+ $ts_pro_notices = array (
116
+ 1 => $message_first,
117
+ 2 => $message_two,
118
+ 3 => $message_three,
119
+ 4 => $message_four,
120
+ 5 => $message_five,
121
+ 6 => $message_six,
122
+ 7 => $message_seven,
123
+ 8 => $message_eight,
124
+ 9 => $message_nine,
125
+ ) ;
126
+
127
+ return $ts_pro_notices;
128
+ }
129
+
130
+ /**
131
+ * It will contain all the FAQ which need to be display on the FAQ page.
132
+ * @return array $ts_faq All questions and answers.
133
+ *
134
+ */
135
+ public static function wcal_get_faq () {
136
+
137
+ $ts_faq = array ();
138
+
139
+ $ts_faq = array(
140
+ 1 => array (
141
+ 'question' => 'Why abandoned cart reminder emails are not being sent?',
142
+ 'answer' => 'Please ensure you have at least one Email template "Active". As only active email templates are sent to recover the abandoned carts.
143
+ <br/><br/>
144
+ For sending the abandoned cart notification emails automatically, we use WP-Cron. If you have Email templates activated and still notification are not sent, then you can debug the issue by following this <a href = "https://www.tychesoftwares.com/docs/docs/abandoned-cart-pro-for-woocommerce/wp_alternate_cron/?utm_source=userwebsite&utm_medium=link&utm_campaign=AbandonedCartProFAQTab" target="_blank" >post</a>.'
145
+ ),
146
+ 2 => array (
147
+ 'question' => 'How is the email address of the customers captured?',
148
+ 'answer' => 'Our plugin captures visitor emails in real-time as they are typing it in to the email address field on the checkout page, so you don\'t need to worry about them changing their mind at the last second.
149
+ <br/><br/>
150
+ When logged-in user add the product to the cart we capture the email address from the user’s profile.'
151
+ ),
152
+ 3 => array (
153
+ 'question' => 'I want to know if it is possible to exclude tax from product price for abandoned order.',
154
+ 'answer' => 'Currently it is not possible to exclude tax from the product price from the abandoned order view if tax is applicable for the product.'
155
+ ),
156
+ 4 => array (
157
+ 'question' => 'Is it possible to delete thousands of or all abandoned cart records at a once?',
158
+ 'answer' => 'No, it is not possible to delete thousands of abandoned cart records in bulk. Our plugin does have the Bulk action functionality. But you can delete upto 30 Abandoned Carts in bulk. You can run a SQL query in the Database to delete those carts. For detailed steps please contact us via Support.'
159
+ ),
160
+ 5 => array (
161
+ 'question' => 'Is there any way to not capture the visitors carts?',
162
+ 'answer' => 'You can uncheck the “Start tracking from Cart Page” setting under the General Settings menu of the Settings tab.'
163
+ ),
164
+ 6 => array (
165
+ 'question' => 'How can I know that abandoned cart reminders are being sent to customers?',
166
+ 'answer' => 'It is not possible in the Abandoned Cart LITE plugin to check the records of the Abandoned Cart Reminder email whether email notifications are being sent or not. However you can upgrade to PRO version of our plugin to enable this feature.'
167
+ ),
168
+ 7 => array (
169
+ 'question' => 'Is there an alternate way to send the abandon cart emails automatically at regular intervals? As the WP-Cron is not running on my site.',
170
+ 'answer' => 'Yes, you can setup a manual cron in your server’s administration panel.
171
+ <br/><br/>
172
+ For example, if you are using cPanel, it has a section Named as "Cron Jobs" which allows you to create the cron job.
173
+ <br/><br/>
174
+ /usr/bin/wget -q -c {your_site_path}/wp-content/plugins/woocommerce-abandoned-cart/cron/wcal_send_email.php
175
+ <br/><br/>
176
+ You can refer to this document for creating a <a href="https://documentation.cpanel.net/display/68Docs/Cron+Jobs">cron job</a> in cPanel.'
177
+ ),
178
+ 8 => array (
179
+ 'question' => 'Does the plugin consider the cart as abandoned for Pending and Failed order status?',
180
+ 'answer' => 'Yes, our plugin considers such carts (Pending Payment and Failed orders) as abandoned. It will send the abandoned cart reminder email to the customers if they fail to proceed with the payment after Cart abandoned cut off time reached.'
181
+ ),
182
+ 9 => array (
183
+ 'question' => 'How can we translate the strings of {{products.cart}} merge tag in the email?',
184
+ 'answer' => 'To translate the strings, you need to generate ".po" and ".mo" files in your respective language. These files then need to be added to the following path: "woocommerce-abandoned-cart/i18n/languages"'
185
+ ),
186
+ 10 => array (
187
+ 'question' => 'There was a problem creating an email template on Multisite.',
188
+ 'answer' => 'On Multisite, if you have activated the plugin from Network site then please deactivate it and activate the Abandoned Cart Lite plugin from an Individual site. So, one default email template will be created on the activation of the plugin and you can create new email template.'
189
+ )
190
+ );
191
+
192
+ return $ts_faq;
193
+ }
194
+ }
195
+ $Wcal_All_Component = new Wcal_All_Component();
196
+ }
woocommerce-abandoned-cart/includes/wcal_class-guest.php CHANGED
@@ -239,9 +239,21 @@ if ( ! class_exists( 'woocommerce_guest_ac' ) ) {
239
  $abandoned_cart_id = $wpdb->insert_id;
240
  $_SESSION['abandoned_cart_id_lite'] = $abandoned_cart_id;
241
 
242
- $insert_persistent_cart = "INSERT INTO `".$wpdb->prefix."usermeta`( user_id, meta_key, meta_value )
243
- VALUES ( '".$user_id."', '_woocommerce_persistent_cart', '".$cart_info."' )";
244
- $wpdb->query( $insert_persistent_cart );
 
 
 
 
 
 
 
 
 
 
 
 
245
  } else {
246
  $query_update = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` SET user_id = '" . $user_id . "', abandoned_cart_info = '" . $cart_info . "', abandoned_cart_time = '" . $current_time . "' WHERE session_id ='" . $get_cookie[0] . "' AND cart_ignored='0' ";
247
  $wpdb->query( $query_update );
@@ -256,7 +268,19 @@ if ( ! class_exists( 'woocommerce_guest_ac' ) ) {
256
 
257
  $insert_persistent_cart = "INSERT INTO `".$wpdb->prefix."usermeta`( user_id, meta_key, meta_value )
258
  VALUES ( '".$user_id."', '_woocommerce_persistent_cart', '".$cart_info."' )";
259
- $wpdb->query( $insert_persistent_cart );
 
 
 
 
 
 
 
 
 
 
 
 
260
  }
261
  }
262
  }
239
  $abandoned_cart_id = $wpdb->insert_id;
240
  $_SESSION['abandoned_cart_id_lite'] = $abandoned_cart_id;
241
 
242
+ // $insert_persistent_cart = "INSERT INTO `".$wpdb->prefix."usermeta`( user_id, meta_key, meta_value )
243
+ // VALUES ( '".$user_id."', '_woocommerce_persistent_cart', '".$cart_info."' )";
244
+ // $wpdb->query( $insert_persistent_cart );
245
+ if( is_multisite() ) {
246
+ // get main site's table prefix
247
+ $main_prefix = $wpdb->get_blog_prefix(1);
248
+ $insert_persistent_cart = "INSERT INTO `" . $wpdb->main_prefix . "usermeta`( user_id, meta_key, meta_value )
249
+ VALUES ( '".$user_id."', '_woocommerce_persistent_cart', '".$cart_info."' )";
250
+ $wpdb->query( $insert_persistent_cart );
251
+
252
+ } else {
253
+ $insert_persistent_cart = "INSERT INTO `" . $wpdb->prefix . "usermeta`( user_id, meta_key, meta_value )
254
+ VALUES ( '".$user_id."', '_woocommerce_persistent_cart', '".$cart_info."' )";
255
+ $wpdb->query( $insert_persistent_cart );
256
+ }
257
  } else {
258
  $query_update = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` SET user_id = '" . $user_id . "', abandoned_cart_info = '" . $cart_info . "', abandoned_cart_time = '" . $current_time . "' WHERE session_id ='" . $get_cookie[0] . "' AND cart_ignored='0' ";
259
  $wpdb->query( $query_update );
268
 
269
  $insert_persistent_cart = "INSERT INTO `".$wpdb->prefix."usermeta`( user_id, meta_key, meta_value )
270
  VALUES ( '".$user_id."', '_woocommerce_persistent_cart', '".$cart_info."' )";
271
+ $wpdb->query( $insert_persistent_cart );
272
+ if( is_multisite() ) {
273
+ // get main site's table prefix
274
+ $main_prefix = $wpdb->get_blog_prefix(1);
275
+ $insert_persistent_cart = "INSERT INTO `" . $wpdb->main_prefix . "usermeta`( user_id, meta_key, meta_value )
276
+ VALUES ( '".$user_id."', '_woocommerce_persistent_cart', '".$cart_info."' )";
277
+ $wpdb->query( $insert_persistent_cart );
278
+
279
+ } else {
280
+ $insert_persistent_cart = "INSERT INTO `" . $wpdb->prefix . "usermeta`( user_id, meta_key, meta_value )
281
+ VALUES ( '".$user_id."', '_woocommerce_persistent_cart', '".$cart_info."' )";
282
+ $wpdb->query( $insert_persistent_cart );
283
+ }
284
  }
285
  }
286
  }
woocommerce-abandoned-cart/includes/wcal_data_tracking_message.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This class will add messages as needed informing users of data being tracked.
4
+ * @author Tyche Softwares
5
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Tracking
6
+ * @since 4.9
7
+ */
8
+ if (!defined('ABSPATH')) {
9
+ exit; // Exit if accessed directly.
10
+ }
11
+ if ( !class_exists('Wcal_Tracking_msg' ) ) {
12
+
13
+ /**
14
+ * It will add messages as needed informing users of data being tracked.
15
+ * @since 4.9
16
+ */
17
+ class Wcal_Tracking_msg {
18
+
19
+ public function __construct() {
20
+ // Checkout page notice for guest users
21
+ add_filter( 'woocommerce_checkout_fields' , array( &$this, 'wcal_add_gdpr_msg' ), 10, 1 );
22
+ // Product page notice for logged in users
23
+ add_action( 'woocommerce_after_add_to_cart_button', array( &$this, 'wcal_add_logged_msg' ), 10 );
24
+ // Shop Page notice
25
+ add_action( 'woocommerce_before_shop_loop', array( &$this, 'wcal_add_logged_msg' ), 10 );
26
+ //add_action( 'woocommerce_after_shop_loop_item', array( &$this, 'wcal_add_logged_msg' ), 10 );
27
+ }
28
+
29
+ /**
30
+ * Adds a message to be displayed above Billing_email
31
+ * field on Checkout page for guest users.
32
+ *
33
+ * @param array $fields - List of fields on Checkout page
34
+ * @return array $fields - List of fields on Checkout page
35
+ *
36
+ * @hook woocommerce_checkout_fields
37
+ * @since 4.9
38
+ */
39
+ static function wcal_add_gdpr_msg( $fields ) {
40
+
41
+ if( ! is_user_logged_in() ) {
42
+ // check if any message is present in the settings
43
+ $guest_msg = get_option( 'wcal_guest_cart_capture_msg' );
44
+
45
+ if( isset( $guest_msg ) && '' != $guest_msg ) {
46
+ $existing_label = $fields[ 'billing' ][ 'billing_email' ][ 'label' ];
47
+ $fields[ 'billing' ][ 'billing_email' ][ 'label' ] = $existing_label . "<br><small>$guest_msg</small>";
48
+ }
49
+ }
50
+ return $fields;
51
+ }
52
+
53
+ /**
54
+ * Adds a message to be displayed for logged in users
55
+ * Called on Shop & Product page
56
+ *
57
+ * @hook woocommerce_after_add_to_cart_button
58
+ * woocommerce_before_shop_loop
59
+ * @since 4.9
60
+ */
61
+ static function wcal_add_logged_msg() {
62
+ if( is_user_logged_in() ) {
63
+
64
+ $registered_msg = get_option( 'wcal_logged_cart_capture_msg' );
65
+
66
+ if( isset( $registered_msg ) && '' != $registered_msg ) {
67
+ echo "<p><small>" . __( $registered_msg, 'woocommerce-abandoned-cart' ) . "</small></p>";
68
+ }
69
+ }
70
+ }
71
+
72
+ } // end of class
73
+ $Wcal_Tracking_msg = new Wcal_Tracking_msg();
74
+ } // end IF
woocommerce-abandoned-cart/includes/wcal_ts_tracking.php DELETED
@@ -1,85 +0,0 @@
1
- <?php
2
- /**
3
- * Abandoned Cart Lite for WooCommerce
4
- *
5
- * It will manage the tracking of the plugin data.
6
- *
7
- * @author Tyche Softwares
8
- * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Tracking-Data
9
- */
10
-
11
- include_once( 'classes/class-wcal-ts-tracker.php' );
12
-
13
- /**
14
- * It will have all the data for tracking the data.
15
- * @since 3.9
16
- */
17
- class Wcal_TS_Tracking {
18
- /**
19
- * It will add all the necessary action for tracking the data.
20
- * @since 3.9
21
- */
22
- public function __construct() {
23
- //Tracking Data
24
- add_action( 'admin_notices', array( &$this, 'wcal_track_usage_data' ), 10 );
25
- add_action( 'admin_footer', array( &$this, 'wcal_admin_notices_scripts' ) );
26
- add_action( 'wp_ajax_wcal_admin_notices', array( &$this, 'wcal_admin_notices' ) );
27
- }
28
-
29
- /**
30
- * It will add the js for dismissible notice.
31
- * @since 3.9
32
- */
33
- public static function wcal_admin_notices_scripts() {
34
- wp_enqueue_script( 'wcal_admin_dismissal_notice', plugins_url() . '/woocommerce-abandoned-cart/assets/js/wcal_ts_dismiss_notice.js' );
35
- }
36
-
37
- /**
38
- * It will the admin notice.
39
- * @since 3.9
40
- */
41
- public static function wcal_admin_notices() {
42
- Class_Wcal_Ts_Tracker::wcal_ts_send_tracking_data( false );
43
- update_option( 'wcal_allow_tracking', 'dismissed' );
44
- die();
45
- }
46
-
47
- /**
48
- * It will check the selected admin action it will be either allow or not allow.
49
- * @since 3.9
50
- */
51
- private function wcal_ts_tracking_actions() {
52
-
53
- if ( isset( $_GET[ 'wcal_tracker_optin' ] ) && isset( $_GET[ 'wcal_tracker_nonce' ] ) && wp_verify_nonce( $_GET[ 'wcal_tracker_nonce' ], 'wcal_tracker_optin' ) ) {
54
- update_option( 'wcal_allow_tracking', 'yes' );
55
- Class_Wcal_Ts_Tracker::wcal_ts_send_tracking_data( true );
56
- header( 'Location: ' . $_SERVER[ 'HTTP_REFERER' ] );
57
- } elseif ( isset( $_GET[ 'wcal_tracker_optout' ] ) && isset( $_GET[ 'wcal_tracker_nonce' ] ) && wp_verify_nonce( $_GET[ 'wcal_tracker_nonce' ], 'wcal_tracker_optout' ) ) {
58
- update_option( 'wcal_allow_tracking', 'no' );
59
- Class_Wcal_Ts_Tracker::wcal_ts_send_tracking_data( false );
60
- header( 'Location: ' . $_SERVER[ 'HTTP_REFERER' ] );
61
- }
62
- }
63
-
64
- /**
65
- * It will add the notice on the admin side.
66
- * @since 3.9
67
- */
68
- function wcal_track_usage_data() {
69
- $wcal_admin_url = get_admin_url();
70
- echo '<input type="hidden" id="admin_url" value="' . $wcal_admin_url . '"/>';
71
- $this->wcal_ts_tracking_actions();
72
- if ( 'unknown' === get_option( 'wcal_allow_tracking', 'unknown' ) ) : ?>
73
- <div class="wcal-message wcal-tracker notice notice-info is-dismissible" style="position: relative;">
74
- <div style="position: absolute;"><img class="site-logo" src="<?php echo plugins_url(); ?>/woocommerce-abandoned-cart/assets/images/site-logo-new.jpg"></div>
75
- <p style="margin: 10px 0 10px 130px; font-size: medium;">
76
- <?php print( __( 'Want to help make Abandoned Cart even more awesome? Allow Abandoned Cart to collect non-sensitive diagnostic data and usage information and get 20% off on your next purchase. <a href="https://www.tychesoftwares.com/abandoned-cart-lite-usage-tracking/" target="_blank">Find out more</a>. <br><br>', 'woocommerce-abandoned-cart' ) ); ?></p>
77
- <p class="submit">
78
- <a class="button-primary button button-large" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wcal_tracker_optin', 'true' ), 'wcal_tracker_optin', 'wcal_tracker_nonce' ) ); ?>"><?php esc_html_e( 'Allow', 'woocommerce-abandoned-cart' ); ?></a>
79
- <a class="button-secondary button button-large skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wcal_tracker_optout', 'true' ), 'wcal_tracker_optout', 'wcal_tracker_nonce' ) ); ?>"><?php esc_html_e( 'No thanks', 'woocommerce-abandoned-cart' ); ?></a>
80
- </p>
81
- </div>
82
- <?php endif;
83
- }
84
- }
85
- $TS_tracking = new Wcal_TS_Tracking();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
woocommerce-abandoned-cart/includes/welcome.php DELETED
@@ -1,313 +0,0 @@
1
- <?php
2
-
3
- // Exit if accessed directly.
4
- if ( ! defined( 'ABSPATH' ) ) {
5
- exit;
6
- }
7
-
8
- /**
9
- * Abandoned Cart Lite for WooCommerce
10
- *
11
- * Displays on plugin activation.
12
- *
13
- * @author Tyche Softwares
14
- * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Welcome-Page
15
- */
16
-
17
- class Wcal_Welcome {
18
-
19
- /**
20
- * @var string The capability users should have to view the page
21
- */
22
- public $minimum_capability = 'manage_options';
23
-
24
- /**
25
- * It will add all the action for welcome page.
26
- * @since 4.5
27
- */
28
- public function __construct() {
29
-
30
- add_action( 'admin_menu', array( $this, 'admin_menus' ) );
31
- add_action( 'admin_head', array( $this, 'admin_head' ) );
32
-
33
- if ( !isset( $_GET[ 'page' ] ) ||
34
- ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] != 'wcal-about' ) ) {
35
- add_action( 'admin_init', array( $this, 'welcome' ) );
36
- }
37
- }
38
-
39
- /**
40
- * Register the Dashboard Page which is later hidden but this pages
41
- * is used to render the Welcome page.
42
- * @since 4.5
43
- */
44
- public function admin_menus() {
45
- $display_version = WCAL_VERSION;
46
-
47
- // Welcome Page
48
- add_dashboard_page(
49
- sprintf( esc_html__( 'Welcome to Abandoned Cart Lite %s', 'woocommerce-abandoned-cart' ), $display_version ),
50
- esc_html__( 'Welcome to Abandoned Cart Lite', 'woocommerce-abandoned-cart' ),
51
- $this->minimum_capability,
52
- 'wcal-about',
53
- array( $this, 'about_screen' )
54
- );
55
-
56
- }
57
-
58
- /**
59
- * Hide Individual Dashboard Pages.
60
- * @since 4.5
61
- */
62
- public function admin_head() {
63
- remove_submenu_page( 'index.php', 'wcal-about' );
64
- }
65
-
66
- /**
67
- * Render Welcome Screen.
68
- * @since 4.5
69
- */
70
- public function about_screen() {
71
- $display_version = WCAL_VERSION;
72
- // Badge for welcome page
73
- $badge_url = WCAL_PLUGIN_URL . 'assets/images/icon-256x256.png';
74
- ?>
75
- <style>
76
- .feature-section .feature-section-item {
77
- float:left;
78
- width:48%;
79
- }
80
- </style>
81
- <div class="wrap about-wrap">
82
-
83
- <?php $this->get_welcome_header() ?>
84
-
85
- <div style="float:left;width: 80%;">
86
- <p class="about-text" style="margin-right:20px;"><?php
87
- printf(
88
- __( "Thank you for activating or updating to the latest version of Abandoned Cart Lite! If you're a first time user, welcome! You're well on your way to start recovering your lost revenues." )
89
- );
90
- ?></p>
91
- </div>
92
- <div class="wcal-badge"><img src="<?php echo $badge_url; ?>" style="width:150px;"/></div>
93
-
94
- <p>&nbsp;</p>
95
-
96
- <div class="feature-section clearfix introduction">
97
-
98
- <h3><?php esc_html_e( "Get Started with Abandoned Cart Lite", 'woocommerce-abandoned-cart' ); ?></h3>
99
-
100
- <div class="video feature-section-item" style="float:left;padding-right:10px;">
101
- <img src="<?php echo WCAL_PLUGIN_URL . '/assets/images/abandoned-cart-lite-email-templates.png' ?>"
102
- alt="<?php esc_attr_e( 'WooCommerce Abandoned Cart Lite', 'woocommerce-abandoned-cart' ); ?>" style="width:600px;">
103
- </div>
104
-
105
- <div class="content feature-section-item last-feature">
106
- <h3><?php esc_html_e( 'Activate Email Template', 'woocommerce-abandoned-cart' ); ?></h3>
107
-
108
- <p><?php esc_html_e( 'To start sending out abandoned cart notification emails, simply activate the email template from under WooCommerce -> Abandoned Carts -> Email Templates page.', 'woocommerce-abandoned-cart' ); ?></p>
109
- <a href="admin.php?page=woocommerce_ac_page&action=emailtemplates" target="_blank" class="button-secondary">
110
- <?php esc_html_e( 'Click Here to go to Email Templates page', 'woocommerce-abandoned-cart' ); ?>
111
- <span class="dashicons dashicons-external"></span>
112
- </a>
113
- </div>
114
- </div>
115
-
116
- <!-- /.intro-section -->
117
-
118
- <div class="content">
119
-
120
- <h3><?php esc_html_e( "Know more about Abandoned Cart Pro", 'woocommerce-abandoned-cart' ); ?></h3>
121
-
122
- <p><?php _e( 'The Abandoned Cart Pro plugin gives you features where you are able to recover more sales compared to the Lite plugin. Here are some notable features the Pro version provides.' ); ?></p>
123
-
124
- <div class="feature-section clearfix introduction">
125
- <div class="video feature-section-item" style="float:left;padding-right:10px;">
126
- <img src="https://www.tychesoftwares.com/wp-content/uploads/2017/08/atc_frontend.png"
127
- alt="<?php esc_attr_e( 'WooCommerce Abandoned Cart Lite', 'woocommerce-abandoned-cart' ); ?>" style="width:500px;">
128
- </div>
129
-
130
- <div class="content feature-section-item last-feature">
131
- <h3><?php esc_html_e( 'Capture Visitor Emails on click of Add to Cart button', 'woocommerce-abandoned-cart' ); ?></h3>
132
-
133
- <p><?php esc_html_e( 'The ability to capture the email address early in the order process is very important to reduce cart abandonment by unknown users as well as to be able to recover their carts if they abandon it. This ultimately leads to increase in your store sales.', 'woocommerce-abandoned-cart' ); ?></p>
134
- <a href="https://www.tychesoftwares.com/capture-guest-user-email-address-before-checkout-page-with-woocommerce-abandoned-cart-pro/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank" class="button-secondary">
135
- <?php esc_html_e( 'Learn More', 'woocommerce-abandoned-cart' ); ?>
136
- <span class="dashicons dashicons-external"></span>
137
- </a>
138
- </div>
139
- </div>
140
-
141
- <div class="feature-section clearfix">
142
- <div class="content feature-section-item">
143
-
144
- <h3><?php esc_html_e( 'Set different cut-off times for visitors & logged-in users', 'woocommerce-abandoned-cart' ); ?></h3>
145
-
146
- <p><?php esc_html_e( 'The provision for setting two separate cut-off times for different roles is mainly because sometimes if the store admin wants the visitor carts to be captured earlier than the registered user carts, then these different settings can play an important role.', 'woocommerce-abandoned-cart' ); ?></p>
147
- <a href="https://www.tychesoftwares.com/capturing-abandoned-carts-woocommerce-abandoned-cart-pro-plugin/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank" class="button-secondary">
148
- <?php esc_html_e( 'Learn More', 'woocommerce-abandoned-cart' ); ?>
149
- <span class="dashicons dashicons-external"></span>
150
- </a>
151
- </div>
152
-
153
- <div class="content feature-section-item last-feature">
154
- <img src="<?php echo WCAL_PLUGIN_URL . 'assets/images/abandon-cart-cut-off-time.png'; ?>" alt="<?php esc_attr_e( 'WooCommerce Abandoned Cart Lite', 'woocommerce-abandoned-cart' ); ?>" style="width:450px;">
155
- </div>
156
- </div>
157
-
158
-
159
- <div class="feature-section clearfix introduction">
160
- <div class="video feature-section-item" style="float:left;padding-right:10px;">
161
- <img src="<?php echo WCAL_PLUGIN_URL . 'assets/images/email-templates-send-time.png'; ?>" alt="<?php esc_attr_e( 'WooCommerce Abandoned Cart Lite', 'woocommerce-abandoned-cart' ); ?>" style="width:450px;">
162
- </div>
163
-
164
- <div class="content feature-section-item last-feature">
165
- <h3><?php esc_html_e( 'Send abandoned cart recovery email in minutes of cart being abandoned', 'woocommerce-abandoned-cart' ); ?></h3>
166
-
167
- <p><?php esc_html_e( 'The ability to send the abandoned cart recovery email within first few minutes of cart being abandoned is a big advantage. In the Lite plugin, the earliest an email can be sent is after 1 hour. Whereas in the Pro version, the first recovery email gets sent 15 minutes after the cart is abandoned. This increases the recovery chances manifold.', 'woocommerce-abandoned-cart' ); ?></p>
168
- <a href="https://www.tychesoftwares.com/understanding-the-default-email-templates-of-abandoned-cart-pro-for-woocommerce-plugin/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank" class="button-secondary">
169
- <?php esc_html_e( 'Learn More', 'woocommerce-abandoned-cart' ); ?>
170
- <span class="dashicons dashicons-external"></span>
171
- </a>
172
- </div>
173
- </div>
174
-
175
- <div class="feature-section clearfix">
176
- <div class="content feature-section-item">
177
-
178
- <h3><?php esc_html_e( 'Full range of merge tags that allow you to personalize the abandoned cart email', 'woocommerce-abandoned-cart' ); ?></h3>
179
-
180
- <p><?php esc_html_e( 'The Lite version has only 3 merge tags available to personalize the abandoned cart recovery emails. The Pro version instead, has 20 different merge tags that can be used effectively to personalize each email that gets sent out to the customers for recovering their abandoned carts.', 'woocommerce-abandoned-cart' ); ?></p>
181
- <a href="https://www.tychesoftwares.com/understanding-the-default-email-templates-of-abandoned-cart-pro-for-woocommerce-plugin/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank" class="button-secondary">
182
- <?php esc_html_e( 'Learn More', 'woocommerce-abandoned-cart' ); ?>
183
- <span class="dashicons dashicons-external"></span>
184
- </a>
185
- </div>
186
-
187
- <div class="content feature-section-item last-feature">
188
- <img src="https://www.tychesoftwares.com/wp-content/uploads/2016/10/drop-down-of-AC.png" alt="<?php esc_attr_e( 'WooCommerce Abandoned Cart Lite', 'woocommerce-abandoned-cart' ); ?>" style="width:450px;">
189
- </div>
190
- </div>
191
-
192
- <a href="https://www.tychesoftwares.com/differences-between-pro-and-lite-versions-of-abandoned-cart-for-woocommerce-plugin/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank" class="button-secondary">
193
- <?php esc_html_e( 'View full list of differences between Lite & Pro plugin', 'woocommerce-abandoned-cart' ); ?>
194
- <span class="dashicons dashicons-external"></span>
195
- </a>
196
- </div>
197
-
198
- <div class="feature-section clearfix">
199
-
200
- <div class="content feature-section-item">
201
-
202
- <h3><?php esc_html_e( 'Getting to Know Tyche Softwares', 'woocommerce-abandoned-cart' ); ?></h3>
203
-
204
- <ul class="ul-disc">
205
- <li><a href="https://tychesoftwares.com/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank"><?php esc_html_e( 'Visit the Tyche Softwares Website', 'woocommerce-abandoned-cart' ); ?></a></li>
206
- <li><a href="https://tychesoftwares.com/premium-plugins/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank"><?php esc_html_e( 'View all Premium Plugins', 'woocommerce-abandoned-cart' ); ?></a>
207
- <ul class="ul-disc">
208
- <li><a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank">Abandoned Cart Pro Plugin for WooCommerce</a></li>
209
- <li><a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-booking-plugin/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank">Booking & Appointment Plugin for WooCommerce</a></li>
210
- <li><a href="https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank">Order Delivery Date for WooCommerce</a></li>
211
- <li><a href="https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank">Product Delivery Date for WooCommerce</a></li>
212
- <li><a href="https://www.tychesoftwares.com/store/premium-plugins/deposits-for-woocommerce/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank">Deposits for WooCommerce</a></li>
213
- </ul>
214
- </li>
215
- <li><a href="https://tychesoftwares.com/about/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank"><?php esc_html_e( 'Meet the team', 'woocommerce-abandoned-cart' ); ?></a></li>
216
- </ul>
217
-
218
- </div>
219
-
220
-
221
- <!-- <div class="content feature-section-item">
222
-
223
- <h3><?php esc_html_e( 'Current Offers', 'woocommerce-abandoned-cart' ); ?></h3>
224
-
225
- <p>Buy all our <a href="https://tychesoftwares.com/premium-plugins/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank">premium plugins</a> at 30% off till 31st December 2017</p>
226
-
227
- </div> -->
228
-
229
- </div>
230
- <!-- /.feature-section -->
231
-
232
- </div>
233
- <?php
234
-
235
- update_option( 'wcal_welcome_page_shown', 'yes' );
236
- update_option( 'wcal_welcome_page_shown_time', current_time( 'timestamp' ) );
237
- }
238
-
239
-
240
- /**
241
- * The header section for the welcome screen.
242
- *
243
- * @since 4.5
244
- */
245
- public function get_welcome_header() {
246
- // Badge for welcome page
247
- $badge_url = WCAL_PLUGIN_URL . 'assets/images/icon-256x256.png';
248
- ?>
249
- <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
250
- <?php $this->social_media_elements(); ?>
251
-
252
- <?php }
253
-
254
-
255
- /**
256
- * Social Media Like Buttons.
257
- *
258
- * Various social media elements to Tyche Softwares.
259
- * @since 4.5
260
- */
261
- public function social_media_elements() { ?>
262
-
263
- <div class="social-items-wrap">
264
-
265
- <iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Ftychesoftwares&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=220596284639969"
266
- scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;"
267
- allowTransparency="true"></iframe>
268
-
269
- <a href="https://twitter.com/tychesoftwares" class="twitter-follow-button" data-show-count="false"><?php
270
- printf(
271
- esc_html_e( 'Follow %s', 'tychesoftwares' ),
272
- '@tychesoftwares'
273
- );
274
- ?></a>
275
- <script>!function (d, s, id) {
276
- var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
277
- if (!d.getElementById(id)) {
278
- js = d.createElement(s);
279
- js.id = id;
280
- js.src = p + '://platform.twitter.com/widgets.js';
281
- fjs.parentNode.insertBefore(js, fjs);
282
- }
283
- }(document, 'script', 'twitter-wjs');
284
- </script>
285
-
286
- </div>
287
- <!--/.social-items-wrap -->
288
-
289
- <?php
290
- }
291
-
292
-
293
- /**
294
- * Sends user to the Welcome page on first activation of Abandoned Cart Lite as well as each
295
- * time Abandoned Cart Lite is upgraded to a new version
296
- * @since 4.5
297
- */
298
- public function welcome() {
299
-
300
- // Bail if activating from network, or bulk
301
- if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
302
- return;
303
- }
304
-
305
- if( !get_option( 'wcal_welcome_page_shown' ) ) {
306
- wp_safe_redirect( admin_url( 'index.php?page=wcal-about' ) );
307
- exit;
308
- }
309
- }
310
-
311
- }
312
-
313
- new Wcal_Welcome();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
woocommerce-abandoned-cart/readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: ashokrane, pinal.shah, bhavik.kiri, chetnapatel, tychesoftwares
4
  Tags: abandon cart, cart recovery, increase woocommerce conversion rate , recover woocommerce cart, increase sales with woocommerce
5
  Author URI: https://www.tychesoftwares.com/
6
  Requires at least: 1.3
7
- Tested up to: 4.9.2
8
  Stable tag: trunk
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -110,6 +110,11 @@ Abandoned Cart Plugin relies on a function called WP-Cron, and this function onl
110
 
111
  4. **[WooCommerce Print Invoice & Delivery Note](https://wordpress.org/plugins/woocommerce-delivery-notes/ "WooCommerce Print Invoice & Delivery Note")**
112
 
 
 
 
 
 
113
 
114
  == Installation ==
115
 
@@ -143,7 +148,7 @@ Method 3:
143
 
144
  = How is the email address of the customers captured? =
145
 
146
- Our plugin captures visitor emails in real-time as theyre typing it in to the email address field on the checkout page, so you dont need to worry about them changing their mind at the last second.
147
 
148
  When logged-in user add the product to the cart we capture the email address from the user's profile.
149
 
@@ -188,14 +193,23 @@ You can refer **[here](https://www.tychesoftwares.com/differences-between-pro-an
188
 
189
  == Changelog ==
190
 
 
 
 
 
 
 
 
 
 
191
  = 4.8 (20.03-2018) =
192
  * This is a minor update to the plugin which contains some bug fixes and requires Database update to include emojis in the email templates. We recommend that you take a backup of the database of your store for your piece of mind.
193
 
194
- * Bug Fixed - Fixed compatibility issues related to PHP 7.2 where error notices were being displayed on Abandoned Order List page
195
 
196
  * Bug Fixed - Fixed issue related to saving email template where changes were not getting saved despite a success message.
197
 
198
- * Additonal Changes - PHP Doc blocks added for generating documentation and readability
199
 
200
  = 4.7 (16.02-2018) =
201
  * This version has 2 bug fixes.
4
  Tags: abandon cart, cart recovery, increase woocommerce conversion rate , recover woocommerce cart, increase sales with woocommerce
5
  Author URI: https://www.tychesoftwares.com/
6
  Requires at least: 1.3
7
+ Tested up to: 4.9.5
8
  Stable tag: trunk
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
110
 
111
  4. **[WooCommerce Print Invoice & Delivery Note](https://wordpress.org/plugins/woocommerce-delivery-notes/ "WooCommerce Print Invoice & Delivery Note")**
112
 
113
+ **[Documentation](https://www.tychesoftwares.com/docs/docs/abandoned-cart-for-woocommerce-lite/?utm_source=wprepo&utm_medium=link&utm_campaign=AbandonedCartLite "Documentation")**
114
+
115
+ **[Developer Documentation](https://www.tychesoftwares.com/docs/acl-apidocs/index.html "Developer Documentation")**
116
+
117
+ **[Github Repository](https://github.com/TycheSoftwares/Woocommerce-abandon-cart-lite "Github Repository")**
118
 
119
  == Installation ==
120
 
148
 
149
  = How is the email address of the customers captured? =
150
 
151
+ Our plugin captures visitor emails in real-time as they're typing it in to the email address field on the checkout page, so you don't need to worry about them changing their mind at the last second.
152
 
153
  When logged-in user add the product to the cart we capture the email address from the user's profile.
154
 
193
 
194
  == Changelog ==
195
 
196
+ = 4.9 (24.05-2018) =
197
+ * The plugin is now GDPR compliant.
198
+
199
+ * New feature - Added two settings to show the message on the checkout page for guest users and the message to be displayed at the start of the shop page for Registered users.
200
+
201
+ * New feature - Abandoned Cart details will now be exported to the User's Personal Data from the Tools -> Export Personal Data menu and it can be erased from Tools -> Erase Personal Data.
202
+
203
+ * Bug Fixed - Some notices are fixed�of the debug.log file.
204
+
205
  = 4.8 (20.03-2018) =
206
  * This is a minor update to the plugin which contains some bug fixes and requires Database update to include emojis in the email templates. We recommend that you take a backup of the database of your store for your piece of mind.
207
 
208
+ * Bug Fixed - Fixed compatibility issues related to PHP 7.2 where error notices were being displayed on Abandoned Order List page.
209
 
210
  * Bug Fixed - Fixed issue related to saving email template where changes were not getting saved despite a success message.
211
 
212
+ * Additonal Changes - PHP Doc blocks added for generating documentation and readability.
213
 
214
  = 4.7 (16.02-2018) =
215
  * This version has 2 bug fixes.
woocommerce-abandoned-cart/woocommerce-ac.php CHANGED
@@ -5,14 +5,14 @@
5
  * Description: This plugin captures abandoned carts by logged-in users & emails them about it.
6
  * <strong><a href="http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro">Click here to get the
7
  * PRO Version.</a></strong>
8
- * Version: 4.8
9
  * Author: Tyche Softwares
10
  * Author URI: http://www.tychesoftwares.com/
11
  * Text Domain: woocommerce-abandoned-cart
12
  * Domain Path: /i18n/languages/
13
  * Requires PHP: 5.6
14
  * WC requires at least: 3.0.0
15
- * WC tested up to: 3.2.0
16
  *
17
  * @package Abandoned-Cart-Lite-for-WooCommerce
18
  */
@@ -26,15 +26,15 @@ require_once( "includes/wcal_actions.php" );
26
  require_once( "includes/classes/class-wcal-aes.php" );
27
  require_once( "includes/classes/class-wcal-aes-counter.php" );
28
  require_once( "includes/wcal-common.php" );
29
- require_once( "includes/wcal_ts_tracking.php");
30
  require_once( "includes/wcal_admin_notice.php");
 
 
 
31
 
32
  if ( is_admin() ) {
33
- require_once( 'includes/welcome.php' );
34
-
35
- define( 'WCAL_VERSION', wcal_common::wcal_get_version() );
36
-
37
- define( 'WCAL_PLUGIN_URL', wcal_common::wcal_get_plugin_url() );
38
  }
39
 
40
  // Add a new interval of 15 minutes
@@ -66,36 +66,9 @@ if ( ! wp_next_scheduled( 'woocommerce_ac_send_email_action' ) ) {
66
  wp_schedule_event( time(), '15_minutes_lite', 'woocommerce_ac_send_email_action' );
67
  }
68
 
69
- /**
70
- * It will add a cron job for sending the tarcking data.
71
- * By default it will set once in a week interval.
72
- * @hook cron_schedules
73
- * @param array $schedules
74
- * @return array $schedules
75
- * @since 3.9
76
- * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Tracking-Data
77
- */
78
- function wcal_add_tracking_cron_schedule( $schedules ) {
79
- $schedules[ 'daily_once' ] = array(
80
- 'interval' => 604800, // one week in seconds
81
- 'display' => __( 'Once in a Week', 'woocommerce-abandoned-cart' )
82
- );
83
- return $schedules;
84
- }
85
-
86
- /**
87
- * To capture the data from the client site.
88
- * @since 3.9
89
- * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Tracking-Data
90
- */
91
- if ( ! wp_next_scheduled( 'wcal_ts_tracker_send_event' ) ) {
92
- wp_schedule_event( time(), 'daily_once', 'wcal_ts_tracker_send_event' );
93
- }
94
-
95
  /**
96
  * Hook into that action that'll fire every 15 minutes
97
  */
98
-
99
  add_action( 'woocommerce_ac_send_email_action', 'wcal_send_email_cron' );
100
 
101
  /**
@@ -201,6 +174,9 @@ function woocommerce_ac_delete_lite() {
201
 
202
  delete_option( 'wcal_welcome_page_shown_time' );
203
  delete_option( 'wcal_welcome_page_shown' );
 
 
 
204
  }
205
  /**
206
  * woocommerce_abandon_cart_lite class
@@ -297,6 +273,10 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
297
  add_action ( 'admin_head', array( &$this, 'wcal_action_send_preview' ) );
298
  add_action ( 'wp_ajax_wcal_preview_email_sent', array( &$this, 'wcal_preview_email_sent' ) );
299
  add_action ( 'wp_ajax_wcal_toggle_template_status', array( &$this, 'wcal_toggle_template_status' ) );
 
 
 
 
300
  }
301
 
302
  // Send Email on order recovery
@@ -314,58 +294,45 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
314
  add_filter( 'woocommerce_payment_complete_order_status', array( &$this, 'wcal_order_complete_action' ), 10 , 2 );
315
  add_filter( 'admin_footer_text', array( $this, 'wcal_admin_footer_text' ), 1 );
316
 
317
- add_action( 'admin_notices', array( 'Wcal_Admin_Notice', 'wcal_pro_notice' ) );
318
- add_action( 'admin_init', array( 'Wcal_Admin_Notice', 'wcal_pro_notice_ignore' ) );
319
  add_action( 'admin_notices', array( 'Wcal_Admin_Notice', 'wcal_show_db_update_notice' ) );
320
-
321
- /**
322
- * @since: 4.2
323
- * Check if WC is enabled or not.
324
- */
325
- add_action( 'admin_init', array( &$this, 'wcal_wc_check_compatibility' ) );
326
  }
327
 
328
  /**
329
- * Check if WooCommerce is active or not.
330
- * @since: 4.2
331
- */
332
- public static function wcal_wc_check_ac_installed() {
333
-
334
- if ( is_plugin_active( 'woocommerce/woocommerce.php' ) && class_exists( 'WooCommerce' ) ) {
335
- return true;
336
- } else {
337
- return false;
338
- }
339
- }
340
-
341
- /**
342
- * Ensures that the Abandoned cart lite get deactivated when WooCommerce is deactivated.
343
- * @since: 4.2
344
  */
345
- public static function wcal_wc_check_compatibility() {
346
-
347
- if ( ! self::wcal_wc_check_ac_installed() ) {
348
-
349
- if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) {
350
- deactivate_plugins( plugin_basename( __FILE__ ) );
351
-
352
- add_action( 'admin_notices', array( 'woocommerce_abandon_cart_lite', 'wcal_wc_disabled_notice' ) );
353
- if ( isset( $_GET['activate'] ) ) {
354
- unset( $_GET['activate'] );
355
- }
356
- }
357
- }
358
- }
359
- /**
360
- * Display a notice in the admin Plugins page if the Abandoned cart lite is activated while WooCommerce is deactivated.
361
- * @since: 4.2
362
- */
363
- public static function wcal_wc_disabled_notice() {
364
-
365
- $class = 'notice notice-error is-dismissible';
366
- $message = __( 'Abandoned Cart Lite for WooCommerce requires WooCommerce installed and activate.', 'woocommerce-abandoned-cart' );
367
-
368
- printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
 
 
 
 
 
 
369
  }
370
 
371
  /**
@@ -563,7 +530,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
563
  * It will delete the order from history table if the order is placed before any email sent to
564
  * the user.
565
  */
566
- $wpdb->delete( $wcal_history_table_name , array( 'id' => $wcap_abandoned_cart_id ) );
567
 
568
  /* This user id is set for the guest uesrs. */
569
  if ( isset( $_SESSION['user_id'] ) && $_SESSION['user_id'] != '' ) {
@@ -742,23 +709,26 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
742
  `frequency` int(11) NOT NULL,
743
  `day_or_hour` enum('Days','Hours') COLLATE utf8mb4_unicode_ci NOT NULL,
744
  `template_name` text COLLATE utf8mb4_unicode_ci NOT NULL,
 
 
 
745
  PRIMARY KEY (`id`)
746
  ) $wcap_collate AUTO_INCREMENT=1 ";
747
 
748
  require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
749
  dbDelta( $sql );
750
 
751
- $table_name = $wpdb->prefix . "ac_email_templates_lite";
752
- $check_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'is_wc_template' ";
753
- $results = $wpdb->get_results( $check_template_table_query );
754
 
755
- if ( count( $results ) == 0 ) {
756
- $alter_template_table_query = "ALTER TABLE $table_name
757
- ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8mb4_unicode_ci NOT NULL AFTER `template_name`,
758
- ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
759
 
760
- $wpdb->get_results( $alter_template_table_query );
761
- }
762
 
763
  $sent_table_name = $wpdb->prefix . "ac_sent_history_lite";
764
 
@@ -853,10 +823,8 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
853
  add_option( 'wcal_reply_email', $wcal_get_admin_email );
854
  }
855
 
856
- if( !get_option( 'wcal_activate_time' ) ) {
857
- add_option( 'wcal_activate_time', current_time( 'timestamp' ) );
858
- }
859
- }
860
 
861
  /**
862
  * It will add the section, field, & registres the plugin fields using Settings API.
@@ -899,6 +867,25 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
899
  'ac_lite_general_settings_section',
900
  array( __( 'Enable tracking of abandoned products & carts even if customer does not visit the checkout page or does not enter any details on the checkout page like Name or Email. Tracking will begin as soon as a visitor adds a product to their cart and visits the cart page.', 'woocommerce-abandoned-cart' ) )
901
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
902
  /**
903
  * New section for the Adding the abandoned cart setting.
904
  * @since 4.7
@@ -954,6 +941,16 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
954
  'woocommerce_ac_settings',
955
  'ac_lite_track_guest_cart_from_cart_page'
956
  );
 
 
 
 
 
 
 
 
 
 
957
 
958
  register_setting(
959
  'woocommerce_ac_email_settings',
@@ -967,6 +964,8 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
967
  'woocommerce_ac_email_settings',
968
  'wcal_reply_email'
969
  );
 
 
970
  }
971
 
972
  /**
@@ -1062,6 +1061,36 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1062
  echo $html;
1063
  }
1064
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1065
  /**
1066
  * Settings API callback for Abandoned cart email settings of the plugin.
1067
  * @since 3.5
@@ -1136,6 +1165,23 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1136
  function wcal_update_db_check() {
1137
  global $wpdb;
1138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1139
  if( get_option( 'ac_lite_alter_table_queries' ) != 'yes' ) {
1140
  $ac_history_table_name = $wpdb->prefix."ac_abandoned_cart_history_lite";
1141
  $check_table_query = "SHOW COLUMNS FROM $ac_history_table_name LIKE 'user_type'";
@@ -1169,7 +1215,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1169
 
1170
  if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_abandoned_cart_history_lite';" ) ) {
1171
  if ( ! $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}ac_abandoned_cart_history_lite` LIKE 'unsubscribe_link';" ) ) {
1172
- $wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_abandoned_cart_history_lite ADD `unsubscribe_link` enum('0','1') COLLATE utf8_unicode_ci NOT NULL AFTER `user_type`;" );
1173
  }
1174
  }
1175
 
@@ -1178,17 +1224,6 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1178
  $wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_abandoned_cart_history_lite ADD `session_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `unsubscribe_link`;" );
1179
  }
1180
  }
1181
- /**
1182
- * This is used to prevent guest users wrong Id. If guest users id is less then 63000000 then this code will
1183
- * ensure that we will change the id of guest tables so it wont affect on the next guest users.
1184
- */
1185
- if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_guest_abandoned_cart_history_lite';" ) && 'yes' != get_option( 'wcal_guest_user_id_altered' ) ) {
1186
- $last_id = $wpdb->get_var( "SELECT max(id) FROM `{$wpdb->prefix}ac_guest_abandoned_cart_history_lite`;" );
1187
- if ( NULL != $last_id && $last_id <= 63000000 ) {
1188
- $wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_guest_abandoned_cart_history_lite AUTO_INCREMENT = 63000000;" );
1189
- update_option ( 'wcal_guest_user_id_altered', 'yes' );
1190
- }
1191
- }
1192
 
1193
  /**
1194
  * We have moved email templates fields in the setings section. SO to remove that fields column fro the db we need it.
@@ -1387,9 +1422,9 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1387
  * @globals mixed $wpdb
1388
  * @since 2.3
1389
  */
1390
- function wcal_check_order_is_recovered( $wcal_order_id ) {
1391
  global $wpdb;
1392
- $wcal_recover_order_query = "SELECT `recovered_cart` FROM `wp_ac_abandoned_cart_history_lite` WHERE `recovered_cart` = %d";
1393
  $wcal_recover_order_query_result = $wpdb->get_results( $wpdb->prepare( $wcal_recover_order_query, $wcal_order_id ) );
1394
  if( count( $wcal_recover_order_query_result ) > 0 ) {
1395
  return true;
@@ -2130,6 +2165,8 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2130
  <a href="admin.php?page=woocommerce_ac_page&action=emailsettings" class="nav-tab <?php if (isset($active_settings)) echo $active_settings; ?>"> <?php _e( 'Settings', 'woocommerce-abandoned-cart' );?> </a>
2131
  <a href="admin.php?page=woocommerce_ac_page&action=stats" class="nav-tab <?php if (isset($active_stats)) echo $active_stats; ?>"> <?php _e( 'Recovered Orders', 'woocommerce-abandoned-cart' );?> </a>
2132
  <a href="admin.php?page=woocommerce_ac_page&action=report" class="nav-tab <?php if( isset( $active_report ) ) echo $active_report; ?>"> <?php _e( 'Product Report', 'woocommerce-abandoned-cart' );?> </a>
 
 
2133
  </h2>
2134
  <?php
2135
  }
@@ -2282,6 +2319,8 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2282
  }
2283
  $this->wcal_display_tabs();
2284
 
 
 
2285
  /**
2286
  * When we delete the item from the below drop down it is registred in action 2
2287
  */
@@ -2791,7 +2830,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2791
  ?>
2792
  <p> </p>
2793
  <div id="ac_order_details" class="postbox" style="display:block">
2794
- <h3> <p> <?php printf( __( 'Abandoned Order #%s Details', 'woocommerce-abandoned-cart' ), $ac_order_id); ?> </p> </h3>
2795
  <div class="inside">
2796
  <table cellpadding="0" cellspacing="0" class="wp-list-table widefat fixed posts">
2797
  <tr>
@@ -2873,49 +2912,18 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2873
  $user_last_name = $user_last_name_temp;
2874
  }
2875
  $user_billing_first_name = get_user_meta( $results[0]->user_id, 'billing_first_name' );
2876
- $user_billing_last_name = get_user_meta( $results[0]->user_id, 'billing_last_name' );
2877
- $user_billing_company_temp = get_user_meta( $results[0]->user_id, 'billing_company' );
2878
- if ( isset( $user_billing_company_temp[0] ) ) {
2879
- $user_billing_company = $user_billing_company_temp[0];
2880
- } else {
2881
- $user_billing_company = "";
2882
- }
2883
- $user_billing_address_1_temp = get_user_meta( $results[0]->user_id, 'billing_address_1' );
2884
- if ( isset( $user_billing_address_1_temp[0] ) ) {
2885
- $user_billing_address_1 = $user_billing_address_1_temp[0];
2886
- } else {
2887
- $user_billing_address_1 = "";
2888
- }
2889
- $user_billing_address_2_temp = get_user_meta( $results[0]->user_id, 'billing_address_2' );
2890
- if ( isset( $user_billing_address_2_temp[0] ) ) {
2891
- $user_billing_address_2 = $user_billing_address_2_temp[0];
2892
- } else {
2893
- $user_billing_address_2 = "";
2894
- }
2895
- $user_billing_city_temp = get_user_meta( $results[0]->user_id, 'billing_city' );
2896
- if ( isset( $user_billing_city_temp[0] ) ) {
2897
- $user_billing_city = $user_billing_city_temp[0];
2898
- } else {
2899
- $user_billing_city = "";
2900
- }
2901
- $user_billing_postcode_temp = get_user_meta( $results[0]->user_id, 'billing_postcode' );
2902
- if ( isset( $user_billing_postcode_temp[0] ) ) {
2903
- $user_billing_postcode = $user_billing_postcode_temp[0];
2904
- } else {
2905
- $user_billing_postcode = "";
2906
- }
2907
- $user_billing_state_temp = get_user_meta( $results[0]->user_id, 'billing_state' );
2908
- if ( isset( $user_billing_state_temp[0] ) ) {
2909
- $user_billing_state = $user_billing_state_temp[0];
2910
- } else {
2911
- $user_billing_state = "";
2912
- }
2913
- $user_billing_country_temp = get_user_meta( $results[0]->user_id, 'billing_country' );
2914
- if ( isset( $user_billing_country_temp[0] ) ) {
2915
- $user_billing_country = $user_billing_country_temp[0];
2916
- } else {
2917
- $user_billing_country = "";
2918
- }
2919
  $user_billing_phone_temp = get_user_meta( $results[0]->user_id, 'billing_phone' );
2920
  if ( isset( $user_billing_phone_temp[0] ) ) {
2921
  $user_billing_phone = $user_billing_phone_temp[0];
@@ -2954,19 +2962,27 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2954
  } else {
2955
  $user_shipping_postcode = "";
2956
  }
2957
- $user_shipping_state_temp = get_user_meta( $results[0]->user_id, 'shipping_state' );
2958
- if ( isset( $user_shipping_state_temp[0] ) ) {
2959
- $user_shipping_state = $user_shipping_state_temp[0];
2960
- } else {
2961
- $user_shipping_state = "";
2962
- }
2963
  $user_shipping_country_temp = get_user_meta( $results[0]->user_id, 'shipping_country' );
 
2964
  if ( isset( $user_shipping_country_temp[0] ) ) {
2965
  $user_shipping_country = $user_shipping_country_temp[0];
2966
- } else {
2967
- $user_shipping_country = "";
 
 
 
2968
  }
 
 
 
 
 
 
 
 
 
2969
  }
 
2970
  $cart_details = array();
2971
  $cart_info = json_decode( $results[0]->abandoned_cart_info );
2972
  $cart_details = (array) $cart_info->cart;
@@ -2974,56 +2990,23 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2974
 
2975
  if ( is_array ( $cart_details ) && count( $cart_details ) > 0 ) {
2976
  foreach ( $cart_details as $k => $v ) {
2977
- $quantity_total = $v->quantity;
 
 
2978
  $product_id = $v->product_id;
2979
- $prod_name = get_post($product_id);
2980
- $product_name = $prod_name->post_title;
2981
- if ( isset( $v->variation_id ) && '' != $v->variation_id ){
2982
- $variation_id = $v->variation_id;
2983
- $variation = wc_get_product( $variation_id );
2984
- $name = $variation->get_formatted_name() ;
2985
- $explode_all = explode ( "&ndash;", $name );
2986
- if( version_compare( $woocommerce->version, '3.0.0', ">=" ) ) {
2987
- $wcap_sku = '';
2988
- if ( $variation->get_sku() ) {
2989
- $wcap_sku = "SKU: " . $variation->get_sku() . "<br>";
2990
- }
2991
- $wcap_get_formatted_variation = wc_get_formatted_variation( $variation, true );
2992
-
2993
- $add_product_name = $product_name . ' - ' . $wcap_sku . $wcap_get_formatted_variation;
2994
-
2995
- $pro_name_variation = (array) $add_product_name;
2996
- }else{
2997
- $pro_name_variation = array_slice( $explode_all, 1, -1 );
2998
- }
2999
- $product_name_with_variable = '';
3000
- $explode_many_varaition = array();
3001
- foreach( $pro_name_variation as $pro_name_variation_key => $pro_name_variation_value ) {
3002
- $explode_many_varaition = explode ( ",", $pro_name_variation_value );
3003
- if( !empty( $explode_many_varaition ) ) {
3004
- foreach( $explode_many_varaition as $explode_many_varaition_key => $explode_many_varaition_value ) {
3005
- $product_name_with_variable = $product_name_with_variable . html_entity_decode ( $explode_many_varaition_value ) . "<br>";
3006
- }
3007
- } else {
3008
- $product_name_with_variable = $product_name_with_variable . html_entity_decode ( $explode_many_varaition_value ) . "<br>";
3009
- }
3010
- }
3011
- $product_name = $product_name_with_variable;
3012
- }
3013
- // Item subtotal is calculated as product total including taxes
3014
- if ( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
3015
- $item_subtotal = $item_subtotal + $v->line_total + $v->line_subtotal_tax;
3016
- } else {
3017
- $item_subtotal = $item_subtotal + $v->line_total;
3018
- }
3019
- // Line total
3020
- $item_total = $item_subtotal;
3021
- $item_subtotal = $item_subtotal / $quantity_total;
3022
- $item_total = wc_price( $item_total );
3023
- $item_subtotal = wc_price( $item_subtotal );
3024
  $product = wc_get_product( $product_id );
3025
- $prod_image = $product->get_image();
3026
- ?>
 
 
 
 
 
 
 
 
 
 
3027
  <tr>
3028
  <td> <?php echo $prod_image; ?></td>
3029
  <td> <?php echo $product_name; ?></td>
@@ -3040,8 +3023,8 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
3040
  </div>
3041
  </div>
3042
  <div id="ac_order_customer_details" class="postbox" style="display:block">
3043
- <h3> <p> <?php _e( 'Customer Details' , 'woocommerce-abandoned-cart' ); ?> </p> </h3>
3044
- <div class="inside" style="height: 300px;" >
3045
  <div id="order_data" class="panel">
3046
  <div style="width:50%;float:left">
3047
  <h3> <p> <?php _e( 'Billing Details' , 'woocommerce-abandoned-cart' ); ?> </p> </h3>
5
  * Description: This plugin captures abandoned carts by logged-in users & emails them about it.
6
  * <strong><a href="http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro">Click here to get the
7
  * PRO Version.</a></strong>
8
+ * Version: 4.9
9
  * Author: Tyche Softwares
10
  * Author URI: http://www.tychesoftwares.com/
11
  * Text Domain: woocommerce-abandoned-cart
12
  * Domain Path: /i18n/languages/
13
  * Requires PHP: 5.6
14
  * WC requires at least: 3.0.0
15
+ * WC tested up to: 3.4.0
16
  *
17
  * @package Abandoned-Cart-Lite-for-WooCommerce
18
  */
26
  require_once( "includes/classes/class-wcal-aes.php" );
27
  require_once( "includes/classes/class-wcal-aes-counter.php" );
28
  require_once( "includes/wcal-common.php" );
29
+
30
  require_once( "includes/wcal_admin_notice.php");
31
+ require_once( 'includes/wcal_data_tracking_message.php' );
32
+ require_once( 'includes/admin/wcal_privacy_erase.php' );
33
+ require_once( 'includes/admin/wcal_privacy_export.php' );
34
 
35
  if ( is_admin() ) {
36
+ require_once( 'includes/wcal_all_component.php' );
37
+
 
 
 
38
  }
39
 
40
  // Add a new interval of 15 minutes
66
  wp_schedule_event( time(), '15_minutes_lite', 'woocommerce_ac_send_email_action' );
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  /**
70
  * Hook into that action that'll fire every 15 minutes
71
  */
 
72
  add_action( 'woocommerce_ac_send_email_action', 'wcal_send_email_cron' );
73
 
74
  /**
174
 
175
  delete_option( 'wcal_welcome_page_shown_time' );
176
  delete_option( 'wcal_welcome_page_shown' );
177
+
178
+ delete_option( 'wcal_guest_cart_capture_msg' );
179
+ delete_option( 'wcal_logged_cart_capture_msg' );
180
  }
181
  /**
182
  * woocommerce_abandon_cart_lite class
273
  add_action ( 'admin_head', array( &$this, 'wcal_action_send_preview' ) );
274
  add_action ( 'wp_ajax_wcal_preview_email_sent', array( &$this, 'wcal_preview_email_sent' ) );
275
  add_action ( 'wp_ajax_wcal_toggle_template_status', array( &$this, 'wcal_toggle_template_status' ) );
276
+
277
+ add_filter( 'ts_tracker_data', array( 'wcal_common', 'ts_add_plugin_tracking_data' ), 10, 1 );
278
+ add_filter( 'ts_tracker_opt_out_data', array( 'wcal_common', 'ts_get_data_for_opt_out' ), 10, 1 );
279
+ add_filter( 'ts_deativate_plugin_questions', array( &$this, 'wcal_deactivate_add_questions' ), 10, 1 );
280
  }
281
 
282
  // Send Email on order recovery
294
  add_filter( 'woocommerce_payment_complete_order_status', array( &$this, 'wcal_order_complete_action' ), 10 , 2 );
295
  add_filter( 'admin_footer_text', array( $this, 'wcal_admin_footer_text' ), 1 );
296
 
 
 
297
  add_action( 'admin_notices', array( 'Wcal_Admin_Notice', 'wcal_show_db_update_notice' ) );
 
 
 
 
 
 
298
  }
299
 
300
  /**
301
+ * It will add the Questions while admin deactivate the plugin.
302
+ * @hook ts_deativate_plugin_questions
303
+ * @param array $wcal_add_questions Blank array
304
+ * @return array $wcal_add_questions List of all questions.
 
 
 
 
 
 
 
 
 
 
 
305
  */
306
+ public static function wcal_deactivate_add_questions ( $wcal_add_questions ) {
307
+
308
+ $wcal_add_questions = array(
309
+ 0 => array(
310
+ 'id' => 4,
311
+ 'text' => __( "Emails are not being sent to customers.", "woocommerce-abandoned-cart" ),
312
+ 'input_type' => '',
313
+ 'input_placeholder' => ''
314
+ ),
315
+ 1 => array(
316
+ 'id' => 5,
317
+ 'text' => __( "Capturing of cart and other information was not satisfactory.", "woocommerce-abandoned-cart" ),
318
+ 'input_type' => '',
319
+ 'input_placeholder' => ''
320
+ ),
321
+ 2 => array(
322
+ 'id' => 6,
323
+ 'text' => __( "I cannot see abandoned cart reminder emails records.", "woocommerce-abandoned-cart" ),
324
+ 'input_type' => '',
325
+ 'input_placeholder' => ''
326
+ ),
327
+ 3 => array(
328
+ 'id' => 7,
329
+ 'text' => __( "I want to upgrade the plugin to the PRO version.", "woocommerce-abandoned-cart" ),
330
+ 'input_type' => '',
331
+ 'input_placeholder' => ''
332
+ )
333
+
334
+ );
335
+ return $wcal_add_questions;
336
  }
337
 
338
  /**
530
  * It will delete the order from history table if the order is placed before any email sent to
531
  * the user.
532
  */
533
+ $wpdb->delete( $wcal_history_table_name , array( 'id' => $wcal_abandoned_cart_id ) );
534
 
535
  /* This user id is set for the guest uesrs. */
536
  if ( isset( $_SESSION['user_id'] ) && $_SESSION['user_id'] != '' ) {
709
  `frequency` int(11) NOT NULL,
710
  `day_or_hour` enum('Days','Hours') COLLATE utf8mb4_unicode_ci NOT NULL,
711
  `template_name` text COLLATE utf8mb4_unicode_ci NOT NULL,
712
+ `is_wc_template` enum('0','1') COLLATE utf8_unicode_ci NOT NULL,
713
+ `default_template` int(11) COLLATE utf8_unicode_ci NOT NULL,
714
+ `wc_email_header` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
715
  PRIMARY KEY (`id`)
716
  ) $wcap_collate AUTO_INCREMENT=1 ";
717
 
718
  require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
719
  dbDelta( $sql );
720
 
721
+ // $table_name = $wpdb->prefix . "ac_email_templates_lite";
722
+ // $check_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'is_wc_template' ";
723
+ // $results = $wpdb->get_results( $check_template_table_query );
724
 
725
+ // if ( count( $results ) == 0 ) {
726
+ // $alter_template_table_query = "ALTER TABLE $table_name
727
+ // ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8mb4_unicode_ci NOT NULL AFTER `template_name`,
728
+ // ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
729
 
730
+ // $wpdb->get_results( $alter_template_table_query );
731
+ // }
732
 
733
  $sent_table_name = $wpdb->prefix . "ac_sent_history_lite";
734
 
823
  add_option( 'wcal_reply_email', $wcal_get_admin_email );
824
  }
825
 
826
+ do_action( 'wcal_activate' );
827
+ }
 
 
828
 
829
  /**
830
  * It will add the section, field, & registres the plugin fields using Settings API.
867
  'ac_lite_general_settings_section',
868
  array( __( 'Enable tracking of abandoned products & carts even if customer does not visit the checkout page or does not enter any details on the checkout page like Name or Email. Tracking will begin as soon as a visitor adds a product to their cart and visits the cart page.', 'woocommerce-abandoned-cart' ) )
869
  );
870
+
871
+ add_settings_field(
872
+ 'wcal_guest_cart_capture_msg',
873
+ __( 'Message to be displayed for Guest users when tracking their carts', 'woocommerce-abandoned-cart' ),
874
+ array( $this, 'wcal_guest_cart_capture_msg_callback' ),
875
+ 'woocommerce_ac_page',
876
+ 'ac_lite_general_settings_section',
877
+ array( __( '<br>In compliance with GDPR, add a message on the Checkout page to inform Guest users of how their data is being used.<br><i>For example: Your email address will help us support your shopping experience throughout the site. Please check our Privacy Policy to see how we use your personal data.</i>', 'woocommerce-abandoned-cart' ) )
878
+ );
879
+
880
+ add_settings_field(
881
+ 'wcal_logged_cart_capture_msg',
882
+ __( 'Message to be displayed for registered users when tracking their carts.', 'woocommerce-abandoned-cart' ),
883
+ array( $this, 'wcal_logged_cart_capture_msg_callback' ),
884
+ 'woocommerce_ac_page',
885
+ 'ac_lite_general_settings_section',
886
+ array( __( '<br>In compliance with GDPR, add a message on the Shop & Product pages to inform Registered users of how their data is being used.<br><i>For example: Please check our Privacy Policy to see how we use your personal data.</i>', 'woocommerce-abandoned-cart' ) )
887
+ );
888
+
889
  /**
890
  * New section for the Adding the abandoned cart setting.
891
  * @since 4.7
941
  'woocommerce_ac_settings',
942
  'ac_lite_track_guest_cart_from_cart_page'
943
  );
944
+
945
+ register_setting(
946
+ 'woocommerce_ac_settings',
947
+ 'wcal_guest_cart_capture_msg'
948
+ );
949
+
950
+ register_setting(
951
+ 'woocommerce_ac_settings',
952
+ 'wcal_logged_cart_capture_msg'
953
+ );
954
 
955
  register_setting(
956
  'woocommerce_ac_email_settings',
964
  'woocommerce_ac_email_settings',
965
  'wcal_reply_email'
966
  );
967
+
968
+ do_action ( "wcal_add_new_settings" );
969
  }
970
 
971
  /**
1061
  echo $html;
1062
  }
1063
 
1064
+ /**
1065
+ * Call back function for guest user cart capture message
1066
+ * @param array $args Argument for adding field details
1067
+ * @since 7.8
1068
+ */
1069
+ public static function wcal_guest_cart_capture_msg_callback( $args ) {
1070
+
1071
+ $guest_msg = get_option( 'wcal_guest_cart_capture_msg' );
1072
+
1073
+ $html = "<textarea rows='4' cols='80' id='wcal_guest_cart_capture_msg' name='wcal_guest_cart_capture_msg'>$guest_msg</textarea>";
1074
+
1075
+ $html .= '<label for="wcal_guest_cart_capture_msg"> ' . $args[0] . '</label>';
1076
+ echo $html;
1077
+ }
1078
+
1079
+ /**
1080
+ * Call back function for registered user cart capture message
1081
+ * @param array $args Argument for adding field details
1082
+ * @since 7.8
1083
+ */
1084
+ public static function wcal_logged_cart_capture_msg_callback( $args) {
1085
+
1086
+ $logged_msg = get_option( 'wcal_logged_cart_capture_msg' );
1087
+
1088
+ $html = "<input type='text' class='regular-text' id='wcal_logged_cart_capture_msg' name='wcal_logged_cart_capture_msg' value='$logged_msg' />";
1089
+
1090
+ $html .= '<label for="wcal_logged_cart_capture_msg"> ' . $args[0] . '</label>';
1091
+ echo $html;
1092
+ }
1093
+
1094
  /**
1095
  * Settings API callback for Abandoned cart email settings of the plugin.
1096
  * @since 3.5
1165
  function wcal_update_db_check() {
1166
  global $wpdb;
1167
 
1168
+ $wcal_previous_version = get_option( 'wcal_previous_version' );
1169
+
1170
+ if ( $wcal_previous_version != wcal_common::wcal_get_version() ) {
1171
+ update_option( 'wcal_previous_version', '4.9' );
1172
+ }
1173
+
1174
+ /**
1175
+ * This is used to prevent guest users wrong Id. If guest users id is less then 63000000 then this code will
1176
+ * ensure that we will change the id of guest tables so it wont affect on the next guest users.
1177
+ */
1178
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_guest_abandoned_cart_history_lite';" ) && 'yes' != get_option( 'wcal_guest_user_id_altered' ) ) {
1179
+ $last_id = $wpdb->get_var( "SELECT max(id) FROM `{$wpdb->prefix}ac_guest_abandoned_cart_history_lite`;" );
1180
+ if ( NULL != $last_id && $last_id <= 63000000 ) {
1181
+ $wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_guest_abandoned_cart_history_lite AUTO_INCREMENT = 63000000;" );
1182
+ update_option ( 'wcal_guest_user_id_altered', 'yes' );
1183
+ }
1184
+ }
1185
  if( get_option( 'ac_lite_alter_table_queries' ) != 'yes' ) {
1186
  $ac_history_table_name = $wpdb->prefix."ac_abandoned_cart_history_lite";
1187
  $check_table_query = "SHOW COLUMNS FROM $ac_history_table_name LIKE 'user_type'";
1215
 
1216
  if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_abandoned_cart_history_lite';" ) ) {
1217
  if ( ! $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}ac_abandoned_cart_history_lite` LIKE 'unsubscribe_link';" ) ) {
1218
+ $wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_abandoned_cart_history_lite ADD `unsubscribe_link` enum('0','1') COLLATE utf8_unicode_ci NOT NULL AFTER `user_type`;" );
1219
  }
1220
  }
1221
 
1224
  $wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_abandoned_cart_history_lite ADD `session_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `unsubscribe_link`;" );
1225
  }
1226
  }
 
 
 
 
 
 
 
 
 
 
 
1227
 
1228
  /**
1229
  * We have moved email templates fields in the setings section. SO to remove that fields column fro the db we need it.
1422
  * @globals mixed $wpdb
1423
  * @since 2.3
1424
  */
1425
+ public static function wcal_check_order_is_recovered( $wcal_order_id ) {
1426
  global $wpdb;
1427
+ $wcal_recover_order_query = "SELECT `recovered_cart` FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE `recovered_cart` = %d";
1428
  $wcal_recover_order_query_result = $wpdb->get_results( $wpdb->prepare( $wcal_recover_order_query, $wcal_order_id ) );
1429
  if( count( $wcal_recover_order_query_result ) > 0 ) {
1430
  return true;
2165
  <a href="admin.php?page=woocommerce_ac_page&action=emailsettings" class="nav-tab <?php if (isset($active_settings)) echo $active_settings; ?>"> <?php _e( 'Settings', 'woocommerce-abandoned-cart' );?> </a>
2166
  <a href="admin.php?page=woocommerce_ac_page&action=stats" class="nav-tab <?php if (isset($active_stats)) echo $active_stats; ?>"> <?php _e( 'Recovered Orders', 'woocommerce-abandoned-cart' );?> </a>
2167
  <a href="admin.php?page=woocommerce_ac_page&action=report" class="nav-tab <?php if( isset( $active_report ) ) echo $active_report; ?>"> <?php _e( 'Product Report', 'woocommerce-abandoned-cart' );?> </a>
2168
+
2169
+ <?php do_action ( 'wcal_add_settings_tab' ); ?>
2170
  </h2>
2171
  <?php
2172
  }
2319
  }
2320
  $this->wcal_display_tabs();
2321
 
2322
+ do_action ( 'wcal_add_tab_content' );
2323
+
2324
  /**
2325
  * When we delete the item from the below drop down it is registred in action 2
2326
  */
2830
  ?>
2831
  <p> </p>
2832
  <div id="ac_order_details" class="postbox" style="display:block">
2833
+ <h3 class="details-title"> <p> <?php printf( __( 'Abandoned Order #%s Details', 'woocommerce-abandoned-cart' ), $ac_order_id); ?> </p> </h3>
2834
  <div class="inside">
2835
  <table cellpadding="0" cellspacing="0" class="wp-list-table widefat fixed posts">
2836
  <tr>
2912
  $user_last_name = $user_last_name_temp;
2913
  }
2914
  $user_billing_first_name = get_user_meta( $results[0]->user_id, 'billing_first_name' );
2915
+ $user_billing_last_name = get_user_meta( $results[0]->user_id, 'billing_last_name' );
2916
+
2917
+ $user_billing_details = wcal_common::wcal_get_billing_details( $results[0]->user_id );
2918
+
2919
+ $user_billing_company = $user_billing_details[ 'billing_company' ];
2920
+ $user_billing_address_1 = $user_billing_details[ 'billing_address_1' ];
2921
+ $user_billing_address_2 = $user_billing_details[ 'billing_address_2' ];
2922
+ $user_billing_city = $user_billing_details[ 'billing_city' ];
2923
+ $user_billing_postcode = $user_billing_details[ 'billing_postcode' ] ;
2924
+ $user_billing_country = $user_billing_details[ 'billing_country' ];
2925
+ $user_billing_state = $user_billing_details[ 'billing_state' ];
2926
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2927
  $user_billing_phone_temp = get_user_meta( $results[0]->user_id, 'billing_phone' );
2928
  if ( isset( $user_billing_phone_temp[0] ) ) {
2929
  $user_billing_phone = $user_billing_phone_temp[0];
2962
  } else {
2963
  $user_shipping_postcode = "";
2964
  }
 
 
 
 
 
 
2965
  $user_shipping_country_temp = get_user_meta( $results[0]->user_id, 'shipping_country' );
2966
+ $user_shipping_country = "";
2967
  if ( isset( $user_shipping_country_temp[0] ) ) {
2968
  $user_shipping_country = $user_shipping_country_temp[0];
2969
+ if ( isset( $woocommerce->countries->countries[ $user_shipping_country ] ) ) {
2970
+ $user_shipping_country = $woocommerce->countries->countries[ $user_shipping_country ];
2971
+ }else {
2972
+ $user_shipping_country = "";
2973
+ }
2974
  }
2975
+ $user_shipping_state_temp = get_user_meta( $results[0]->user_id, 'shipping_state' );
2976
+ $user_shipping_state = "";
2977
+ if ( isset( $user_shipping_state_temp[0] ) ) {
2978
+ $user_shipping_state = $user_shipping_state_temp[0];
2979
+ if ( isset( $woocommerce->countries->states[ $user_shipping_country_temp[0] ][ $user_shipping_state ] ) ) {
2980
+ # code...
2981
+ $user_shipping_state = $woocommerce->countries->states[ $user_shipping_country_temp[0] ][ $user_shipping_state ];
2982
+ }
2983
+ }
2984
  }
2985
+
2986
  $cart_details = array();
2987
  $cart_info = json_decode( $results[0]->abandoned_cart_info );
2988
  $cart_details = (array) $cart_info->cart;
2990
 
2991
  if ( is_array ( $cart_details ) && count( $cart_details ) > 0 ) {
2992
  foreach ( $cart_details as $k => $v ) {
2993
+
2994
+ $item_details = wcal_common::wcal_get_cart_details( $v );
2995
+
2996
  $product_id = $v->product_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2997
  $product = wc_get_product( $product_id );
2998
+ $prod_image = $product->get_image(array(200, 200));
2999
+
3000
+ $product_name = $item_details[ 'product_name' ];
3001
+ $item_subtotal = $item_details[ 'item_total_formatted' ];
3002
+ $item_total = $item_details[ 'item_total' ];
3003
+ $quantity_total = $item_details[ 'qty' ];
3004
+
3005
+ $qty_item_text = 'item';
3006
+ if ( $quantity_total > 1 ) {
3007
+ $qty_item_text = 'items';
3008
+ }
3009
+ ?>
3010
  <tr>
3011
  <td> <?php echo $prod_image; ?></td>
3012
  <td> <?php echo $product_name; ?></td>
3023
  </div>
3024
  </div>
3025
  <div id="ac_order_customer_details" class="postbox" style="display:block">
3026
+ <h3 class="details-title"> <p> <?php _e( 'Customer Details' , 'woocommerce-abandoned-cart' ); ?> </p> </h3>
3027
+ <div class="inside" style="height: 300px;" >
3028
  <div id="order_data" class="panel">
3029
  <div style="width:50%;float:left">
3030
  <h3> <p> <?php _e( 'Billing Details' , 'woocommerce-abandoned-cart' ); ?> </p> </h3>