Abandoned Cart Lite for WooCommerce - Version 5.3.2

Version Description

(16.04.2019) =

  • Tweak - Optimizing SQL queries by escaping the parameters passed.
Download this release

Release Info

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

Code changes from version 5.3.0 to 5.3.2

Files changed (2) hide show
  1. readme.txt +11 -3
  2. woocommerce-ac.php +37 -42
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
-
2
  === Abandoned Cart Lite for WooCommerce ===
3
  Contributors: ashokrane, pinal.shah, bhavik.kiri, chetnapatel, tychesoftwares, dhruvin
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: 5.0
8
  Stable tag: trunk
9
  License: GPLv2 or late
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -193,6 +193,14 @@ You can refer **[here](https://www.tychesoftwares.com/differences-between-pro-an
193
 
194
  == Changelog ==
195
 
 
 
 
 
 
 
 
 
196
  = 5.3.0 (26.03.2019) =
197
 
198
  * Enhancement - Corrected the way recovered orders were tracked. Replaced the hooks tracking orders.
@@ -311,7 +319,7 @@ Bug Fix - The website was crashing as the folder name for the plugin was not cha
311
 
312
  * 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.
313
 
314
- * Bug Fixed - Some notices are fixed of the debug.log file.
315
 
316
  = 4.8 (20.03-2018) =
317
  * 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.
1
+ 
2
  === Abandoned Cart Lite for WooCommerce ===
3
  Contributors: ashokrane, pinal.shah, bhavik.kiri, chetnapatel, tychesoftwares, dhruvin
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: 5.1
8
  Stable tag: trunk
9
  License: GPLv2 or late
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
193
 
194
  == Changelog ==
195
 
196
+ = 5.3.2 (16.04.2019) =
197
+
198
+ * Tweak - Optimizing SQL queries by escaping the parameters passed.
199
+
200
+ = 5.3.1 (04.04.2019) =
201
+
202
+ * Bug - Fixed a bug where the login was conflicting with sites hosted on WP Engine.
203
+
204
  = 5.3.0 (26.03.2019) =
205
 
206
  * Enhancement - Corrected the way recovered orders were tracked. Replaced the hooks tracking orders.
319
 
320
  * 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.
321
 
322
+ * Bug Fixed - Some notices are fixed of the debug.log file.
323
 
324
  = 4.8 (20.03-2018) =
325
  * 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.
woocommerce-ac.php CHANGED
@@ -5,7 +5,7 @@
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: 5.3.0
9
  * Author: Tyche Softwares
10
  * Author URI: http://www.tychesoftwares.com/
11
  * Text Domain: woocommerce-abandoned-cart
@@ -174,7 +174,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
174
 
175
  add_action ( 'admin_enqueue_scripts', array( &$this, 'wcal_enqueue_scripts_js' ) );
176
  add_action ( 'admin_enqueue_scripts', array( &$this, 'wcal_enqueue_scripts_css' ) );
177
- //delete abandoned order after X number of days
178
  if ( class_exists( 'wcal_delete_bulk_action_handler' ) ) {
179
  add_action( 'wcal_clear_carts', array( 'wcal_delete_bulk_action_handler', 'wcal_delete_abandoned_carts_after_x_days' ) );
180
  }
@@ -201,15 +201,9 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
201
 
202
  add_action( 'admin_notices', array( 'Wcal_Admin_Notice', 'wcal_show_db_update_notice' ) );
203
 
204
- add_action( 'wp_login', array( &$this, 'wcal_remove_action_hook' ), 1 );
205
-
206
  include_once 'includes/frontend/wcal_frontend.php';
207
  }
