WooCommerce Cart Abandonment Recovery - Version 1.2.15

Version Description

Download this release

Release Info

Developer cartflowswp
Plugin Icon 128x128 WooCommerce Cart Abandonment Recovery
Version 1.2.15
Comparing to
See all releases

Code changes from version 1.2.14 to 1.2.15

changelog.txt CHANGED
@@ -1,4 +1,7 @@
1
- Version 1.2.14 - Tuesday, 5th April 2022
 
 
 
2
  - New: Added cron cutoff time option in settings.
3
  Note: If you are using the custom code to update the cron time then please remove it & update same in new option.
4
  - New: Added an option to append the query parameters to recovery link.
1
+ Version 1.2.15 - Thursday, 21st April 2022
2
+ - Improvement: Handled WordPress database error while creating tables on plugin activation.
3
+
4
+ Version 1.2.14 - Tuesday, 05th April 2022
5
  - New: Added cron cutoff time option in settings.
6
  Note: If you are using the custom code to update the cron time then please remove it & update same in new option.
7
  - New: Added an option to append the query parameters to recovery link.
classes/class-cartflows-ca-loader.php CHANGED
@@ -70,7 +70,6 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
70
  add_action( 'plugins_loaded', array( $this, 'load_plugin' ), 99 );
71
 
72
  add_action( 'plugins_loaded', array( $this, 'load_cf_textdomain' ) );
73
-
74
  }
75
 
76
  /**
@@ -82,7 +81,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
82
  define( 'CARTFLOWS_CA_BASE', plugin_basename( CARTFLOWS_CA_FILE ) );
83
  define( 'CARTFLOWS_CA_DIR', plugin_dir_path( CARTFLOWS_CA_FILE ) );
84
  define( 'CARTFLOWS_CA_URL', plugins_url( '/', CARTFLOWS_CA_FILE ) );
85
- define( 'CARTFLOWS_CA_VER', '1.2.14' );
86
 
87
  define( 'CARTFLOWS_CA_SLUG', 'cartflows_ca' );
88
 
@@ -106,6 +105,11 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
106
  return;
107
  }
108
 
 
 
 
 
 
109
  $this->load_helper_files_components();
110
  $this->load_core_files();
111
  $this->load_core_components();
@@ -121,6 +125,21 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
121
  }
122
 
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
 
125
 
126
  /**
70
  add_action( 'plugins_loaded', array( $this, 'load_plugin' ), 99 );
71
 
72
  add_action( 'plugins_loaded', array( $this, 'load_cf_textdomain' ) );
 
73
  }
74
 
75
  /**
81
  define( 'CARTFLOWS_CA_BASE', plugin_basename( CARTFLOWS_CA_FILE ) );
82
  define( 'CARTFLOWS_CA_DIR', plugin_dir_path( CARTFLOWS_CA_FILE ) );
83
  define( 'CARTFLOWS_CA_URL', plugins_url( '/', CARTFLOWS_CA_FILE ) );
84
+ define( 'CARTFLOWS_CA_VER', '1.2.15' );
85
 
86
  define( 'CARTFLOWS_CA_SLUG', 'cartflows_ca' );
87
 
105
  return;
106
  }
107
 
108
+ if ( 'no' === get_option( 'wcf_ca_all_db_tables_created', false ) ) {
109
+ add_action( 'admin_notices', array( $this, 'fails_to_create_table' ) );
110
+ return;
111
+ }
112
+
113
  $this->load_helper_files_components();
114
  $this->load_core_files();
115
  $this->load_core_components();
125
  }
126
 
127
 
128
+ /**
129
+ * Show error notice when all of the required database tables are not created.
130
+ *
131
+ * @since 1.2.15
132
+ *
133
+ * @return void
134
+ */
135
+ public function fails_to_create_table() {
136
+
137
+ $class = 'notice notice-error';
138
+ /* translators: %s: html tags */
139
+ $message = sprintf( __( 'Required database tables are not created for %1$sWooCommerce Cart Abandonment Recovery%2$s plugin. Please make sure that the database user has the REFERENCES privilege to create tables.', 'woo-cart-abandonment-recovery' ), '<strong>', '</strong>' );
140
+
141
+ printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), wp_kses_post( $message ) );
142
+ }
143
 
144
 
145
  /**
languages/woo-cart-abandonment-recovery.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the WooCommerce Cart Abandonment Recovery plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Cart Abandonment Recovery 1.2.14\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-cart-abandonment-recovery\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2022-04-05T04:18:35+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: woo-cart-abandonment-recovery\n"
@@ -92,15 +92,20 @@ msgid "I already did"
92
  msgstr ""
93
 
94
  #. translators: %s: html tags
95
- #: classes/class-cartflows-ca-loader.php:143
 
 
 
 
 
96
  msgid "The %1$sWooCommerce Cart Abandonment Recovery%2$s plugin requires %1$sWooCommerce%2$s plugin installed & activated."
97
  msgstr ""
98
 
99
- #: classes/class-cartflows-ca-loader.php:152
100
  msgid "Activate WooCommerce"
101
  msgstr ""
102
 
103
- #: classes/class-cartflows-ca-loader.php:160
104
  msgid "Install WooCommerce"
105
  msgstr ""
106
 
@@ -229,12 +234,12 @@ msgid "Auto-create the special coupon for the abandoned cart to send over the em
229
  msgstr ""
230
 
231
  #: classes/class-cartflows-ca-settings.php:285
232
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:544
233
  msgid "Discount Type"
234
  msgstr ""
235
 
236
  #: classes/class-cartflows-ca-settings.php:294
237
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:576
238
  msgid "Coupon Amount"
239
  msgstr ""
240
 
@@ -283,14 +288,14 @@ msgid "Add UTM parameter per line."
283
  msgstr ""
284
 
285
  #: classes/class-cartflows-ca-settings.php:539
286
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:614
287
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:710
288
  msgid "Hour(s)"
289
  msgstr ""
290
 
291
  #: classes/class-cartflows-ca-settings.php:540
292
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:615
293
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:711
294
  msgid "Day(s)"
295
  msgstr ""
296
 
@@ -499,134 +504,138 @@ msgid "Trigger Failed."
499
  msgstr ""
500
 
501
  #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:147
502
- msgid "Please verify webhook URL."
503
  msgstr ""
504
 
505
  #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:148
 
 
 
 
506
  msgid "Webhook URL is required."
507
  msgstr ""
508
 
509
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:169
510
  msgid "Something went wrong"
511
  msgstr ""
512
 
513
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:176
514
  msgid "Activated"
515
  msgstr ""
516
 
517
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:179
518
  msgid "Deactivated"
519
  msgstr ""
520
 
521
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:239
522
  msgid "The Email Template has been successfully added."
523
  msgstr ""
524
 
525
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:249
526
  msgid "The Email Template has been cloned successfully."
527
  msgstr ""
528
 
529
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:259
530
  msgid "The Email Template has been successfully deleted."
531
  msgstr ""
532
 
533
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:268
534
  msgid "The Email Template has been successfully updated."
535
  msgstr ""
536
 
537
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:278
538
  msgid "Default Email Templates has been restored successfully."
539
  msgstr ""
540
 
541
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:445
542
  msgid "Activate Template now?"
543
  msgstr ""
544
 
545
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:465
546
  msgid "Template Name:"
547
  msgstr ""
548
 
549
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:480
550
  msgid "Email Subject:"
551
  msgstr ""
552
 
553
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:495
554
  msgid "Email Body:"
555
  msgstr ""
556
 
557
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:524
558
  msgid "Create Coupon"
559
  msgstr ""
560
 
561
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:537
562
  msgid "Allows you to send new coupon only for this template."
563
  msgstr ""
564
 
565
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:594
566
  msgid "Coupon expiry date"
567
  msgstr ""
568
 
569
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:624
570
  msgid "Enter zero (0) to restrict coupon from expiring"
571
  msgstr ""
572
 
573
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:630
574
  msgid "Free Shipping"
575
  msgstr ""
576
 
577
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:643
578
  msgid "Allows you to grant free shipping. A free shipping method must be enabled in your shipping zone and be set to require \"a valid free shipping coupon\". "
579
  msgstr ""
580
 
581
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:650
582
  msgid "Individual use only"
583
  msgstr ""
584
 
585
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:664
586
  msgid "Check this box if the coupon cannot be used in conjunction with other coupons."
587
  msgstr ""
588
 
589
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:671
590
  msgid "Auto Apply Coupon"
591
  msgstr ""
592
 
593
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:685
594
  msgid " Automatically add the coupon to the cart at the checkout."
595
  msgstr ""
596
 
597
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:691
598
  msgid "Send This Email"
599
  msgstr ""
600
 
601
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:709
602
  msgid "Minute(s)"
603
  msgstr ""
604
 
605
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:724
606
  msgid "after cart is abandoned."
607
  msgstr ""
608
 
609
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:734
610
  msgid "Send Test Email To:"
611
  msgstr ""
612
 
613
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:738
614
  msgid "Send a test email"
615
  msgstr ""
616
 
617
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:751
618
  msgid "Save Changes"
619
  msgstr ""
620
 
621
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:753
622
  msgid "Update Changes"
623
  msgstr ""
624
 
625
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:1059
626
  msgid "Create New Template"
627
  msgstr ""
628
 
629
- #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:1062
630
  msgid " Restore Default Templates"
631
  msgstr ""
632
 
2
  # This file is distributed under the same license as the WooCommerce Cart Abandonment Recovery plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Cart Abandonment Recovery 1.2.15\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-cart-abandonment-recovery\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2022-04-20T09:41:25+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: woo-cart-abandonment-recovery\n"
92
  msgstr ""
93
 
94
  #. translators: %s: html tags
95
+ #: classes/class-cartflows-ca-loader.php:138
96
+ msgid "Required database tables are not generated for %1$sWooCommerce Cart Abandonment Recovery%2$s. Please make sure that the DB user has the REFERENCES privilege to create tables."
97
+ msgstr ""
98
+
99
+ #. translators: %s: html tags
100
+ #: classes/class-cartflows-ca-loader.php:161
101
  msgid "The %1$sWooCommerce Cart Abandonment Recovery%2$s plugin requires %1$sWooCommerce%2$s plugin installed & activated."
102
  msgstr ""
103
 
104
+ #: classes/class-cartflows-ca-loader.php:170
105
  msgid "Activate WooCommerce"
106
  msgstr ""
107
 
108
+ #: classes/class-cartflows-ca-loader.php:178
109
  msgid "Install WooCommerce"
110
  msgstr ""
111
 
234
  msgstr ""
235
 
236
  #: classes/class-cartflows-ca-settings.php:285
237
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:545
238
  msgid "Discount Type"
239
  msgstr ""
240
 
241
  #: classes/class-cartflows-ca-settings.php:294
242
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:577
243
  msgid "Coupon Amount"
244
  msgstr ""
245
 
288
  msgstr ""
289
 
290
  #: classes/class-cartflows-ca-settings.php:539
291
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:615
292
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:711
293
  msgid "Hour(s)"
294
  msgstr ""
295
 
296
  #: classes/class-cartflows-ca-settings.php:540
297
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:616
298
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:712
299
  msgid "Day(s)"
300
  msgstr ""
301
 
504
  msgstr ""
505
 
506
  #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:147
507
+ msgid "Trigger Success."
508
  msgstr ""
509
 
510
  #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:148
511
+ msgid "Please verify webhook URL."
512
+ msgstr ""
513
+
514
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:149
515
  msgid "Webhook URL is required."
516
  msgstr ""
517
 
518
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:170
519
  msgid "Something went wrong"
520
  msgstr ""
521
 
522
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:177
523
  msgid "Activated"
524
  msgstr ""
525
 
526
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:180
527
  msgid "Deactivated"
528
  msgstr ""
529
 
530
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:240
531
  msgid "The Email Template has been successfully added."
532
  msgstr ""
533
 
534
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:250
535
  msgid "The Email Template has been cloned successfully."
536
  msgstr ""
537
 
538
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:260
539
  msgid "The Email Template has been successfully deleted."
540
  msgstr ""
541
 
542
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:269
543
  msgid "The Email Template has been successfully updated."
544
  msgstr ""
545
 
546
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:279
547
  msgid "Default Email Templates has been restored successfully."
548
  msgstr ""
549
 
550
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:446
551
  msgid "Activate Template now?"
552
  msgstr ""
553
 
554
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:466
555
  msgid "Template Name:"
556
  msgstr ""
557
 
558
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:481
559
  msgid "Email Subject:"
560
  msgstr ""
561
 
562
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:496
563
  msgid "Email Body:"
564
  msgstr ""
565
 
566
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:525
567
  msgid "Create Coupon"
568
  msgstr ""
569
 
570
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:538
571
  msgid "Allows you to send new coupon only for this template."
572
  msgstr ""
573
 
574
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:595
575
  msgid "Coupon expiry date"
576
  msgstr ""
577
 
578
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:625
579
  msgid "Enter zero (0) to restrict coupon from expiring"
580
  msgstr ""
581
 
582
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:631
583
  msgid "Free Shipping"
584
  msgstr ""
585
 
586
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:644
587
  msgid "Allows you to grant free shipping. A free shipping method must be enabled in your shipping zone and be set to require \"a valid free shipping coupon\". "
588
  msgstr ""
589
 
590
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:651
591
  msgid "Individual use only"
592
  msgstr ""
593
 
594
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:665
595
  msgid "Check this box if the coupon cannot be used in conjunction with other coupons."
596
  msgstr ""
597
 
598
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:672
599
  msgid "Auto Apply Coupon"
600
  msgstr ""
601
 
602
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:686
603
  msgid " Automatically add the coupon to the cart at the checkout."
604
  msgstr ""
605
 
606
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:692
607
  msgid "Send This Email"
608
  msgstr ""
609
 
610
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:710
611
  msgid "Minute(s)"
612
  msgstr ""
613
 
614
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:725
615
  msgid "after cart is abandoned."
616
  msgstr ""
617
 
618
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:735
619
  msgid "Send Test Email To:"
620
  msgstr ""
621
 
622
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:739
623
  msgid "Send a test email"
624
  msgstr ""
625
 
626
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:752
627
  msgid "Save Changes"
628
  msgstr ""
629
 
630
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:754
631
  msgid "Update Changes"
632
  msgstr ""
633
 
634
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:1060
635
  msgid "Create New Template"
636
  msgstr ""
637
 
638
+ #: modules/cart-abandonment/classes/class-cartflows-ca-email-templates.php:1063
639
  msgid " Restore Default Templates"
640
  msgstr ""
641
 
modules/cart-abandonment/classes/class-cartflows-ca-database.php CHANGED
@@ -41,14 +41,42 @@ class Cartflows_Ca_Database {
41
  $this->create_cart_abandonment_template_table();
42
  $this->create_email_templates_meta_table();
43
  $this->create_email_history_table();
 
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * Create Email templates meta table.
48
  */