208
-
209
- public static function wcal_remove_action_hook(){
210
- remove_action( 'woocommerce_cart_updated', array( &$this, 'wcal_store_cart_timestamp' ) );
211
- }
212
-
213
  /**
214
  * Add Settings link to WP->Plugins page
215
  * @since 5.3.0
@@ -220,7 +214,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
220
  return $links;
221
  }
222
 
223
- /**
224
  * It will load the boilerplate components file. In this file we have included all boilerplate files.
225
  * We need to inlcude this file after the init hook.
226
  * @hook init
@@ -880,7 +874,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
880
  $wcal_previous_version = get_option( 'wcal_previous_version' );
881
 
882
  if ( $wcal_previous_version != wcal_common::wcal_get_version() ) {
883
- update_option( 'wcal_previous_version', '5.3.0' );
884
  }
885
 
886
  /**
@@ -1179,8 +1173,8 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1179
  AND cart_ignored = %s ";
1180
  $wpdb->query( $wpdb->prepare( $query_update, $updated_cart_info, $current_time, $user_id, $cart_ignored ) );
1181
 
1182
- $query_update = "SELECT * FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE user_id ='" . $user_id . "' AND cart_ignored='0' ";
1183
- $get_abandoned_record = $wpdb->get_results( $query_update );
1184
  if ( count( $get_abandoned_record ) > 0 ) {
1185
  $abandoned_cart_id = $get_abandoned_record[0]->id;
1186
  wcal_common::wcal_set_cart_session( 'abandoned_cart_id_lite', $abandoned_cart_id );
@@ -1210,8 +1204,8 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1210
 
1211
  $query_ignored = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1212
  SET cart_ignored = '1'
1213
- WHERE user_id ='".$user_id."'";
1214
- $wpdb->query( $query_ignored );
1215
  $user_type = 'GUEST';
1216
  $query_update = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1217
  (user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type)
@@ -1223,9 +1217,9 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1223
  }
1224
  } else {
1225
  $query_update = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1226
- SET abandoned_cart_info = '".$updated_cart_info."', abandoned_cart_time = '".$current_time."'
1227
- WHERE user_id='".$user_id."' AND cart_ignored='0' ";
1228
- $wpdb->query( $query_update );
1229
  }
1230
  } else {
1231
  /**
@@ -1241,27 +1235,28 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1241
  if ( $blank_cart_info != $cart_info && '{"cart":[]}' != $cart_info ) {
1242
  $insert_query = "INSERT INTO `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
1243
  ( abandoned_cart_info , abandoned_cart_time , cart_ignored , recovered_cart, user_type, session_id )
1244
- VALUES ( '" . $cart_info."' , '" . $current_time . "' , '0' , '0' , 'GUEST', '". $get_cookie[0] ."' )";
1245
- $wpdb->query( $insert_query );
1246
  }
1247
  } elseif ( $compare_time > $results[0]->abandoned_cart_time ) {
1248
  $blank_cart_info = '[]';
1249
  if ( $blank_cart_info != $updated_cart_info && '{"cart":[]}' != $updated_cart_info ) {
1250
  if ( ! $this->wcal_compare_only_guest_carts( $updated_cart_info, $results[0]->abandoned_cart_info ) ) {
1251
- $query_ignored = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` SET cart_ignored = '1' WHERE session_id ='" . $get_cookie[0] . "'";
1252
- $wpdb->query( $query_ignored );
 
1253
  $query_update = "INSERT INTO `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
1254
  ( abandoned_cart_info, abandoned_cart_time, cart_ignored, recovered_cart, user_type, session_id )
1255
- VALUES ( '" . $updated_cart_info . "', '" . $current_time . "', '0', '0', 'GUEST', '". $get_cookie[0] ."' )";
1256
- $wpdb->query( $query_update );
1257
  }
1258
  }
1259
  } else {
1260
  $blank_cart_info = '[]';
1261
  if ( $blank_cart_info != $updated_cart_info && '{"cart":[]}' != $updated_cart_info ) {
1262
  if ( ! $this->wcal_compare_only_guest_carts( $updated_cart_info, $results[0]->abandoned_cart_info ) ) {
1263
- $query_update = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` SET abandoned_cart_info = '" . $updated_cart_info . "', abandoned_cart_time = '" . $current_time . "' WHERE session_id ='" . $get_cookie[0] . "' AND cart_ignored='0' ";
1264
- $wpdb->query( $query_update );
1265
  }
1266
  }
1267
  }
@@ -2159,19 +2154,19 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2159
  } else {
2160
  $active = "1";
2161
 
2162
- $query_update = "SELECT * FROM `".$wpdb->prefix."ac_email_templates_lite` WHERE id ='" . $template_id . "'";
2163
- $get_selected_template_result = $wpdb->get_results( $query_update );
2164
  $email_frequncy = $get_selected_template_result[0]->frequency;
2165
  $email_day_or_hour = $get_selected_template_result[0]->day_or_hour;
2166
 
2167
- $query_update = "UPDATE `".$wpdb->prefix."ac_email_templates_lite` SET is_active='0' WHERE frequency='" . $email_frequncy . "' AND day_or_hour='" . $email_day_or_hour . "' ";
2168
- $wcap_updated = $wpdb->query( $query_update );
2169
  }
2170
  $query_update = "UPDATE `" . $wpdb->prefix . "ac_email_templates_lite`
2171
  SET
2172
- is_active = '" . $active . "'
2173
- WHERE id = '" . $template_id . "' ";
2174
- $wpdb->query( $query_update );
2175
 
2176
  wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&action=emailtemplates' ) );
2177
  }
@@ -2999,16 +2994,16 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2999
  $current_template_status = $_POST['current_state'];
3000
 
3001
  if ( "on" == $current_template_status ) {
3002
- $query_update = "SELECT * FROM `" . $wpdb->prefix . "ac_email_templates_lite` WHERE id ='" . $template_id . "'";
3003
- $get_selected_template_result = $wpdb->get_results( $query_update );
3004
  $email_frequncy = $get_selected_template_result[0]->frequency;
3005
  $email_day_or_hour = $get_selected_template_result[0]->day_or_hour;
3006
- $query_update = "UPDATE `" . $wpdb->prefix . "ac_email_templates_lite` SET is_active='0' WHERE frequency='" . $email_frequncy . "' AND day_or_hour='" . $email_day_or_hour . "' ";
3007
- $wcal_updated = $wpdb->query( $query_update );
3008
 
3009
  if ( 1 == $wcal_updated ){
3010
- $query_update_get_id = "SELECT id FROM `" . $wpdb->prefix . "ac_email_templates_lite` WHERE id != $template_id AND frequency='" . $email_frequncy . "' AND day_or_hour='" . $email_day_or_hour . "' ";
3011
- $wcal_updated_get_id = $wpdb->get_results( $query_update_get_id );
3012
  $wcal_all_ids = '';
3013
  foreach ( $wcal_updated_get_id as $wcal_updated_get_id_key => $wcal_updated_get_id_value ) {
3014
  # code...
@@ -3029,9 +3024,9 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
3029
  }
3030
  $query_update = "UPDATE `" . $wpdb->prefix . "ac_email_templates_lite`
3031
  SET
3032
- is_active = '" . $active . "'
3033
- WHERE id = '" . $template_id . "' ";
3034
- $wpdb->query( $query_update );
3035
  wp_die();
3036
 
3037
  }
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: 5.3.2
9
  * Author: Tyche Softwares
10
  * Author URI: http://www.tychesoftwares.com/
11
  * Text Domain: woocommerce-abandoned-cart
174
 
175
  add_action ( 'admin_enqueue_scripts', array( &$this, 'wcal_enqueue_scripts_js' ) );
176
  add_action ( 'admin_enqueue_scripts', array( &$this, 'wcal_enqueue_scripts_css' ) );
177
+ //delete abandoned order after X number of days
178
  if ( class_exists( 'wcal_delete_bulk_action_handler' ) ) {
179
  add_action( 'wcal_clear_carts', array( 'wcal_delete_bulk_action_handler', 'wcal_delete_abandoned_carts_after_x_days' ) );
180
  }
201
 
202
  add_action( 'admin_notices', array( 'Wcal_Admin_Notice', 'wcal_show_db_update_notice' ) );
203
 
 
 
204
  include_once 'includes/frontend/wcal_frontend.php';
205
  }
206
+
 
 
 
 
207
  /**
208
  * Add Settings link to WP->Plugins page
209
  * @since 5.3.0
214
  return $links;
215
  }
216
 
217
+ /**
218
  * It will load the boilerplate components file. In this file we have included all boilerplate files.
219
  * We need to inlcude this file after the init hook.
220
  * @hook init
874
  $wcal_previous_version = get_option( 'wcal_previous_version' );
875
 
876
  if ( $wcal_previous_version != wcal_common::wcal_get_version() ) {
877
+ update_option( 'wcal_previous_version', '5.3.1' );
878
  }
879
 
880
  /**
1173
  AND cart_ignored = %s ";
1174
  $wpdb->query( $wpdb->prepare( $query_update, $updated_cart_info, $current_time, $user_id, $cart_ignored ) );
1175
 
1176
+ $query_update = "SELECT * FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE user_id = %d AND cart_ignored='0' ";
1177
+ $get_abandoned_record = $wpdb->get_results( $wpdb->prepare( $query_update, $user_id ) );
1178
  if ( count( $get_abandoned_record ) > 0 ) {
1179
  $abandoned_cart_id = $get_abandoned_record[0]->id;
1180
  wcal_common::wcal_set_cart_session( 'abandoned_cart_id_lite', $abandoned_cart_id );
1204
 
1205
  $query_ignored = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1206
  SET cart_ignored = '1'
1207
+ WHERE user_id = %d";
1208
+ $wpdb->query( $wpdb->prepare( $query_ignored, $user_id ) );
1209
  $user_type = 'GUEST';
1210
  $query_update = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1211
  (user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type)
1217
  }
1218
  } else {
1219
  $query_update = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1220
+ SET abandoned_cart_info = %s, abandoned_cart_time = %d
1221
+ WHERE user_id= %d AND cart_ignored='0' ";
1222
+ $wpdb->query( $wpdb->prepare( $query_update, $updated_cart_info, $current_time, $user_id ) );
1223
  }
1224
  } else {
1225
  /**
1235
  if ( $blank_cart_info != $cart_info && '{"cart":[]}' != $cart_info ) {
1236
  $insert_query = "INSERT INTO `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
1237
  ( abandoned_cart_info , abandoned_cart_time , cart_ignored , recovered_cart, user_type, session_id )
1238
+ VALUES ( %s , %d , '0' , '0' , 'GUEST', %s )";
1239
+ $wpdb->query( $wpdb->prepare( $insert_query, $cart_info, $current_time, $get_cookie[0] ) );
1240
  }
1241
  } elseif ( $compare_time > $results[0]->abandoned_cart_time ) {
1242
  $blank_cart_info = '[]';
1243
  if ( $blank_cart_info != $updated_cart_info && '{"cart":[]}' != $updated_cart_info ) {
1244
  if ( ! $this->wcal_compare_only_guest_carts( $updated_cart_info, $results[0]->abandoned_cart_info ) ) {
1245
+ $query_ignored = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` SET cart_ignored = '1' WHERE session_id = %s";
1246
+ $wpdb->query( $wpdb->prepare( $query_ignored, $get_cookie[0] ) );
1247
+
1248
  $query_update = "INSERT INTO `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
1249
  ( abandoned_cart_info, abandoned_cart_time, cart_ignored, recovered_cart, user_type, session_id )
1250
+ VALUES ( %s, %d, '0', '0', 'GUEST', %s )";
1251
+ $wpdb->query( $wpdb->prepare( $query_update, $updated_cart_info, $current_time, $get_cookie[0] ) );
1252
  }
1253
  }
1254
  } else {
1255
  $blank_cart_info = '[]';
1256
  if ( $blank_cart_info != $updated_cart_info && '{"cart":[]}' != $updated_cart_info ) {
1257
  if ( ! $this->wcal_compare_only_guest_carts( $updated_cart_info, $results[0]->abandoned_cart_info ) ) {
1258
+ $query_update = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` SET abandoned_cart_info = %s, abandoned_cart_time = %d WHERE session_id = %d AND cart_ignored='0' ";
1259
+ $wpdb->query( $wpdb->prepare( $query_update, $updated_cart_info, $current_time, $get_cookie[0] ) );
1260
  }
1261
  }
1262
  }
2154
  } else {
2155
  $active = "1";
2156
 
2157
+ $query_update = "SELECT * FROM `".$wpdb->prefix."ac_email_templates_lite` WHERE id = %s";
2158
+ $get_selected_template_result = $wpdb->get_results( $wpdb->prepare( $query_update, $template_id) );
2159
  $email_frequncy = $get_selected_template_result[0]->frequency;
2160
  $email_day_or_hour = $get_selected_template_result[0]->day_or_hour;
2161
 
2162
+ $query_update = "UPDATE `".$wpdb->prefix."ac_email_templates_lite` SET is_active='0' WHERE frequency=%s AND day_or_hour=%s ";
2163
+ $wcap_updated = $wpdb->query( $wpdb->prepare( $query_update, $email_frequncy, $email_day_or_hour ) );
2164
  }
2165
  $query_update = "UPDATE `" . $wpdb->prefix . "ac_email_templates_lite`
2166
  SET
2167
+ is_active = %s
2168
+ WHERE id = %s";
2169
+ $wpdb->query( $wpdb->prepare( $query_update, $active, $template_id ) );
2170
 
2171
  wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&action=emailtemplates' ) );
2172
  }
2994
  $current_template_status = $_POST['current_state'];
2995
 
2996
  if ( "on" == $current_template_status ) {
2997
+ $query_update = "SELECT * FROM `" . $wpdb->prefix . "ac_email_templates_lite` WHERE id = %s";
2998
+ $get_selected_template_result = $wpdb->get_results( $wpdb->prepare( $query_update, $template_id ) );
2999
  $email_frequncy = $get_selected_template_result[0]->frequency;
3000
  $email_day_or_hour = $get_selected_template_result[0]->day_or_hour;
3001
+ $query_update = "UPDATE `" . $wpdb->prefix . "ac_email_templates_lite` SET is_active='0' WHERE frequency= %s AND day_or_hour= %s ";
3002
+ $wcal_updated = $wpdb->query( $wpdb->prepare( $query_update,$email_frequncy, $email_day_or_hour ) );
3003
 
3004
  if ( 1 == $wcal_updated ){
3005
+ $query_update_get_id = "SELECT id FROM `" . $wpdb->prefix . "ac_email_templates_lite` WHERE id != %s AND frequency = %s AND day_or_hour = %s";
3006
+ $wcal_updated_get_id = $wpdb->get_results( $wpdb->prepare( $query_update_get_id, $template_id, $email_frequncy, $email_day_or_hour ) );
3007
  $wcal_all_ids = '';
3008
  foreach ( $wcal_updated_get_id as $wcal_updated_get_id_key => $wcal_updated_get_id_value ) {
3009
  # code...
3024
  }
3025
  $query_update = "UPDATE `" . $wpdb->prefix . "ac_email_templates_lite`
3026
  SET
3027
+ is_active = %s
3028
+ WHERE id = %s";
3029
+ $wpdb->query( $wpdb->prepare($query_update, $active, $template_id ) );
3030
  wp_die();
3031
 
3032
  }