49
  public function create_email_templates_meta_table() {
50
  global $wpdb;
51
 
 
 
52
  $email_template_meta_db = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_META_TABLE;
53
  $cart_abandonment_template_db = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
54
  $charset_collate = $wpdb->get_charset_collate();
@@ -75,13 +103,15 @@ class Cartflows_Ca_Database {
75
 
76
  global $wpdb;
77
 
 
 
78
  $cart_abandonment_db = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
79
  $charset_collate = $wpdb->get_charset_collate();
80
 
81
  // Cart abandonment tracking db sql command.
82
  $sql = "CREATE TABLE IF NOT EXISTS $cart_abandonment_db (
83
  id BIGINT(20) NOT NULL AUTO_INCREMENT,
84
- checkout_id int(11) NOT NULL,
85
  email VARCHAR(100),
86
  cart_contents LONGTEXT,
87
  cart_total DECIMAL(10,2),
@@ -107,6 +137,8 @@ class Cartflows_Ca_Database {
107
 
108
  global $wpdb;
109
 
 
 
110
  $cart_abandonment_template_db = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
111
 
112
  $charset_collate = $wpdb->get_charset_collate();
@@ -135,6 +167,8 @@ class Cartflows_Ca_Database {
135
 
136
  global $wpdb;
137
 
 
 
138
  $cart_abandonment_history_db = $wpdb->prefix . CARTFLOWS_CA_EMAIL_HISTORY_TABLE;
139
  $cart_abandonment_db = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
140
  $cart_abandonment_template_db = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
@@ -147,7 +181,7 @@ class Cartflows_Ca_Database {
147
  `ca_session_id` VARCHAR(60),
148
  `coupon_code` VARCHAR(50),
149
  `scheduled_time` DATETIME,
150
- `email_sent` boolean DEFAULT 0,
151
  PRIMARY KEY (`id`),
152
  FOREIGN KEY ( `template_id` ) REFERENCES $cart_abandonment_template_db(`id`) ON DELETE CASCADE,
153
  FOREIGN KEY ( `ca_session_id` ) REFERENCES $cart_abandonment_db(`session_id`) ON DELETE CASCADE
@@ -196,47 +230,54 @@ class Cartflows_Ca_Database {
196
  ),
197
  );
198
 
 
199
  // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
200
  $template_index = 1;
201
  $template_meta_index = 1;
202
- foreach ( $email_templates as $email_template ) {
203
- $wpdb->query(
204
- $wpdb->prepare(
205
- "INSERT INTO $cart_abandonment_template_db (`id`, `template_name`, `email_subject`, `email_body`, `frequency`, `frequency_unit`)
206
- VALUES ( %d, %s, %s, %s, %d, %s )",
207
- $force_restore ? null : $template_index++,
208
- $email_template['template_name'],
209
- $email_template['subject'],
210
- $email_template['body'],
211
- $email_template['frequency'],
212
- $email_template['frequency_unit']
213
- )
214
- );
215
-
216
- $meta_data = array(
217
- 'override_global_coupon' => false,
218
- 'discount_type' => 'percent',
219
- 'coupon_amount' => 10,
220
- 'coupon_expiry_date' => '',
221
- 'coupon_expiry_unit' => 'hours',
222
- );
223
-
224
- $email_tmpl_id = $wpdb->insert_id;
225
-
226
- foreach ( $meta_data as $meta_key => $meta_value ) {
227
  $wpdb->query(
228
  $wpdb->prepare(
229
- "INSERT INTO $cart_abandonment_template_meta_db ( `id`, `email_template_id`, `meta_key`, `meta_value` )
230
- VALUES ( %d, %d, %s, %s )",
231
- $force_restore ? null : $template_meta_index++,
232
- $email_tmpl_id,
233
- $meta_key,
234
- $meta_value
 
 
235
  )
236
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  }
 
238
  }
239
- // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
240
  }
241
 
242
  }
41
  $this->create_cart_abandonment_template_table();
42
  $this->create_email_templates_meta_table();
43
  $this->create_email_history_table();
44
+ $this->check_if_all_table_created();
45
  }
46
 
47
+ /**
48
+ * Check if tables created.
49
+ */
50
+ public function check_if_all_table_created() {
51
+
52
+ global $wpdb;
53
+
54
+ $required_tables = array(
55
+ CARTFLOWS_CA_CART_ABANDONMENT_TABLE,
56
+ CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE,
57
+ CARTFLOWS_CA_EMAIL_HISTORY_TABLE,
58
+ CARTFLOWS_CA_EMAIL_TEMPLATE_META_TABLE,
59
+ );
60
+
61
+ delete_option( 'wcf_ca_all_db_tables_created' );
62
+
63
+ foreach ( $required_tables as $table ) {
64
+ $is_table_exist = $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}{$table}'" ); //phpcs:ignore
65
+ if ( empty( $is_table_exist ) ) {
66
+ update_option( 'wcf_ca_all_db_tables_created', 'no' );
67
+ break;
68
+ }
69
+ }
70
+
71
+ }
72
  /**
73
  * Create Email templates meta table.
74
  */
75
  public function create_email_templates_meta_table() {
76
  global $wpdb;
77
 
78
+ $wpdb->hide_errors();
79
+
80
  $email_template_meta_db = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_META_TABLE;
81
  $cart_abandonment_template_db = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
82
  $charset_collate = $wpdb->get_charset_collate();
103
 
104
  global $wpdb;
105
 
106
+ $wpdb->hide_errors();
107
+
108
  $cart_abandonment_db = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
109
  $charset_collate = $wpdb->get_charset_collate();
110
 
111
  // Cart abandonment tracking db sql command.
112
  $sql = "CREATE TABLE IF NOT EXISTS $cart_abandonment_db (
113
  id BIGINT(20) NOT NULL AUTO_INCREMENT,
114
+ checkout_id int(11) NOT NULL,
115
  email VARCHAR(100),
116
  cart_contents LONGTEXT,
117
  cart_total DECIMAL(10,2),
137
 
138
  global $wpdb;
139
 
140
+ $wpdb->hide_errors();
141
+
142
  $cart_abandonment_template_db = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
143
 
144
  $charset_collate = $wpdb->get_charset_collate();
167
 
168
  global $wpdb;
169
 
170
+ $wpdb->hide_errors();
171
+
172
  $cart_abandonment_history_db = $wpdb->prefix . CARTFLOWS_CA_EMAIL_HISTORY_TABLE;
173
  $cart_abandonment_db = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
174
  $cart_abandonment_template_db = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
181
  `ca_session_id` VARCHAR(60),
182
  `coupon_code` VARCHAR(50),
183
  `scheduled_time` DATETIME,
184
+ `email_sent` boolean DEFAULT 0,
185
  PRIMARY KEY (`id`),
186
  FOREIGN KEY ( `template_id` ) REFERENCES $cart_abandonment_template_db(`id`) ON DELETE CASCADE,
187
  FOREIGN KEY ( `ca_session_id` ) REFERENCES $cart_abandonment_db(`session_id`) ON DELETE CASCADE
230
  ),
231
  );
232
 
233
+ $wpdb->hide_errors();
234
  // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
235
  $template_index = 1;
236
  $template_meta_index = 1;
237
+
238
+ $is_email_template_table = $wpdb->get_var( "SHOW TABLES LIKE '{$cart_abandonment_template_db}'" );
239
+ $is_email_template_meta_table = $wpdb->get_var( "SHOW TABLES LIKE '{$cart_abandonment_template_meta_db}'" );
240
+
241
+ if ( ! empty( $is_email_template_table ) && ! empty( $is_email_template_meta_table ) ) {
242
+ foreach ( $email_templates as $email_template ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  $wpdb->query(
244
  $wpdb->prepare(
245
+ "INSERT INTO $cart_abandonment_template_db (`id`, `template_name`, `email_subject`, `email_body`, `frequency`, `frequency_unit`)
246
+ VALUES ( %d, %s, %s, %s, %d, %s )",
247
+ $force_restore ? null : $template_index++,
248
+ $email_template['template_name'],
249
+ $email_template['subject'],
250
+ $email_template['body'],
251
+ $email_template['frequency'],
252
+ $email_template['frequency_unit']
253
  )
254
  );
255
+
256
+ $meta_data = array(
257
+ 'override_global_coupon' => false,
258
+ 'discount_type' => 'percent',
259
+ 'coupon_amount' => 10,
260
+ 'coupon_expiry_date' => '',
261
+ 'coupon_expiry_unit' => 'hours',
262
+ );
263
+
264
+ $email_tmpl_id = $wpdb->insert_id;
265
+
266
+ foreach ( $meta_data as $meta_key => $meta_value ) {
267
+ $wpdb->query(
268
+ $wpdb->prepare(
269
+ "INSERT INTO $cart_abandonment_template_meta_db ( `id`, `email_template_id`, `meta_key`, `meta_value` )
270
+ VALUES ( %d, %d, %s, %s )",
271
+ $force_restore ? null : $template_meta_index++,
272
+ $email_tmpl_id,
273
+ $meta_key,
274
+ $meta_value
275
+ )
276
+ );
277
+ }
278
  }
279
+ // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
280
  }
 
281
  }
282
 
283
  }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: sujaypawar, wpcrafter
3
  Tags: woocommerce, cart abandonment, cart recovery
4
  Requires at least: 5.4
5
- Tested up to: 5.9.2
6
- Stable tag: 1.2.14
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -128,7 +128,10 @@ Here are few thoughts behind making it available for free:
128
 
129
  == Changelog ==
130
 
131
- = Version 1.2.14 - Tuesday, 5th April 2022 =
 
 
 
132
  * New: Added cron cutoff time option in settings.
133
  Note: If you are using the custom code to update the cron time then please remove it & update same in new option.
134
  * New: Added an option to append the query parameters to recovery link.
2
  Contributors: sujaypawar, wpcrafter
3
  Tags: woocommerce, cart abandonment, cart recovery
4
  Requires at least: 5.4
5
+ Tested up to: 5.9.3
6
+ Stable tag: 1.2.15
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
128
 
129
  == Changelog ==
130
 
131
+ = Version 1.2.15 - Thursday, 21st April 2022 =
132
+ * Improvement: Handled WordPress database error while creating tables on plugin activation.
133
+
134
+ = Version 1.2.14 - Tuesday, 05th April 2022 =
135
  * New: Added cron cutoff time option in settings.
136
  Note: If you are using the custom code to update the cron time then please remove it & update same in new option.
137
  * New: Added an option to append the query parameters to recovery link.
woo-cart-abandonment-recovery.php CHANGED
@@ -3,12 +3,12 @@
3
  * Plugin Name: WooCommerce Cart Abandonment Recovery
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Recover your lost revenue. Capture email address of users on the checkout page and send follow up emails if they don't complete the purchase.
6
- * Version: 1.2.14
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: woo-cart-abandonment-recovery
10
  * WC requires at least: 3.0
11
- * WC tested up to: 6.3.1
12
  *
13
  * @package Woocommerce-Cart-Abandonment-Recovery
14
  */
3
  * Plugin Name: WooCommerce Cart Abandonment Recovery
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Recover your lost revenue. Capture email address of users on the checkout page and send follow up emails if they don't complete the purchase.
6
+ * Version: 1.2.15
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: woo-cart-abandonment-recovery
10
  * WC requires at least: 3.0
11
+ * WC tested up to: 6.4.1
12
  *
13
  * @package Woocommerce-Cart-Abandonment-Recovery
14
  */