Abandoned Cart Lite for WooCommerce - Version 3.2

Version Description

Download this release

Release Info

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

Code changes from version 2.6 to 3.2

Files changed (52) hide show
  1. css/view.abadoned.orders.style.css → assets/css/view.abandoned.orders.style.css +43 -43
  2. {images → assets/images}/abandoned_cart_small.png +0 -0
  3. {images → assets/images}/ac_editor_icon.png +0 -0
  4. {images → assets/images}/ac_tab_icon.png +0 -0
  5. {images → assets/images}/check.jpg +0 -0
  6. {images → assets/images}/copy.png +0 -0
  7. {images → assets/images}/delete.png +0 -0
  8. {images → assets/images}/edit.png +0 -0
  9. {images → assets/images}/handbag.jpg +0 -0
  10. {images → assets/images}/shoes.jpg +0 -0
  11. {images → assets/images}/spectre.jpg +0 -0
  12. {js → assets/js}/abandoncart_plugin_button.js +65 -58
  13. {js → assets/js}/jquery.tipTip.minified.js +20 -20
  14. class-abandoned-orders-table.php +0 -438
  15. class-product-report-table.php +0 -301
  16. class-recover-orders-table.php +0 -404
  17. class-templates-table.php +0 -295
  18. cron/send_email.php +0 -447
  19. cron/wcal_send_email.php +481 -0
  20. {languages → i18n/languages}/messages.pot +268 -268
  21. {languages → i18n/languages}/woocommerce-ac-de_DE.mo +0 -0
  22. {languages → i18n/languages}/woocommerce-ac-de_DE.po +283 -283
  23. {languages → i18n/languages}/woocommerce-ac-he_IL.mo +0 -0
  24. {languages → i18n/languages}/woocommerce-ac-he_IL.po +281 -281
  25. {languages → i18n/languages}/woocommerce-ac-sk_SK.mo +0 -0
  26. {languages → i18n/languages}/woocommerce-ac-sk_SK.po +283 -283
  27. {languages → i18n/languages}/woocommerce-ac.mo +0 -0
  28. {languages → i18n/languages}/woocommerce-ac.po +269 -269
  29. includes/classes/class-wcal-abandoned-orders-table.php +392 -0
  30. includes/classes/class-wcal-aes-counter.php +170 -0
  31. includes/classes/class-wcal-aes.php +190 -0
  32. includes/classes/class-wcal-product-report-table.php +256 -0
  33. includes/classes/class-wcal-recover-orders-table.php +371 -0
  34. includes/classes/class-wcal-templates-table.php +260 -0
  35. actions.php → includes/wcal_actions.php +45 -45
  36. includes/wcal_class-guest.php +235 -0
  37. default-settings.php → includes/wcal_default-settings.php +54 -56
  38. pagination.class.php +0 -204
  39. readme.txt +248 -195
  40. screenshot-1.png +0 -0
  41. screenshot-2.png +0 -0
  42. screenshot-3.png +0 -0
  43. screenshot-4.png +0 -0
  44. screenshot-5.png +0 -0
  45. views/wacp-email-template-preview.php +0 -52
  46. views/wacp-wc-email-template-preview.php +0 -47
  47. views/wcal-email-template-preview.php +50 -0
  48. views/wcal-wc-email-template-preview.php +45 -0
  49. woo-includes/class-wc-dependencies.php +0 -29
  50. woo-includes/woo-functions.php +0 -97
  51. woocommerce-ac.php +2977 -2713
  52. woocommerce_guest_ac.class.php +0 -208
css/view.abadoned.orders.style.css → assets/css/view.abandoned.orders.style.css RENAMED
@@ -1,44 +1,44 @@
1
- /* Decrease the width of the Id column */
2
- table.wp-list-table .column-id {
3
- width:5%;
4
- }
5
- /* Decrease the width of the cutomer name column
6
- table.wp-list-table .column-customer {
7
- width:12%;
8
- }*/
9
- /* Decrease the width of the email column*/
10
- table.wp-list-table .column-email {
11
- width:15%;
12
- }
13
-
14
- /* Decrease the width of the abandoned order date column */
15
- table.wp-list-table .column-date {
16
- width:20%;
17
- }
18
-
19
- /* Decrease the width of the abandoned order total column */
20
- table.wp-list-table .column-order_total {
21
- width:20%;
22
- }
23
-
24
- /* This is for the new cart and checkout button in tinymce */
25
- #woocommerce_ac_email_body_abandoncart_email_variables_css{
26
-
27
- width : 60px !important;
28
- }
29
-
30
- span.mce_abandoncart_email_variables_css {
31
-
32
- width : 60px !important;
33
- }
34
-
35
- /* Decrease the width of the sr column in templates tab */
36
- table.wp-list-table .column-sr {
37
- width:4% !important;
38
- }
39
-
40
- i.mce-i-abandoncart_email_variables {
41
- background-image: url(../images/ac_editor_icon.png) ;
42
- width: 30px;
43
- height: 30px;
44
  }
1
+ /* Decrease the width of the Id column */
2
+ table.wp-list-table .column-id {
3
+ width:5%;
4
+ }
5
+ /* Decrease the width of the cutomer name column
6
+ table.wp-list-table .column-customer {
7
+ width:12%;
8
+ }*/
9
+ /* Decrease the width of the email column*/
10
+ table.wp-list-table .column-email {
11
+ width:15%;
12
+ }
13
+
14
+ /* Decrease the width of the abandoned order date column */
15
+ table.wp-list-table .column-date {
16
+ width:20%;
17
+ }
18
+
19
+ /* Decrease the width of the abandoned order total column */
20
+ table.wp-list-table .column-order_total {
21
+ width:20%;
22
+ }
23
+
24
+ /* This is for the new cart and checkout button in tinymce */
25
+ #woocommerce_ac_email_body_abandoncart_email_variables_css{
26
+
27
+ width : 60px !important;
28
+ }
29
+
30
+ span.mce_abandoncart_email_variables_css {
31
+
32
+ width : 60px !important;
33
+ }
34
+
35
+ /* Decrease the width of the sr column in templates tab */
36
+ table.wp-list-table .column-sr {
37
+ width:4% !important;
38
+ }
39
+
40
+ i.mce-i-abandoncart_email_variables {
41
+ background-image: url(../images/ac_editor_icon.png) ;
42
+ width: 30px;
43
+ height: 30px;
44
  }
{images → assets/images}/abandoned_cart_small.png RENAMED
File without changes
{images → assets/images}/ac_editor_icon.png RENAMED
File without changes
{images → assets/images}/ac_tab_icon.png RENAMED
File without changes
{images → assets/images}/check.jpg RENAMED
File without changes
{images → assets/images}/copy.png RENAMED
File without changes
{images → assets/images}/delete.png RENAMED
File without changes
{images → assets/images}/edit.png RENAMED
File without changes
{images → assets/images}/handbag.jpg RENAMED
File without changes
{images → assets/images}/shoes.jpg RENAMED
File without changes
{images → assets/images}/spectre.jpg RENAMED
File without changes
{js → assets/js}/abandoncart_plugin_button.js RENAMED
@@ -1,59 +1,66 @@
1
- (function() {
2
-
3
- tinymce.PluginManager.add('abandoncart', function(editor, url) {
4
-
5
-
6
- editor.addButton('abandoncart', {
7
- type: 'menubutton',
8
- text: false,
9
- icon: "abandoncart_email_variables",
10
- menu: [
11
- {
12
- text: 'Customer First Name',
13
- value: '{{customer.firstname}}',
14
- onclick: function() {
15
- editor.insertContent(this.value());
16
- }
17
- },
18
- {
19
- text: 'Customer Last Name',
20
- value: '{{customer.lastname}}',
21
- onclick: function() {
22
- editor.insertContent(this.value());
23
- }
24
- },
25
- {
26
- text: 'Customer Full Name',
27
- value: '{{customer.fullname}}',
28
- onclick: function() {
29
- editor.insertContent(this.value());
30
- }
31
- },
32
- {
33
- text: 'Product Information/Cart Content',
34
- value: '{{products.cart}}',
35
- onclick: function() {
36
- editor.insertContent(this.value());
37
- }
38
- },
39
- {
40
- text: 'Cart Link',
41
- value: '{{cart.link}}',
42
- onclick: function() {
43
- editor.insertContent(this.value());
44
- }
45
- },
46
- {
47
- text: 'Date when Cart was abandoned',
48
- value: '{{cart.abandoned_date}}',
49
- onclick: function() {
50
- editor.insertContent(this.value());
51
- }
52
- }
53
-
54
- ]
55
- });
56
-
57
- });
58
-
 
 
 
 
 
 
 
59
  })();
1
+ (function() {
2
+
3
+ tinymce.PluginManager.add('abandoncart', function(editor, url) {
4
+
5
+
6
+ editor.addButton('abandoncart', {
7
+ type: 'menubutton',
8
+ text: false,
9
+ icon: "abandoncart_email_variables",
10
+ menu: [
11
+ {
12
+ text: 'Customer First Name',
13
+ value: '{{customer.firstname}}',
14
+ onclick: function() {
15
+ editor.insertContent(this.value());
16
+ }
17
+ },
18
+ {
19
+ text: 'Customer Last Name',
20
+ value: '{{customer.lastname}}',
21
+ onclick: function() {
22
+ editor.insertContent(this.value());
23
+ }
24
+ },
25
+ {
26
+ text: 'Customer Full Name',
27
+ value: '{{customer.fullname}}',
28
+ onclick: function() {
29
+ editor.insertContent(this.value());
30
+ }
31
+ },
32
+ {
33
+ text: 'Product Information/Cart Content',
34
+ value: '{{products.cart}}',
35
+ onclick: function() {
36
+ editor.insertContent(this.value());
37
+ }
38
+ },
39
+ {
40
+ text: 'Cart Link',
41
+ value: '{{cart.link}}',
42
+ onclick: function() {
43
+ editor.insertContent(this.value());
44
+ }
45
+ },
46
+ {
47
+ text: 'Date when Cart was abandoned',
48
+ value: '{{cart.abandoned_date}}',
49
+ onclick: function() {
50
+ editor.insertContent(this.value());
51
+ }
52
+ },
53
+ {
54
+ text: 'Unsubscribe Link',
55
+ value: '{{cart.unsubscribe}}',
56
+ onclick: function() {
57
+ editor.insertContent(this.value());
58
+ }
59
+ }
60
+
61
+ ]
62
+ });
63
+
64
+ });
65
+
66
  })();
{js → assets/js}/jquery.tipTip.minified.js RENAMED
@@ -1,21 +1,21 @@
1
- /*
2
- * TipTip
3
- * Copyright 2010 Drew Wilson
4
- * www.drewwilson.com
5
- * code.drewwilson.com/entry/tiptip-jquery-plugin
6
- *
7
- * Version 1.3 - Updated: Mar. 23, 2010
8
- *
9
- * This Plug-In will create a custom tooltip to replace the default
10
- * browser tooltip. It is extremely lightweight and very smart in
11
- * that it detects the edges of the browser window and will make sure
12
- * the tooltip stays within the current window size. As a result the
13
- * tooltip will adjust itself to be displayed above, below, to the left
14
- * or to the right depending on what is necessary to stay within the
15
- * browser window. It is completely customizable as well via CSS.
16
- *
17
- * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
18
- * http://www.opensource.org/licenses/mit-license.php
19
- * http://www.gnu.org/licenses/gpl.html
20
- */
21
  (function($){$.fn.tipTip=function(options){var defaults={activation:"hover",keepAlive:false,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:false,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=$('<div id="tiptip_content"></div>');var tiptip_arrow=$('<div id="tiptip_arrow"></div>');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')))}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow")}return this.each(function(){var org_elem=$(this);if(opts.content){var org_title=opts.content}else{var org_title=org_elem.attr(opts.attribute)}if(org_title!=""){if(!opts.content){org_elem.removeAttr(opts.attribute)}var timeout=false;if(opts.activation=="hover"){org_elem.hover(function(){active_tiptip()},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}else if(opts.activation=="focus"){org_elem.focus(function(){active_tiptip()}).blur(function(){deactive_tiptip()})}else if(opts.activation=="click"){org_elem.click(function(){active_tiptip();return false}).hover(function(){},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}function active_tiptip(){opts.enter.call(this);tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(opts.defaultPosition=="bottom"){t_class="_bottom"}else if(opts.defaultPosition=="top"){t_class="_top"}else if(opts.defaultPosition=="left"){t_class="_left"}else if(opts.defaultPosition=="right"){t_class="_right"}var right_compare=(w_compare+left)<parseInt($(window).scrollLeft());var left_compare=(tip_w+left)>parseInt($(window).width());if((right_compare&&w_compare<0)||(t_class=="_right"&&!left_compare)||(t_class=="_left"&&left<(tip_w+opts.edgeOffset+5))){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare)}else if((left_compare&&w_compare<0)||(t_class=="_left"&&!right_compare)){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare)}var top_compare=(top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop());var bottom_compare=((top+org_height)-(opts.edgeOffset+tip_h+8))<0;if(top_compare||(t_class=="_bottom"&&top_compare)||(t_class=="_top"&&!bottom_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_top"}else{t_class=t_class+"_top"}arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset))}else if(bottom_compare|(t_class=="_top"&&bottom_compare)||(t_class=="_bottom"&&!top_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_bottom"}else{t_class=t_class+"_bottom"}arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset)}if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5}if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5}tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout)}timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn)},opts.delay)}function deactive_tiptip(){opts.exit.call(this);if(timeout){clearTimeout(timeout)}tiptip_holder.fadeOut(opts.fadeOut)}}})}})(jQuery);
1
+ /*
2
+ * TipTip
3
+ * Copyright 2010 Drew Wilson
4
+ * www.drewwilson.com
5
+ * code.drewwilson.com/entry/tiptip-jquery-plugin
6
+ *
7
+ * Version 1.3 - Updated: Mar. 23, 2010
8
+ *
9
+ * This Plug-In will create a custom tooltip to replace the default
10
+ * browser tooltip. It is extremely lightweight and very smart in
11
+ * that it detects the edges of the browser window and will make sure
12
+ * the tooltip stays within the current window size. As a result the
13
+ * tooltip will adjust itself to be displayed above, below, to the left
14
+ * or to the right depending on what is necessary to stay within the
15
+ * browser window. It is completely customizable as well via CSS.
16
+ *
17
+ * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
18
+ * http://www.opensource.org/licenses/mit-license.php
19
+ * http://www.gnu.org/licenses/gpl.html
20
+ */
21
  (function($){$.fn.tipTip=function(options){var defaults={activation:"hover",keepAlive:false,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:false,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=$('<div id="tiptip_content"></div>');var tiptip_arrow=$('<div id="tiptip_arrow"></div>');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')))}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow")}return this.each(function(){var org_elem=$(this);if(opts.content){var org_title=opts.content}else{var org_title=org_elem.attr(opts.attribute)}if(org_title!=""){if(!opts.content){org_elem.removeAttr(opts.attribute)}var timeout=false;if(opts.activation=="hover"){org_elem.hover(function(){active_tiptip()},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}else if(opts.activation=="focus"){org_elem.focus(function(){active_tiptip()}).blur(function(){deactive_tiptip()})}else if(opts.activation=="click"){org_elem.click(function(){active_tiptip();return false}).hover(function(){},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}function active_tiptip(){opts.enter.call(this);tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(opts.defaultPosition=="bottom"){t_class="_bottom"}else if(opts.defaultPosition=="top"){t_class="_top"}else if(opts.defaultPosition=="left"){t_class="_left"}else if(opts.defaultPosition=="right"){t_class="_right"}var right_compare=(w_compare+left)<parseInt($(window).scrollLeft());var left_compare=(tip_w+left)>parseInt($(window).width());if((right_compare&&w_compare<0)||(t_class=="_right"&&!left_compare)||(t_class=="_left"&&left<(tip_w+opts.edgeOffset+5))){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare)}else if((left_compare&&w_compare<0)||(t_class=="_left"&&!right_compare)){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare)}var top_compare=(top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop());var bottom_compare=((top+org_height)-(opts.edgeOffset+tip_h+8))<0;if(top_compare||(t_class=="_bottom"&&top_compare)||(t_class=="_top"&&!bottom_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_top"}else{t_class=t_class+"_top"}arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset))}else if(bottom_compare|(t_class=="_top"&&bottom_compare)||(t_class=="_bottom"&&!top_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_bottom"}else{t_class=t_class+"_bottom"}arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset)}if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5}if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5}tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout)}timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn)},opts.delay)}function deactive_tiptip(){opts.exit.call(this);if(timeout){clearTimeout(timeout)}tiptip_holder.fadeOut(opts.fadeOut)}}})}})(jQuery);
class-abandoned-orders-table.php DELETED
@@ -1,438 +0,0 @@
1
- <?php
2
-
3
- // Load WP_List_Table if not loaded
4
- if ( ! class_exists( 'WP_List_Table' ) ) {
5
- require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
6
- }
7
-
8
- class WACP_Abandoned_Orders_Table extends WP_List_Table {
9
-
10
- /**
11
- * Number of results to show per page
12
- *
13
- * @var string
14
- * @since 2.5.2
15
- */
16
- public $per_page = 30;
17
-
18
- /**
19
- * URL of this page
20
- *
21
- * @var string
22
- * @since 2.5.2
23
- */
24
- public $base_url;
25
-
26
- /**
27
- * Total number of bookings
28
- *
29
- * @var int
30
- * @since 2.5.2
31
- */
32
- public $total_count;
33
-
34
- /**
35
- * Get things started
36
- *
37
- * @see WP_List_Table::__construct()
38
- */
39
- public function __construct() {
40
-
41
- global $status, $page;
42
-
43
- // Set parent defaults
44
- parent::__construct( array(
45
- 'singular' => __( 'abandoned_order_id', 'woocommerce-ac' ), //singular name of the listed records
46
- 'plural' => __( 'abandoned_order_ids', 'woocommerce-ac' ), //plural name of the listed records
47
- 'ajax' => false // Does this table support ajax?
48
- ) );
49
- $this->wcap_get_abadoned_orders_count_lite();
50
- $this->process_bulk_action();
51
- $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page' );
52
- }
53
-
54
- public function wcap_abadoned_order_prepare_items() {
55
-
56
- $columns = $this->get_columns();
57
- $hidden = array(); // No hidden columns
58
- $sortable = $this->get_sortable_columns();
59
- $data = $this->wacp_abandoned_cart_lite_data();
60
-
61
- $this->_column_headers = array( $columns, $hidden, $sortable);
62
- $total_items = $this->total_count;
63
-
64
- if ( count($data) > 0 ){
65
- $this->items = $data;
66
- }else{
67
- $this->items = '';
68
- }
69
- $this->set_pagination_args( array(
70
- 'total_items' => $total_items, // WE have to calculate the total number of items
71
- 'per_page' => $this->per_page, // WE have to determine how many items to show on a page
72
- 'total_pages' => ceil( $total_items / $this->per_page ) // WE have to calculate the total number of pages
73
- )
74
- );
75
- }
76
-
77
- public function get_columns() {
78
-
79
-
80
- $columns = array();
81
- $columns = array(
82
- 'cb' => '<input type="checkbox" />',
83
- 'id' => __( 'Id', 'woocommerce-ac' ),
84
- 'email' => __( 'Email Address', 'woocommerce-ac' ),
85
- 'customer' => __( 'Customer', 'woocommerce-ac' ),
86
- 'order_total' => __( 'Order Total', 'woocommerce-ac' ),
87
- 'date' => __( 'Abandoned Date', 'woocommerce-ac' ),
88
- 'status' => __( 'Status of Cart', 'woocommerce-ac' )
89
- );
90
-
91
- return apply_filters( 'wcap_abandoned_orders_columns', $columns );
92
- }
93
-
94
- /***
95
- * It is used to add the check box for the items
96
- */
97
- function column_cb( $item ){
98
-
99
- $abadoned_order_id = '';
100
- if( isset($item->id) && "" != $item->id ){
101
- $abadoned_order_id = $item->id;
102
- }
103
- return sprintf(
104
- '<input type="checkbox" name="%1$s[]" value="%2$s" />',
105
- 'abandoned_order_id',
106
- $abadoned_order_id
107
- );
108
- }
109
-
110
- public function get_sortable_columns() {
111
- $columns = array(
112
- 'date' => array( 'date', false ),
113
- 'status' => array( 'status',false),
114
- );
115
- return apply_filters( 'wcap_abandoned_orders_sortable_columns', $columns );
116
- }
117
-
118
- /**
119
- * Render the Email Column
120
- *
121
- * @access public
122
- * @since 2.4.8
123
- * @param array $abadoned_row_info Contains all the data of the abandoned order tabs row
124
- * @return string Data shown in the Email column
125
- *
126
- * This function used for individual delete of row, It is for hover effect delete.
127
- */
128
- public function column_email( $abadoned_row_info ) {
129
-
130
- $row_actions = array();
131
- $value = '';
132
- $abadoned_order_id = 0;
133
- if( isset($abadoned_row_info->email) ){
134
-
135
- $abadoned_order_id = $abadoned_row_info->id ;
136
- $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( 'action' => 'wcap_delete', 'abandoned_order_id' => $abadoned_row_info->id ), $this->base_url ), 'abandoned_order_nonce') . '">' . __( 'Delete', 'woocommerce-ac' ) . '</a>';
137
-
138
- $email = $abadoned_row_info->email;
139
-
140
- $value = $email . $this->row_actions( $row_actions );
141
-
142
- }
143
-
144
- return apply_filters( 'wcap_abandoned_orders_single_column', $value, $abadoned_order_id, 'email' );
145
- }
146
-
147
- /***
148
- * This function used to get the abadoned orders count
149
- */
150
- public function wcap_get_abadoned_orders_count_lite() {
151
-
152
- global $wpdb;
153
- $results = array();
154
-
155
- $blank_cart_info = '{"cart":[]}';
156
- $blank_cart_info_guest = '[]';
157
-
158
- // non-multisite - regular table name
159
- $query = "SELECT wpac . * , wpu.user_login, wpu.user_email
160
- FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac
161
- LEFT JOIN ".$wpdb->base_prefix."users AS wpu ON wpac.user_id = wpu.id
162
- WHERE recovered_cart = '0'
163
- AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' ORDER BY wpac.abandoned_cart_time DESC";
164
-
165
- $results = $wpdb->get_results($query);
166
-
167
- $abadoned_orders = count($results);
168
- $this->total_count = $abadoned_orders;
169
- }
170
- public function wacp_abandoned_cart_lite_data() {
171
- global $wpdb;
172
-
173
- $return_bookings = array();
174
- $per_page = $this->per_page;
175
- $results = array();
176
-
177
- $blank_cart_info = '{"cart":[]}';
178
- $blank_cart_info_guest = '[]';
179
-
180
- // non-multisite - regular table name
181
- $query = "SELECT wpac . * , wpu.user_login, wpu.user_email
182
- FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac
183
- LEFT JOIN ".$wpdb->base_prefix."users AS wpu ON wpac.user_id = wpu.id
184
- WHERE recovered_cart = '0'
185
- AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' ORDER BY wpac.abandoned_cart_time DESC";
186
-
187
- $results = $wpdb->get_results($query);
188
-
189
- $i = 0;
190
-
191
- foreach ( $results as $key => $value ) {
192
-
193
- $return_abadoned_orders[$i] = new stdClass();
194
-
195
- if ( $value->user_type == "GUEST" ) {
196
- $query_guest = "SELECT * from `" . $wpdb->prefix . "ac_guest_abandoned_cart_history_lite` WHERE id = %d";
197
- $results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $value->user_id ) );
198
- }
199
- $abandoned_order_id = $value->id;
200
- $user_id = $value->user_id;
201
- $user_login = $value->user_login;
202
-
203
- if ( $value->user_type == "GUEST" ) {
204
-
205
- if ( isset( $results_guest[0]->email_id ) ) $user_email = $results_guest[0]->email_id;
206
-
207
- if ( isset( $results_guest[0]->billing_first_name ) ) $user_first_name = $results_guest[0]->billing_first_name;
208
- else $user_first_name = "";
209
-
210
- if ( isset( $results_guest[0]->billing_last_name ) ) $user_last_name = $results_guest[0]->billing_last_name;
211
- else $user_last_name = "";
212
-
213
- } else {
214
-
215
- $user_email_temp = get_user_meta($value->user_id, 'billing_email');
216
- if ( isset( $user_email_temp[0] ) ) {
217
- $user_email = $user_email_temp[0];
218
- }else {
219
- $user_email = "";
220
- }
221
-
222
- $user_first_name_temp = get_user_meta($value->user_id, 'first_name');
223
- if ( isset( $user_first_name_temp[0] ) ) {
224
- $user_first_name = $user_first_name_temp[0];
225
- }else {
226
- $user_first_name = "";
227
- }
228
-
229
- $user_last_name_temp = get_user_meta($value->user_id, 'last_name');
230
- if ( isset( $user_last_name_temp[0] ) ) {
231
- $user_last_name = $user_last_name_temp[0];
232
- }else {
233
- $user_last_name = "";
234
- }
235
- }
236
-
237
- $cart_info = json_decode( $value->abandoned_cart_info );
238
- $order_date = "";
239
- $cart_update_time = $value->abandoned_cart_time;
240
-
241
- if ( $cart_update_time != "" && $cart_update_time != 0 ) {
242
- $order_date = date( 'd M, Y h:i A', $cart_update_time );
243
- }
244
-
245
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
246
- $cut_off_time = $ac_cutoff_time * 60;
247
- $current_time = current_time( 'timestamp' );
248
- $compare_time = $current_time - $cart_update_time;
249
- $cart_details = array();
250
- if( isset( $cart_info->cart ) ){
251
- $cart_details = $cart_info->cart;
252
- }
253
- $line_total = 0;
254
-
255
- if ( count( $cart_details ) > 0 ) {
256
-
257
- foreach ( $cart_details as $k => $v ) {
258
-
259
- if( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
260
- $line_total = $line_total + $v->line_total + $v->line_subtotal_tax;
261
- } else {
262
- $line_total = $line_total + $v->line_total;
263
- }
264
- }
265
- }
266
- $line_total = round( $line_total, 2 );
267
- $quantity_total = 0;
268
-
269
- if ( count( $cart_details ) > 0) {
270
-
271
- foreach ( $cart_details as $k => $v ) {
272
- $quantity_total = $quantity_total + $v->quantity;
273
- }
274
- }
275
-
276
- if ( 1 == $quantity_total ) {
277
- $item_disp = __("item", "woocommerce-ac");
278
- } else {
279
- $item_disp = __("items", "woocommerce-ac");
280
- }
281
-
282
- if( $value->cart_ignored == 0 && $value->recovered_cart == 0 ) {
283
- $ac_status = __("Abandoned", "woocommerce-ac");
284
- } elseif( $value->cart_ignored == 1 && $value->recovered_cart == 0 ) {
285
- $ac_status = __("Abandoned but new","woocommerce-ac")."</br>". __("cart created after this", "woocommerce-ac");
286
- } else {
287
- $ac_status = "";
288
- }
289
-
290
- if ( $compare_time > $cut_off_time && $ac_status != "" ) {
291
-
292
- if( $quantity_total > 0 ) {
293
-
294
- $abandoned_order_id = $abandoned_order_id;
295
- $customer_information = $user_first_name . " ".$user_last_name;
296
- $return_abadoned_orders[ $i ]->id = $abandoned_order_id;
297
- $return_abadoned_orders[ $i ]->email = $user_email;
298
- $return_abadoned_orders[ $i ]->customer = $customer_information;
299
- $return_abadoned_orders[ $i ]->order_total = get_woocommerce_currency_symbol() . "" . $line_total;
300
- $return_abadoned_orders[ $i ]->date = $order_date;
301
- $return_abadoned_orders[ $i ]->status = $ac_status;
302
-
303
- }
304
- $i++;
305
- }
306
-
307
- }
308
-
309
- // sort for order date
310
- if (isset($_GET['orderby']) && $_GET['orderby'] == 'date') {
311
- if (isset($_GET['order']) && $_GET['order'] == 'asc') {
312
- usort( $return_abadoned_orders, array( __CLASS__ ,"wcap_class_order_date_asc") );
313
- }
314
- else {
315
- usort( $return_abadoned_orders, array( __CLASS__ ,"wcap_class_order_date_dsc") );
316
- }
317
- }
318
-
319
- // sort for customer name
320
- else if ( isset( $_GET['orderby']) && $_GET['orderby'] == 'status' ) {
321
- if ( isset( $_GET['order'] ) && $_GET['order'] == 'asc' ) {
322
- usort( $return_abadoned_orders, array( __CLASS__ ,"wcap_class_status_asc" ) );
323
- }
324
- else {
325
- usort( $return_abadoned_orders, array( __CLASS__ ,"wcap_class_status_dsc" ) );
326
- }
327
- }
328
-
329
- if (isset($_GET['paged']) && $_GET['paged'] > 1) {
330
- $page_number = $_GET['paged'] - 1;
331
- $k = $per_page * $page_number;
332
- }
333
- else {
334
- $k = 0;
335
- }
336
- $return_abadoned_orders_display = array();
337
- for ($j = $k;$j < ($k+$per_page);$j++) {
338
- if (isset($return_abadoned_orders[$j])) {
339
- $return_abadoned_orders_display[$j] = $return_abadoned_orders[$j];
340
- }
341
- else {
342
- break;
343
- }
344
- }
345
- return apply_filters( 'wcap_abandoned_orders_table_data', $return_abadoned_orders_display );
346
- }
347
- function wcap_class_order_date_asc($value1,$value2) {
348
-
349
- $date_two = $date_one = '';
350
- $value_one = $value1->date;
351
- $value_two = $value2->date;
352
-
353
- $date_formatted_one = date_create_from_format( 'd M, Y h:i A', $value_one );
354
- if ( isset( $date_formatted_one ) && $date_formatted_one != '' ) {
355
- $date_one = date_format( $date_formatted_one, 'Y-m-d' );
356
- }
357
-
358
- $date_formatted_two = date_create_from_format( 'd M, Y h:i A', $value_two );
359
- if ( isset( $date_formatted_two ) && $date_formatted_two != '' ) {
360
- $date_two = date_format( $date_formatted_two, 'Y-m-d' );
361
- }
362
- return strtotime($date_one) - strtotime($date_two);
363
- }
364
- function wcap_class_order_date_dsc($value1,$value2) {
365
-
366
- $date_two = $date_one = '';
367
- $value_one = $value1->date;
368
- $value_two = $value2->date;
369
-
370
- $date_formatted_one = date_create_from_format( 'd M, Y h:i A', $value_one );
371
- if ( isset( $date_formatted_one ) && $date_formatted_one != '' ) {
372
- $date_one = date_format( $date_formatted_one, 'Y-m-d' );
373
- }
374
-
375
- $date_formatted_two = date_create_from_format( 'd M, Y h:i A', $value_two );
376
- if ( isset( $date_formatted_two ) && $date_formatted_two != '' ) {
377
- $date_two = date_format( $date_formatted_two, 'Y-m-d' );
378
- }
379
-
380
- return strtotime($date_two) - strtotime($date_one);
381
- }
382
-
383
- function wcap_class_status_asc($value1,$value2) {
384
- return strcasecmp($value1->status,$value2->status );
385
- }
386
-
387
- function wcap_class_status_dsc ($value1,$value2) {
388
- return strcasecmp($value2->status,$value1->status );
389
- }
390
-
391
- public function column_default( $wcap_abadoned_orders, $column_name ) {
392
- $value = '';
393
- switch ( $column_name ) {
394
- case 'id' :
395
- if(isset($wcap_abadoned_orders->id)){
396
- $value = '<strong><a href="admin.php?page=woocommerce_ac_page&action=orderdetails&id='.$wcap_abadoned_orders->id.' ">'.$wcap_abadoned_orders->id.'</a> </strong>';
397
- }
398
- break;
399
- case 'customer' :
400
- if(isset($wcap_abadoned_orders->customer)){
401
- $value = $wcap_abadoned_orders->customer;
402
- }
403
- break;
404
-
405
- case 'order_total' :
406
- if(isset($wcap_abadoned_orders->order_total)){
407
- $value = $wcap_abadoned_orders->order_total;
408
- }
409
- break;
410
-
411
- case 'date' :
412
- if(isset($wcap_abadoned_orders->date)){
413
- $value = $wcap_abadoned_orders->date;
414
- }
415
- break;
416
-
417
- case 'status' :
418
- if(isset($wcap_abadoned_orders->status)){
419
- $value = $wcap_abadoned_orders->status;
420
- }
421
- break;
422
-
423
- default:
424
-
425
- $value = isset( $booking->$column_name ) ? $booking->$column_name : '';
426
- break;
427
- }
428
-
429
- return apply_filters( 'wcap_abandoned_orders_column_default', $value, $wcap_abadoned_orders, $column_name );
430
- }
431
-
432
- public function get_bulk_actions() {
433
- return array(
434
- 'wcap_delete' => __( 'Delete', 'woocommerce-ac' )
435
- );
436
- }
437
- }
438
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class-product-report-table.php DELETED
@@ -1,301 +0,0 @@
1
- <?php
2
-
3
- if( session_id() === '' ){
4
- //session has not started
5
- session_start();
6
- }
7
-
8
-
9
- // Load WP_List_Table if not loaded
10
- if ( ! class_exists( 'WP_List_Table' ) ) {
11
- require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
12
- }
13
-
14
- class WACP_Product_Report_Table extends WP_List_Table {
15
-
16
- /**
17
- * Number of results to show per page
18
- *
19
- * @var string
20
- * @since 2.5.3
21
- */
22
- public $per_page = 30;
23
-
24
- /**
25
- * URL of this page
26
- *
27
- * @var string
28
- * @since 2.5.3
29
- */
30
- public $base_url;
31
-
32
- /**
33
- * Total number of recovred orders
34
- *
35
- * @var int
36
- * @since 2.5.3
37
- */
38
- public $total_count;
39
-
40
-
41
- /**
42
- * Total number of recovred orders
43
- *
44
- * @var int
45
- * @since 2.5.3
46
- */
47
- public $open_emails;
48
-
49
- /**
50
- * Total amount of abadoned orders
51
- *
52
- * @var int
53
- * @since 2.5.3
54
- */
55
- public $link_click_count;
56
-
57
- /**
58
- * Total number recovred orders
59
- *
60
- * @var int
61
- * @since 2.5.3
62
- */
63
- public $start_date_db;
64
-
65
- /**
66
- * Total number recovred orders total
67
- *
68
- * @var int
69
- * @since 2.5.3
70
- */
71
- public $end_date_db;
72
-
73
- public $duration;
74
-
75
- /**
76
- * Get things started
77
- *
78
- * @see WP_List_Table::__construct()
79
- */
80
- public function __construct() {
81
-
82
- global $status, $page;
83
-
84
- // Set parent defaults
85
- parent::__construct( array(
86
- 'singular' => __( 'product_id', 'woocommerce-ac' ), //singular name of the listed records
87
- 'plural' => __( 'product_ids', 'woocommerce-ac' ), //plural name of the listed records
88
- 'ajax' => false // Does this table support ajax?
89
- ) );
90
-
91
- $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=stats' );
92
- }
93
-
94
- public function wcap_product_report_prepare_items_lite() {
95
-
96
- $columns = $this->get_columns();
97
- $hidden = array(); // No hidden columns
98
-
99
- //$sortable = $this->product_report_sortable_columns();
100
-
101
- $data = $this->wacp_product_report_lite_data ();
102
-
103
- $total_items = $this->total_count;
104
- $this->items = $data;
105
-
106
- //$this->_column_headers = array( $columns, $hidden, $sortable);
107
- $this->_column_headers = array( $columns, $hidden);
108
- $this->set_pagination_args( array(
109
- 'total_items' => $total_items, // WE have to calculate the total number of items
110
- 'per_page' => $this->per_page, // WE have to determine how many items to show on a page
111
- 'total_pages' => ceil( $total_items / $this->per_page ) // WE have to calculate the total number of pages
112
- )
113
- );
114
-
115
- }
116
-
117
- public function get_columns() {
118
-
119
- $columns = array(
120
-
121
- 'product_name' => __( 'Product Name', 'woocommerce-ac' ),
122
- 'abandoned_number' => __( 'Number of Times Abandoned', 'woocommerce-ac' ),
123
- 'recover_number' => __( 'Number of Times Recovered', 'woocommerce-ac' )
124
-
125
- );
126
-
127
- return apply_filters( 'wcap_product_report_columns', $columns );
128
- }
129
-
130
- // public function product_report_sortable_columns() {
131
- // $columns = array(
132
- // 'abandoned_number' => array( 'abandoned_number', false ),
133
- // 'recover_number' => array( 'recover_number',false),
134
- // );
135
- // return apply_filters( 'wcap_product_report_columns', $columns );
136
- // }
137
- /**
138
- * Render the user name Column
139
- *
140
- * @access public
141
- * @since 2.5.3
142
- * @param array $abadoned_row_info Contains all the data of the template row
143
- * @return string Data shown in the Email column
144
- *
145
- * This function used for individual delete of row, It is for hover effect delete.
146
- */
147
- public function wacp_product_report_lite_data () {
148
- global $wpdb;
149
-
150
- $wcap_class = new woocommerce_abandon_cart ();
151
- $i = 1;
152
-
153
- $order = "desc";
154
- $query = "SELECT abandoned_cart_time, abandoned_cart_info, recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` ORDER BY recovered_cart DESC";
155
- $recover_query = $wpdb->get_results( $query );
156
- $rec_carts_array = array ( );
157
- $recover_product_array = array( );
158
-
159
- foreach ( $recover_query as $recovered_cart_key => $recovered_cart_value ) {
160
- $recovered_cart_info = json_decode( $recovered_cart_value->abandoned_cart_info );
161
- $recovered_cart_dat = json_decode( $recovered_cart_value->recovered_cart);
162
- $order_date = "";
163
- $cart_update_time = $recovered_cart_value->abandoned_cart_time;
164
- $quantity_total = 0;
165
- $cart_details = array();
166
- if( isset( $recovered_cart_info->cart ) ){
167
- $cart_details = $recovered_cart_info->cart;
168
- }
169
- if ( count( $cart_details ) > 0) {
170
-
171
- foreach ( $cart_details as $k => $v ) {
172
-
173
- $quantity_total = $quantity_total + $v->quantity;
174
- }
175
- }
176
-
177
- if ( $cart_update_time != "" && $cart_update_time != 0 ) {
178
- $order_date = date( 'd M, Y h:i A', $cart_update_time );
179
- }
180
- $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
181
- $cut_off_time = $ac_cutoff_time * 60 ;
182
- $current_time = current_time( 'timestamp' );
183
- $compare_time = $current_time - $cart_update_time;
184
- if ( is_array( $recovered_cart_info ) || is_object( $recovered_cart_info ) ) {
185
- foreach ( $recovered_cart_info as $rec_cart_key => $rec_cart_value ) {
186
- foreach ( $rec_cart_value as $rec_product_id_key => $rec_product_id_value ) {
187
- $product_id = $rec_product_id_value->product_id;
188
- if ( $compare_time > $cut_off_time ) {
189
- $rec_carts_array [] = $product_id;
190
- }
191
- if($recovered_cart_dat != 0) {
192
- $recover_product_array[] = $product_id;
193
-
194
-
195
- }
196
- }
197
- }
198
- }
199
- }
200
-
201
- $count = array_count_values( $rec_carts_array );
202
- $count1 = $count;
203
- $count_new = $wcap_class->bubble_sort_function ( $count1 ,$order );
204
- $recover_cart = "0";
205
- $count_css = 0;
206
- $chunck_array = array_chunk( $count_new,10, true ); // keep True for retaing the Array Index number which is product ids in our case.
207
-
208
- $chunck_array_value = array();
209
-
210
- foreach ( $chunck_array as $chunck_array_key => $chunck_array_value ) {
211
-
212
- foreach ( $chunck_array_value as $k => $v){
213
-
214
- $return_product_report[$i] = new stdClass();
215
-
216
- $prod_name = get_post( $k );
217
- $product_name = $prod_name->post_title;
218
- $abandoned_count = $v;
219
- $recover = array_count_values( $recover_product_array );
220
- foreach ( $recover as $ke => $ve ) {
221
- if( array_key_exists ( $ke, $count ) ) {
222
-
223
- if ( $ke == $k ) {
224
- $recover_cart = $ve;
225
- }
226
- }
227
- if( ! array_key_exists ( $k, $recover ) ) {
228
- $recover_cart = "0";
229
- }
230
- }
231
-
232
- $return_product_report[ $i ]->product_name = $product_name ;
233
- $return_product_report[ $i ]->abandoned_number = $abandoned_count;
234
- $return_product_report[ $i ]->recover_number = $recover_cart;
235
- $return_product_report[ $i ]->product_id = $k;
236
- $i++;
237
-
238
- }
239
- }
240
-
241
- $this->total_count = count ( $chunck_array_value ) > 0 ? count ( $chunck_array_value ) : 0 ;
242
-
243
-
244
- $per_page = $this->per_page;
245
-
246
- if ( isset( $_GET['paged'] ) && $_GET['paged'] > 1 ) {
247
- $page_number = $_GET['paged'] - 1;
248
- $k = $per_page * $page_number;
249
- }else {
250
- $k = 1;
251
- }
252
-
253
- $return_product_report_display = array();
254
-
255
-
256
- for ( $j = $k; $j < ( $k + $per_page ); $j++ ) {
257
-
258
- if ( isset( $return_product_report[ $j ] ) ) {
259
- $return_product_report_display[ $j ] = $return_product_report[ $j ];
260
- }else {
261
- break;
262
- }
263
- }
264
-
265
-
266
-
267
- return apply_filters( 'wcap_product_report_table_data', $return_product_report_display );
268
- }
269
-
270
- public function column_default( $wcap_sent_emails, $column_name ) {
271
- $value = '';
272
- switch ( $column_name ) {
273
-
274
- case 'product_name' :
275
- if(isset($wcap_sent_emails->product_name)){
276
-
277
- $value = "<a href= post.php?post=$wcap_sent_emails->product_id&action=edit title = product name > $wcap_sent_emails->product_name </a>";
278
- }
279
- break;
280
-
281
- case 'abandoned_number' :
282
- if(isset($wcap_sent_emails->abandoned_number)){
283
- $value = $wcap_sent_emails->abandoned_number;
284
- }
285
- break;
286
-
287
- case 'recover_number' :
288
- if(isset($wcap_sent_emails->recover_number)){
289
- $value = $wcap_sent_emails->recover_number;
290
- }
291
- break;
292
- default:
293
-
294
- $value = isset( $wcap_sent_emails->$column_name ) ? $wcap_sent_emails->$column_name : '';
295
- break;
296
- }
297
-
298
- return apply_filters( 'wcap_product_report_column_default', $value, $wcap_sent_emails, $column_name );
299
- }
300
- }
301
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class-recover-orders-table.php DELETED
@@ -1,404 +0,0 @@
1
- <?php
2
-
3
- // Load WP_List_Table if not loaded
4
- if ( ! class_exists( 'WP_List_Table' ) ) {
5
- require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
6
- }
7
-
8
- class WACP_Recover_Orders_Table extends WP_List_Table {
9
-
10
- /**
11
- * Number of results to show per page
12
- *
13
- * @var string
14
- * @since 2.5.2
15
- */
16
- public $per_page = 30;
17
-
18
- /**
19
- * URL of this page
20
- *
21
- * @var string
22
- * @since 2.5.2
23
- */
24
- public $base_url;
25
-
26
- /**
27
- * Total number of recovred orders
28
- *
29
- * @var int
30
- * @since 2.5.2
31
- */
32
- public $total_count;
33
-
34
-
35
- /**
36
- * Total number of recovred orders
37
- *
38
- * @var int
39
- * @since 2.5.2
40
- */
41
- public $total_abandoned_cart_count;
42
-
43
- /**
44
- * Total amount of abadoned orders
45
- *
46
- * @var int
47
- * @since 2.5.2
48
- */
49
- public $total_order_amount;
50
-
51
- /**
52
- * Total number recovred orders
53
- *
54
- * @var int
55
- * @since 2.5.2
56
- */
57
- public $recovered_item;
58
-
59
- /**
60
- * Total number recovred orders total
61
- *
62
- * @var int
63
- * @since 2.5.2
64
- */
65
- public $total_recover_amount;
66
-
67
-
68
- /**
69
- * Get things started
70
- *
71
- * @see WP_List_Table::__construct()
72
- */
73
- public function __construct() {
74
-
75
- global $status, $page;
76
-
77
- // Set parent defaults
78
- parent::__construct( array(
79
- 'singular' => __( 'rec_abandoned_id', 'woocommerce-ac' ), //singular name of the listed records
80
- 'plural' => __( 'rec_abandoned_ids', 'woocommerce-ac' ), //plural name of the listed records
81
- 'ajax' => false // Does this table support ajax?
82
- ) );
83
- $this->wcap_get_recovered_orders_count_lite();
84
-
85
- $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=stats' );
86
- }
87
-
88
- public function wcap_recovered_orders_prepare_items_lite() {
89
-
90
- $columns = $this->get_columns();
91
- $hidden = array(); // No hidden columns
92
- $sortable = $this->recovered_orders_get_sortable_columns();
93
- $data = $this->wacp_recovered_orders_data_lite();
94
-
95
- $total_items = $this->total_count;
96
- $total_abandoned_cart_count = $this->total_abandoned_cart_count;
97
- $total_order_amount = $this->total_order_amount;
98
- $total_recover_amount = $this->total_recover_amount;
99
- $recovered_item = $this->recovered_item;
100
- $this->items = $data;
101
-
102
- $this->_column_headers = array( $columns, $hidden, $sortable);
103
-
104
- $this->set_pagination_args( array(
105
- 'total_items' => $total_items, // WE have to calculate the total number of items
106
- 'per_page' => $this->per_page, // WE have to determine how many items to show on a page
107
- 'total_pages' => ceil( $total_items / $this->per_page ) // WE have to calculate the total number of pages
108
- )
109
- );
110
- }
111
-
112
- public function get_columns() {
113
-
114
- $columns = array(
115
-
116
- 'user_name' => __( 'User Name', 'woocommerce-ac' ),
117
- 'user_email_id' => __( 'User Email Address', 'woocommerce-ac' ),
118
- 'created_on' => __( 'Cart Abandoned Date', 'woocommerce-ac' ),
119
- 'recovered_date' => __( 'Cart Recovered Date' , 'woocommerce-ac'),
120
- 'order_total' => __( 'Order Total', 'woocommerce-ac' )
121
-
122
- );
123
-
124
- return apply_filters( 'wcap_recovered_orders_columns', $columns );
125
- }
126
-
127
- public function recovered_orders_get_sortable_columns() {
128
- $columns = array(
129
- 'created_on' => array( 'created_on', false ),
130
- 'recovered_date' => array( 'recovered_date',false)
131
- );
132
- return apply_filters( 'wcap_templates_sortable_columns', $columns );
133
- }
134
-
135
- /**
136
- * Render the user name Column
137
- *
138
- * @access public
139
- * @since 2.5.2
140
- * @param array $abadoned_row_info Contains all the data of the template row
141
- * @return string Data shown in the Email column
142
- *
143
- * This function used for individual delete of row, It is for hover effect delete.
144
- */
145
- public function column_user_name( $recovered_orders_row_info ) {
146
-
147
- $row_actions = array();
148
- $value = '';
149
- $recovered_id = 0;
150
-
151
- if( isset($recovered_orders_row_info->user_name ) ){
152
- $recovered_id = $recovered_orders_row_info->recovered_id ;
153
- $row_actions['view_details'] = "<a target=_blank href = post.php?post=$recovered_id&action=edit>". __( 'View Details', 'woocommerce-ac' )."</a>";
154
- $user_name = $recovered_orders_row_info->user_name;
155
- $value = $user_name . $this->row_actions( $row_actions );
156
- }
157
-
158
- return apply_filters( 'wcap_recovered_orders_single_column', $value, $recovered_id, 'email' );
159
- }
160
-
161
- /***
162
- * This function used to get the abadoned orders count
163
- */
164
- public function wcap_get_recovered_orders_count_lite() {
165
-
166
- global $wpdb;
167
-
168
- if ( isset( $_POST['start_date'] ) ) $start_date_range = $_POST['start_date'];
169
- else $start_date_range = "";
170
-
171
- if ( isset( $_POST['end_date'] ) ) $end_date_range = $_POST['end_date'];
172
- else $end_date_range = "";
173
-
174
- $start_date = strtotime( $start_date_range." 00:01:01" );
175
- $end_date = strtotime( $end_date_range." 23:59:59" );
176
-
177
- $query_ac = "SELECT * FROM " . $wpdb->prefix . "ac_abandoned_cart_history_lite WHERE abandoned_cart_time >= %d AND abandoned_cart_time <= %d AND recovered_cart > 0 ORDER BY recovered_cart desc";
178
- $ac_results = $wpdb->get_results( $wpdb->prepare( $query_ac, $start_date, $end_date ) );
179
-
180
- $templates_count = count($ac_results);
181
- $this->total_count = $templates_count;
182
- }
183
-
184
- public function wacp_recovered_orders_data_lite() {
185
- global $wpdb;
186
-
187
- $wcap_class = new woocommerce_abandon_cart ();
188
-
189
- if ( isset( $_POST['duration_select'] ) ) $duration_range = $_POST['duration_select'];
190
- else $duration_range = "";
191
-
192
- if ( $duration_range == "" ) {
193
-
194
- if ( isset( $_GET['duration_select'] ) ) $duration_range = $_GET['duration_select'];
195
- }
196
-
197
- if ( $duration_range == "" ) $duration_range = "last_seven";
198
- else $duration_range = "";
199
-
200
- if ( isset( $_POST['start_date'] ) ) $start_date_range = $_POST['start_date'];
201
- else $start_date_range = "";
202
-
203
- if ( $start_date_range == "" ) {
204
-
205
-
206
- $start_date_range = $wcap_class->start_end_dates[$duration_range]['start_date'];
207
-
208
- }
209
-
210
- if ( isset( $_POST['end_date'] ) ) $end_date_range = $_POST['end_date'];
211
- else $end_date_range = "";
212
-
213
- if ( $end_date_range == "" ) {
214
- $end_date_range = $wcap_class->start_end_dates[$duration_range]['end_date'];
215
- }
216
-
217
- $start_date = strtotime( $start_date_range." 00:01:01" );
218
- $end_date = strtotime( $end_date_range." 23:59:59" );
219
-
220
- $query_ac = "SELECT * FROM " . $wpdb->prefix . "ac_abandoned_cart_history_lite WHERE abandoned_cart_time >= %d AND abandoned_cart_time <= %d AND recovered_cart > 0 ORDER BY recovered_cart desc";
221
- $ac_results = $wpdb->get_results( $wpdb->prepare( $query_ac, $start_date, $end_date ) );
222
-
223
- $query_ac_carts = "SELECT * FROM " . $wpdb->prefix . "ac_abandoned_cart_history_lite WHERE abandoned_cart_time >= %d AND abandoned_cart_time <= %d ";
224
- $ac_carts_results = $wpdb->get_results( $wpdb->prepare( $query_ac_carts, $start_date, $end_date ) );
225
-
226
- $recovered_item = $recovered_total = $count_carts = $total_value = $order_total = 0;
227
-
228
- $return_recovered_orders = array();
229
- $per_page = $this->per_page;
230
- $i = 1;
231
-
232
-
233
- foreach ( $ac_carts_results as $key => $value ) {
234
-
235
- $count_carts += 1;
236
- $cart_detail = json_decode( $value->abandoned_cart_info );
237
- $product_details = array();
238
- if( isset( $cart_detail->cart ) ){
239
- $product_details = $cart_detail->cart;
240
- }
241
- $line_total = 0;
242
-
243
- if ( isset( $product_details ) && count( $product_details ) > 0 && $product_details != false ) {
244
-
245
- foreach ( $product_details as $k => $v ) {
246
-
247
- if( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
248
- $line_total = $line_total + $v->line_total + $v->line_subtotal_tax;
249
- } else {
250
- $line_total = $line_total + $v->line_total;
251
- }
252
- }
253
- }
254
- $total_value += $line_total;
255
-
256
- }
257
- $total_value = round( $total_value, 2 );
258
-
259
-
260
- $this->total_order_amount = $total_value ;
261
- $this->total_abandoned_cart_count = $count_carts ;
262
-
263
- $recovered_order_total = 0;
264
-
265
- $this->total_recover_amount = round( $recovered_order_total, 2 ) ;
266
-
267
-
268
- $table_data = "";
269
-
270
- foreach ( $ac_results as $key => $value ) {
271
-
272
-
273
- if( $value->recovered_cart != 0 ) {
274
-
275
- $return_recovered_orders[$i] = new stdClass();
276
-
277
- $recovered_id = $value->recovered_cart;
278
- $rec_order = get_post_meta( $recovered_id );
279
- $woo_order = new WC_Order( $recovered_id );
280
- $recovered_date = strtotime( $woo_order->order_date );
281
- $recovered_date_new = date( 'd M, Y h:i A', $recovered_date );
282
- $recovered_item += 1;
283
-
284
- if ( isset($rec_order) && $rec_order != false ) {
285
- $recovered_total += $rec_order['_order_total'][0];
286
- }
287
- $abandoned_date = date( 'd M, Y h:i A', $value->abandoned_cart_time );
288
- $abandoned_order_id = $value->id;
289
- $billing_first_name = $billing_last_name = $billing_email = '';
290
- $recovered_order_total = 0;
291
-
292
- if ( isset( $rec_order['_billing_first_name'][0] ) ) {
293
- $billing_first_name = $rec_order['_billing_first_name'][0];
294
- }
295
-
296
- if ( isset( $rec_order['_billing_last_name'][0] ) ) {
297
- $billing_last_name = $rec_order['_billing_last_name'][0];
298
- }
299
-
300
- if ( isset( $rec_order['_billing_email'][0] ) ) {
301
- $billing_email = $rec_order['_billing_email'][0];
302
- }
303
-
304
- if ( isset( $rec_order['_order_total'][0] ) ) {
305
- $recovered_order_total = $rec_order['_order_total'][0];
306
- }
307
-
308
- $return_recovered_orders[ $i ]->user_name = $billing_first_name . " " . $billing_last_name ;
309
- $return_recovered_orders[ $i ]->user_email_id = $billing_email;
310
- $return_recovered_orders[ $i ]->created_on = $abandoned_date;
311
- $return_recovered_orders[ $i ]->recovered_date = $recovered_date_new;
312
- $return_recovered_orders[ $i ]->recovered_id = $recovered_id;
313
- $return_recovered_orders[ $i ]->recover_order_date = $recovered_date;
314
- $return_recovered_orders[ $i ]->abandoned_date = $value->abandoned_cart_time;
315
- $return_recovered_orders[ $i ]->order_total = get_woocommerce_currency_symbol() . $recovered_order_total;
316
-
317
-
318
- $this->recovered_item = $recovered_item;
319
- $this->total_recover_amount = round( ( $recovered_order_total + $this->total_recover_amount ) , 2 ) ;
320
-
321
- $i++;
322
- }
323
-
324
-
325
- }
326
-
327
- // sort for order date
328
- if (isset($_GET['orderby']) && $_GET['orderby'] == 'created_on') {
329
- if (isset($_GET['order']) && $_GET['order'] == 'asc') {
330
- usort( $return_recovered_orders, array( __CLASS__ ,"wcap_class_recovered_created_on_asc") );
331
- }else {
332
- usort( $return_recovered_orders, array( __CLASS__ ,"wcap_class_recovered_created_on_dsc") );
333
- }
334
- }
335
-
336
- // sort for customer name
337
- else if ( isset( $_GET['orderby']) && $_GET['orderby'] == 'recovered_date' ) {
338
- if ( isset( $_GET['order'] ) && $_GET['order'] == 'asc' ) {
339
- usort( $return_recovered_orders, array( __CLASS__ ,"wcap_class_recovered_date_asc" ) );
340
- }else {
341
- usort( $return_recovered_orders, array( __CLASS__ ,"wcap_class_recovered_date_dsc" ) );
342
- }
343
- }
344
-
345
-
346
- return apply_filters( 'wcap_recovered_orders_table_data', $return_recovered_orders );
347
- }
348
-
349
- function wcap_class_recovered_created_on_asc($value1,$value2) {
350
- return $value1->abandoned_date - $value2->abandoned_date;
351
- }
352
-
353
- function wcap_class_recovered_created_on_dsc ($value1,$value2) {
354
- return $value2->abandoned_date - $value1->abandoned_date;
355
- }
356
-
357
- function wcap_class_recovered_date_asc($value1,$value2) {
358
- return $value1->recover_order_date - $value2->recover_order_date;
359
- }
360
-
361
- function wcap_class_recovered_date_dsc ($value1,$value2) {
362
- return $value2->recover_order_date - $value1->recover_order_date;
363
- }
364
-
365
-
366
- public function column_default( $wcap_abadoned_orders, $column_name ) {
367
- $value = '';
368
- switch ( $column_name ) {
369
-
370
- case 'user_email_id' :
371
- if(isset($wcap_abadoned_orders->user_email_id)){
372
-
373
- $user_email_id = "<a href= mailto:$wcap_abadoned_orders->user_email_id>". $wcap_abadoned_orders->user_email_id."</a>" ;
374
- $value = $user_email_id;
375
- }
376
- break;
377
-
378
- case 'created_on' :
379
- if(isset($wcap_abadoned_orders->created_on)){
380
- $value = $wcap_abadoned_orders->created_on;
381
- }
382
- break;
383
-
384
- case 'recovered_date' :
385
- if(isset($wcap_abadoned_orders->recovered_date)){
386
- $value = $wcap_abadoned_orders->recovered_date;
387
- }
388
- break;
389
-
390
- case 'order_total' :
391
- if(isset($wcap_abadoned_orders->order_total)){
392
- $value = $wcap_abadoned_orders->order_total;
393
- }
394
- break;
395
- default:
396
-
397
- $value = isset( $wcap_abadoned_orders->$column_name ) ? $wcap_abadoned_orders->$column_name : '';
398
- break;
399
- }
400
-
401
- return apply_filters( 'wcap_recovered_orders_column_default', $value, $wcap_abadoned_orders, $column_name );
402
- }
403
- }
404
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class-templates-table.php DELETED
@@ -1,295 +0,0 @@
1
- <?php
2
-
3
- // Load WP_List_Table if not loaded
4
- if ( ! class_exists( 'WP_List_Table' ) ) {
5
- require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
6
- }
7
-
8
- class WACP_Templates_Table extends WP_List_Table {
9
-
10
- /**
11
- * Number of results to show per page
12
- *
13
- * @var string
14
- * @since 2.5.2
15
- */
16
- public $per_page = 30;
17
-
18
- /**
19
- * URL of this page
20
- *
21
- * @var string
22
- * @since 2.5.2
23
- */
24
- public $base_url;
25
-
26
- /**
27
- * Total number of bookings
28
- *
29
- * @var int
30
- * @since 2.5.3
31
- */
32
- public $total_count;
33
-
34
- /**
35
- * Get things started
36
- *
37
- * @see WP_List_Table::__construct()
38
- */
39
- public function __construct() {
40
-
41
- global $status, $page;
42
-
43
- // Set parent defaults
44
- parent::__construct( array(
45
- 'singular' => __( 'template_id', 'woocommerce-ac' ), //singular name of the listed records
46
- 'plural' => __( 'template_ids', 'woocommerce-ac' ), //plural name of the listed records
47
- 'ajax' => false // Does this table support ajax?
48
- ) );
49
- $this->wcap_get_templates_count();
50
- $this->process_bulk_action();
51
- $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=emailtemplates' );
52
- }
53
-
54
- public function wcap_templates_prepare_items() {
55
-
56
- $columns = $this->get_columns();
57
- $hidden = array(); // No hidden columns
58
- $sortable = $this->templates_get_sortable_columns();
59
- $data = $this->wacp_templates_data_lite();
60
-
61
- $this->_column_headers = array( $columns, $hidden, $sortable);
62
- $total_items = $this->total_count;
63
- $this->items = $data;
64
-
65
- $this->set_pagination_args( array(
66
- 'total_items' => $total_items, // WE have to calculate the total number of items
67
- 'per_page' => $this->per_page, // WE have to determine how many items to show on a page
68
- 'total_pages' => ceil( $total_items / $this->per_page ) // WE have to calculate the total number of pages
69
- )
70
- );
71
- }
72
-
73
- public function get_columns() {
74
-
75
- $columns = array(
76
- 'cb' => '<input type="checkbox" />',
77
- 'sr' => __( 'Sr', 'woocommerce-ac' ),
78
- 'template_name' => __( 'Name Of Template', 'woocommerce-ac' ),
79
- 'sent_time' => __( 'Sent After Set Time', 'woocommerce-ac' ),
80
- 'activate' => __( 'Active ?', 'woocommerce-ac' )
81
- );
82
-
83
- return apply_filters( 'wcap_templates_columns', $columns );
84
- }
85
-
86
- /***
87
- * It is used to add the check box for the items
88
- */
89
- function column_cb( $item ){
90
-
91
- $template_id = '';
92
- if( isset($item->id) && "" != $item->id ){
93
- $template_id = $item->id;
94
- }
95
- return sprintf(
96
- '<input type="checkbox" name="%1$s[]" value="%2$s" />',
97
- 'template_id',
98
- $template_id
99
- );
100
- }
101
-
102
- public function templates_get_sortable_columns() {
103
- $columns = array(
104
- 'template_name' => array( 'template_name', false ),
105
- 'sent_time' => array( 'sent_time',false),
106
- );
107
- return apply_filters( 'wcap_templates_sortable_columns', $columns );
108
- }
109
-
110
- /**
111
- * Render the Email Column
112
- *
113
- * @access public
114
- * @since 2.5.2
115
- * @param array $abadoned_row_info Contains all the data of the template row
116
- * @return string Data shown in the Email column
117
- *
118
- * This function used for individual delete of row, It is for hover effect delete.
119
- */
120
- public function column_template_name( $template_row_info ) {
121
-
122
- $row_actions = array();
123
- $value = '';
124
- $template_id = 0;
125
- if( isset($template_row_info->template_name) ){
126
-
127
- $template_id = $template_row_info->id ;
128
-
129
- $row_actions['edit'] = '<a href="' . wp_nonce_url( add_query_arg( array( 'action' => 'emailtemplates', 'mode'=>'edittemplate', 'id' => $template_row_info->id ), $this->base_url ), 'abandoned_order_nonce') . '">' . __( 'Edit', 'woocommerce-ac' ) . '</a>';
130
- $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( 'action' => 'wcap_delete_template', 'template_id' => $template_row_info->id ), $this->base_url ), 'abandoned_order_nonce') . '">' . __( 'Delete', 'woocommerce-ac' ) . '</a>';
131
-
132
- $email = $template_row_info->template_name;
133
- $value = $email . $this->row_actions( $row_actions );
134
-
135
- }
136
-
137
- return apply_filters( 'wcap_template_single_column', $value, $template_id, 'email' );
138
- }
139
-
140
- /***
141
- * This function used to get the abadoned orders count
142
- */
143
- public function wcap_get_templates_count() {
144
-
145
- global $wpdb;
146
- $results = array();
147
-
148
- // get main site's table prefix
149
- $main_prefix = $wpdb->get_blog_prefix(1);
150
- $query = "SELECT * FROM `" . $wpdb->prefix."ac_email_templates_lite`";
151
- $results = $wpdb->get_results($query);
152
-
153
- $templates_count = count($results);
154
- $this->total_count = $templates_count;
155
- }
156
-
157
- public function wacp_templates_data_lite() {
158
- global $wpdb;
159
-
160
- $return_bookings = array();
161
- $per_page = $this->per_page;
162
- $results = array();
163
-
164
- $query = "SELECT wpet . * FROM `" . $wpdb->prefix . "ac_email_templates_lite` AS wpet ORDER BY day_or_hour desc , frequency asc";
165
- $results = $wpdb->get_results( $query );
166
-
167
- $i = 1;
168
-
169
- foreach ( $results as $key => $value ) {
170
-
171
- $return_templates_data[$i] = new stdClass();
172
-
173
-
174
- $id = $value->id;
175
- $query_no_emails = "SELECT * FROM " . $wpdb->prefix . "ac_sent_history_lite WHERE template_id= %d";
176
-
177
- $from = $value->from_email;
178
- $subject = $value->subject;
179
- $body = $value->body;
180
- $is_active = $value->is_active;
181
-
182
- if ( $is_active == '1' ) {
183
- $active = "Deactivate";
184
- } else {
185
- $active = "Activate";
186
- }
187
- $frequency = $value->frequency;
188
- $day_or_hour = $value->day_or_hour;
189
-
190
- $return_templates_data[ $i ]->sr = $i;
191
- $return_templates_data[ $i ]->id = $id;
192
- $return_templates_data[ $i ]->template_name = $value->template_name;
193
- $return_templates_data[ $i ]->sent_time = __( $frequency . " " . $day_or_hour . " After Abandonment", 'woocommerce-ac' );
194
- $return_templates_data[ $i ]->activate = $active;
195
- $return_templates_data[ $i ]->is_active = $is_active;
196
- $i++;
197
-
198
- }
199
-
200
- // sort for order date
201
- if (isset($_GET['orderby']) && $_GET['orderby'] == 'template_name') {
202
- if (isset($_GET['order']) && $_GET['order'] == 'asc') {
203
- usort( $return_templates_data, array( __CLASS__ ,"wcap_class_template_name_asc") );
204
- }else {
205
- usort( $return_templates_data, array( __CLASS__ ,"wcap_class_template_name_dsc") );
206
- }
207
- }
208
-
209
- // sort for customer name
210
- else if ( isset( $_GET['orderby']) && $_GET['orderby'] == 'sent_time' ) {
211
- if ( isset( $_GET['order'] ) && $_GET['order'] == 'asc' ) {
212
- usort( $return_templates_data, array( __CLASS__ ,"wcap_class_sent_time_asc" ) );
213
- }else {
214
- usort( $return_templates_data, array( __CLASS__ ,"wcap_class_sent_time_dsc" ) );
215
- }
216
- }
217
-
218
-
219
- return apply_filters( 'wcap_templates_table_data', $return_templates_data );
220
- }
221
-
222
- function wcap_class_template_name_asc($value1,$value2) {
223
- return strcasecmp($value1->template_name,$value2->template_name );
224
- }
225
-
226
- function wcap_class_template_name_dsc ($value1,$value2) {
227
- return strcasecmp($value2->template_name,$value1->template_name );
228
- }
229
-
230
- function wcap_class_sent_time_asc($value1,$value2) {
231
- return strnatcasecmp($value1->sent_time,$value2->sent_time );
232
- }
233
-
234
- function wcap_class_sent_time_dsc ($value1,$value2) {
235
- return strnatcasecmp($value2->sent_time,$value1->sent_time );
236
- }
237
-
238
-
239
- public function column_default( $wcap_abadoned_orders, $column_name ) {
240
- $value = '';
241
- switch ( $column_name ) {
242
-
243
- case 'sr' :
244
- if(isset($wcap_abadoned_orders->sr)){
245
- $value = $wcap_abadoned_orders->sr;
246
- }
247
- break;
248
-
249
- case 'template_name' :
250
- if(isset($wcap_abadoned_orders->template_name)){
251
- $value = $wcap_abadoned_orders->template_name;
252
- }
253
- break;
254
-
255
- case 'sent_time' :
256
- if(isset($wcap_abadoned_orders->sent_time)){
257
- $value = $wcap_abadoned_orders->sent_time;
258
- }
259
- break;
260
-
261
- case 'activate' :
262
- if(isset($wcap_abadoned_orders->activate)){
263
-
264
- $active = $wcap_abadoned_orders->activate;
265
- $id = $wcap_abadoned_orders->id;
266
- $is_active = $wcap_abadoned_orders->is_active;
267
-
268
- $active = '';
269
- if ( $is_active == '1' ) {
270
- $active = "Deactivate";
271
- } else {
272
- $active = "Activate";
273
- }
274
- $active_text = __( $active, 'woocommerce-ac' );
275
- $value = '<a href="#" onclick="activate_email_template('. $id.', '.$is_active.' )"> '.$active_text.'</a>';
276
- //$value = $wcap_abadoned_orders->activate;
277
- }
278
- break;
279
-
280
- default:
281
-
282
- $value = isset( $wcap_abadoned_orders->$column_name ) ? $wcap_abadoned_orders->$column_name : '';
283
- break;
284
- }
285
-
286
- return apply_filters( 'wcap_template_column_default', $value, $wcap_abadoned_orders, $column_name );
287
- }
288
-
289
- public function get_bulk_actions() {
290
- return array(
291
- 'wcap_delete_template' => __( 'Delete', 'woocommerce-ac' )
292
- );
293
- }
294
- }
295
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cron/send_email.php DELETED
@@ -1,447 +0,0 @@
1
- <?php
2
-
3
- if( defined('WP_CONTENT_FOLDERNAME' ) ) {
4
- $wp_content_dir_name = WP_CONTENT_FOLDERNAME;
5
- }elseif( defined( 'WP_CONTENT_DIR' ) ) {
6
- $url = WP_CONTENT_DIR;
7
- $explode_url = explode( "/", $url );
8
- $wp_content_dir_name = end( $explode_url );
9
- }else{
10
- $wp_content_dir_name = "wp-content";
11
- }
12
-
13
-
14
-
15
- $url = dirname( __FILE__ );
16
- $my_url = explode( $wp_content_dir_name , $url );
17
- $path = $my_url[0];
18
-
19
- require_once $path . 'wp-load.php';
20
- /**
21
- * woocommerce_abandon_cart_cron class
22
- **/
23
- if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
24
-
25
- class woocommerce_abandon_cart_cron {
26
-
27
- var $cart_settings_cron;
28
- var $cart_abandon_cut_off_time_cron;
29
-
30
- public function __construct() {
31
-
32
- $this->cart_settings_cron = get_option( 'ac_lite_cart_abandoned_time' );
33
-
34
- $this->cart_abandon_cut_off_time_cron = ( $this->cart_settings_cron ) * 60;
35
- }
36
-
37
- /*-----------------------------------------------------------------------------------*/
38
- /* Class Functions */
39
- /*-----------------------------------------------------------------------------------*/
40
-
41
- /**
42
- * Function to send emails
43
- */
44
- function woocommerce_ac_send_email() {
45
-
46
- global $wpdb, $woocommerce;
47
-
48
- // Delete any guest ac carts that might be pending because user did not go to Order Received page after payment
49
- //search for the guest carts
50
- $query_guest_records = "SELECT id,email_id FROM `" . $wpdb->prefix . "ac_guest_abandoned_cart_history_lite`";
51
- $results_guest_list = $wpdb->get_results( $query_guest_records );
52
-
53
- // This is to ensure that recovered guest carts r removed from the delete list
54
- $query_records = "SELECT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE user_type = 'GUEST' AND recovered_cart != '0'";
55
- $results_query = $wpdb->get_results( $query_records );
56
-
57
- foreach ( $results_guest_list as $key => $value ) {
58
- $record_found = "NO";
59
- foreach ( $results_query as $k => $v ) {
60
- if ( $value->id == $v->user_id ) {
61
- $record_found = "YES";
62
- }
63
- }
64
- if ( $record_found == "YES" ) {
65
- unset( $results_guest_list[ $key ] );
66
- }
67
- }
68
- foreach ( $results_guest_list as $key => $value ) {
69
- $query_email_id = "SELECT post_id FROM `" . $wpdb->prefix . "postmeta` WHERE meta_key = '_billing_email' AND meta_value = %s";
70
- $results_query_email = $wpdb->get_results( $wpdb->prepare( $query_email_id, $value->email_id ) );
71
-
72
- //if any orders are found with the same email addr..delete those ac records
73
- if ( $results_query_email ) {
74
-
75
- for ( $i = 0; $i < count( $results_query_email ); $i++ ) {
76
- $query_post = "SELECT post_date,post_status FROM `" . $wpdb->prefix . "posts` WHERE ID = %d";
77
- $results_post = $wpdb->get_results ( $wpdb->prepare( $query_post, $results_query_email[ $i ]->post_id ) );
78
-
79
- if ( $results_post[0]->post_status == "wc-pending" || $results_post[0]->post_status == "wc-failed" ) {
80
- continue;
81
- }
82
- $order_date_time = $results_post[0]->post_date;
83
- $order_date = substr( $order_date_time , 0 , 10 );
84
- $current_time = current_time( 'timestamp' );
85
- $today_date = date( 'Y-m-d', $current_time );
86
-
87
- if ( $order_date == $today_date ) {
88
- $query_delete = "DELETE FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE user_id = '" . $value->id . "'";
89
- $wpdb->query( $query_delete );
90
- $query_guest = "DELETE FROM `" . $wpdb->prefix . "ac_guest_abandoned_cart_history_lite` WHERE email_id = '" . $value->email_id . "'";
91
- $wpdb->query( $query_guest );
92
- break;
93
- }
94
- }
95
- }
96
- }
97
-
98
- // Delete any logged in user carts that might be pending because user did not go to Order Received page after payment
99
- $query_records = "SELECT DISTINCT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE user_type = 'REGISTERED' AND cart_ignored = '0' AND recovered_cart = '0'";
100
- $results_list = $wpdb->get_results( $query_records );
101
-
102
-
103
- foreach ( $results_list as $key => $value ) {
104
- $user_id = $value->user_id;
105
- $query_email = '';
106
- if ( is_multisite() ){
107
- // get main site's table prefix
108
- $main_prefix = $wpdb->get_blog_prefix(1);
109
- $query_email = "SELECT user_email FROM `".$main_prefix."users` WHERE ID = %d";
110
-
111
- }else{
112
- // non-multisite - regular table name
113
- $query_email = "SELECT user_email FROM `".$wpdb->prefix."users` WHERE ID = %d";
114
- }
115
-
116
-
117
- $results_email = $wpdb->get_results( $wpdb->prepare( $query_email, $user_id ) );
118
-
119
-
120
- $query_email_id = "SELECT post_id FROM `" . $wpdb->prefix . "postmeta` WHERE meta_key = '_billing_email' AND meta_value = %s";
121
- $results_query_email = $wpdb->get_results( $wpdb->prepare( $query_email_id, $results_email[0]->user_email ) );
122
-
123
-
124
- //if any orders are found with the same email addr..delete those ac records
125
- if ( is_array( $results_query_email ) && count( $results_query_email ) > 0 ) {
126
-
127
- for ( $i = 0; $i < count( $results_query_email ); $i++ ) {
128
-
129
- $query_post = "SELECT post_date,post_status FROM `" . $wpdb->prefix . "posts` WHERE ID = %d ";
130
- $results_post = $wpdb->get_results ( $wpdb->prepare( $query_post, $results_query_email[ $i ]->post_id ) );
131
-
132
- if ( $results_post[0]->post_status == "wc-pending" || $results_post[0]->post_status == "wc-failed" ) {
133
- continue;
134
-
135
- }
136
- $order_date_time = $results_post[0]->post_date;
137
- $order_date = substr( $order_date_time, 0, 10 );
138
- $current_time = current_time( 'timestamp' );
139
- $today_date = date( 'Y-m-d', $current_time );
140
-
141
- if ( $order_date == $today_date ) {
142
- $query_delete = "DELETE FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
143
- WHERE user_id = '" . $user_id . "'
144
- AND cart_ignored = '0'
145
- AND recovered_cart = '0'";
146
-
147
- $wpdb->query( $query_delete );
148
- break;
149
- }
150
- }
151
- }
152
- }
153
-
154
- //Grab the cart abandoned cut-off time from database.
155
- $cart_settings = get_option( 'ac_lite_cart_abandoned_time' );
156
-
157
- $cart_abandon_cut_off_time = $cart_settings * 60;
158
-
159
- //Fetch all active templates present in the system
160
- $query = "SELECT wpet . *
161
- FROM `".$wpdb->prefix."ac_email_templates_lite` AS wpet
162
- WHERE wpet.is_active = '1'
163
- ORDER BY `day_or_hour` DESC, `frequency` ASC ";
164
- $results = $wpdb->get_results( $query );
165
-
166
- $hour_seconds = 3600; // 60 * 60
167
- $day_seconds = 86400; // 24 * 60 * 60
168
- foreach ( $results as $key => $value )
169
- {
170
- if ( $value->day_or_hour == 'Days' )
171
- {
172
- $time_to_send_template_after = $value->frequency * $day_seconds;
173
- }
174
- elseif ( $value->day_or_hour == 'Hours' )
175
- {
176
- $time_to_send_template_after = $value->frequency * $hour_seconds;
177
- }
178
-
179
- $carts = $this->get_carts( $time_to_send_template_after, $cart_abandon_cut_off_time );
180
-
181
- $email_frequency = $value->frequency;
182
- $email_body_template = $value->body;
183
- $email_subject = $value->subject;
184
- $headers = "From: " . $value->from_name . " <" . $value->from_email . ">" . "\r\n";
185
- $headers .= "Content-Type: text/html"."\r\n";
186
- $headers .= "Reply-To: " . $value->reply_email . " " . "\r\n";
187
- $template_id = $value->id;
188
- $is_wc_template = $value->is_wc_template;
189
-
190
- foreach ( $carts as $key => $value )
191
- {
192
- if ( $value->user_type == "GUEST" ) {
193
- $value->user_login = "";
194
- $query_guest = "SELECT billing_first_name, billing_last_name, email_id FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = %d";
195
- $results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $value->user_id ) );
196
- $value->user_email = $results_guest[0]->email_id;
197
- }else{
198
-
199
- $user_id = $value->user_id;
200
- $key = 'billing_email';
201
- $single = true;
202
- $user_biiling_email = get_user_meta( $user_id, $key, $single );
203
- if( isset( $user_biiling_email ) && $user_biiling_email != '' ){
204
- $value->user_email = $user_biiling_email;
205
- }
206
- }
207
-
208
- $cart_info_db_field = json_decode( $value->abandoned_cart_info );
209
- if ( count( $cart_info_db_field->cart ) > 0 )
210
- {
211
- $cart_update_time = $value->abandoned_cart_time;
212
-
213
- $new_user = $this->check_sent_history( $value->user_id, $cart_update_time, $template_id, $value->id );
214
- if ( $new_user == true )
215
- {
216
- $cart_info_db = $value->abandoned_cart_info;
217
-
218
- $email_body = $email_body_template;
219
-
220
- if ( $value->user_type == "GUEST" ) {
221
- if ( isset( $results_guest[0]->billing_first_name ) ) {
222
- $email_body = str_replace( "{{customer.firstname}}", $results_guest[0]->billing_first_name, $email_body );
223
- $email_subject = str_replace( "{{customer.firstname}}", $results_guest[0]->billing_first_name, $email_subject );
224
- }
225
-
226
- if ( isset( $results_guest[0]->billing_last_name ) ) $email_body = str_replace( "{{customer.lastname}}", $results_guest[0]->billing_last_name, $email_body );
227
-
228
- if ( isset( $results_guest[0]->billing_first_name ) && isset( $results_guest[0]->billing_last_name ) ) $email_body = str_replace( "{{customer.fullname}}", $results_guest[0]->billing_first_name." ".$results_guest[0]->billing_last_name, $email_body );
229
- else if ( isset( $results_guest[0]->billing_first_name ) ) $email_body = str_replace( "{{customer.fullname}}", $results_guest[0]->billing_first_name, $email_body );
230
- else if ( isset( $results_guest[0]->billing_last_name)) $email_body = str_replace( "{{customer.fullname}}", $results_guest[0]->billing_last_name, $email_body );
231
- } else {
232
- $email_body = str_replace( "{{customer.firstname}}", get_user_meta( $value->user_id, 'first_name', true ), $email_body );
233
- $email_subject = str_replace( "{{customer.firstname}}", get_user_meta( $value->user_id, 'first_name', true ), $email_subject );
234
- $email_body = str_replace( "{{customer.lastname}}", get_user_meta( $value->user_id, 'last_name', true ), $email_body );
235
- $email_body = str_replace( "{{customer.fullname}}", get_user_meta( $value->user_id, 'first_name', true )." ".get_user_meta( $value->user_id, 'last_name', true ), $email_body );
236
- }
237
-
238
- $order_date = "";
239
-
240
- if ( $cart_update_time != "" && $cart_update_time != 0 ) {
241
- $order_date = date( 'd M, Y h:i A', $cart_update_time );
242
- }
243
-
244
- $email_body = str_replace( "{{cart.abandoned_date}}", $order_date, $email_body );
245
-
246
- $query_sent = "INSERT INTO `".$wpdb->prefix."ac_sent_history_lite` ( template_id, abandoned_order_id, sent_time, sent_email_id )
247
- VALUES ( %s, %s, '".current_time( 'mysql' )."', %s )";
248
-
249
- $wpdb->query( $wpdb->prepare( $query_sent, $template_id, $value->id, $value->user_email ) );
250
-
251
- $query_id = "SELECT * FROM `".$wpdb->prefix."ac_sent_history_lite`
252
- WHERE template_id = %s AND abandoned_order_id = %s
253
- ORDER BY id DESC
254
- LIMIT 1 ";
255
-
256
- $results_sent = $wpdb->get_results( $wpdb->prepare( $query_id, $template_id, $value->id ) );
257
-
258
-
259
- $email_sent_id = $results_sent[0]->id;
260
-
261
- $var = '';
262
- if( preg_match( "{{products.cart}}", $email_body, $matched ) ) {
263
- $var = '<h3>'.__( "Your Shopping Cart", "woocommerce-ac" ).'</h3>
264
- <table border="0" cellpadding="10" cellspacing="0" class="templateDataTable">
265
- <tr>
266
- <th>'.__( "Item", "woocommerce-ac" ).'</th>
267
- <th>'.__( "Name", "woocommerce-ac" ).'</th>
268
- <th>'.__( "Quantity", "woocommerce-ac" ).'</th>
269
- <th>'.__( "Price", "woocommerce-ac" ).'</th>
270
- <th>'.__( "Line Subtotal", "woocommerce-ac" ).'</th>
271
- </tr>';
272
-
273
- $cart_details = $cart_info_db_field->cart;
274
- $cart_total = $item_subtotal = $item_total = 0;
275
- $sub_line_prod_name = '';
276
- foreach ( $cart_details as $k => $v ) {
277
- $quantity_total = $v->quantity;
278
- $product_id = $v->product_id;
279
- $prod_name = get_post( $product_id );
280
- $product_link_track = get_permalink( $product_id );
281
- $product_name = $prod_name->post_title;
282
- if ( $sub_line_prod_name == '' ) {
283
- $sub_line_prod_name = $product_name;
284
- }
285
- // Item subtotal is calculated as product total including taxes
286
- if( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
287
- $item_subtotal = $item_subtotal + $v->line_total + $v->line_subtotal_tax;
288
- } else {
289
- $item_subtotal = $item_subtotal + $v->line_total;
290
- }
291
-
292
- // Line total
293
- $item_total = $item_subtotal;
294
- $item_subtotal = $item_subtotal / $quantity_total;
295
- $item_total_display = number_format( $item_total, 2 );
296
- $item_subtotal = number_format( $item_subtotal, 2 );
297
- $product = get_product( $product_id );
298
- $prod_image = $product->get_image();
299
- $image_url = wp_get_attachment_url( get_post_thumbnail_id( $product_id ) );
300
- $var .='<tr align="center">
301
- <td> <a href="'.$product_link_track.'"> <img src="' . $image_url . '" alt="" height="42" width="42" /> </a></td>
302
- <td> <a href="'.$product_link_track.'">'.__( $product_name, "woocommerce-ac" ).'</a></td>
303
- <td> '.$quantity_total.'</td>
304
- <td> '.get_woocommerce_currency_symbol()."".$item_subtotal.'</td>
305
- <td> '.get_woocommerce_currency_symbol()."".$item_total_display.'</td>
306
- </tr>';
307
- $cart_total += $item_total;
308
- $item_subtotal = $item_total = 0;
309
- }
310
- $cart_total = number_format( $cart_total, 2 );
311
- $var .= '<tr align="center">
312
- <td> </td>
313
- <td> </td>
314
- <td> </td>
315
- <td>'.__( "Cart Total:", "woocommerce-ac" ).'</td>
316
- <td> '.get_woocommerce_currency_symbol()."".$cart_total.'</td>
317
- </tr>';
318
- $var .= '</table>
319
- ';
320
- $email_body = str_replace( "{{products.cart}}", $var, $email_body );
321
- $email_subject = str_replace( "{{product.name}}", __( $sub_line_prod_name, "woocommerce-ac" ), $email_subject );
322
- }
323
-
324
- if ( $woocommerce->version < '2.3' ) {
325
- $cart_page_link = $woocommerce->cart->get_cart_url();
326
- } else {
327
- $cart_page_id = woocommerce_get_page_id( 'cart' );
328
- $cart_page_link = $cart_page_id ? get_permalink( $cart_page_id ) : '';
329
- }
330
-
331
- $encoding_cart = $email_sent_id.'&url='.$cart_page_link;
332
-
333
- $validate_cart = $this->encrypt_validate ($encoding_cart);
334
- $cart_link_track = get_option('siteurl').'/?wacp_action=track_links&validate=' . $validate_cart;
335
- $email_body = str_replace( "{{cart.link}}", $cart_link_track, $email_body );
336
-
337
- $user_email = $value->user_email;
338
-
339
- $email_body_final = stripslashes( $email_body );
340
-
341
- if ( isset( $is_wc_template ) && "1" == $is_wc_template ){
342
-
343
- ob_start();
344
-
345
- $email_heading = __( 'Abandoned cart reminder', 'woocommerce' );
346
-
347
- wc_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading ) );
348
-
349
- $email_body_template_header = ob_get_clean();
350
-
351
- ob_start();
352
-
353
- wc_get_template( 'emails/email-footer.php' );
354
-
355
- $email_body_template_footer = ob_get_clean();
356
-
357
- $final_email_body = $email_body_template_header . $email_body_final . $email_body_template_footer;
358
-
359
- wc_mail( $user_email, $email_subject, $final_email_body, $headers );
360
-
361
- }else{
362
- wp_mail( $user_email, $email_subject, __( $email_body_final, 'woocommerce-ac' ), $headers );
363
- }
364
- }
365
-
366
- }
367
- }
368
-
369
- }
370
-
371
- }
372
-
373
- /**
374
- * get all carts which have the creation time earlier than the one that is passed
375
- *
376
- */
377
- function get_carts( $template_to_send_after_time, $cart_abandon_cut_off_time ) {
378
-
379
- global $wpdb;
380
-
381
- $cart_time = current_time( 'timestamp' ) - $template_to_send_after_time - $cart_abandon_cut_off_time;
382
-
383
- $cart_ignored = 0;
384
- $query = "SELECT wpac . * , wpu.user_login, wpu.user_email
385
- FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac
386
- LEFT JOIN ".$wpdb->base_prefix."users AS wpu ON wpac.user_id = wpu.id
387
- WHERE cart_ignored = %s
388
- AND abandoned_cart_time < $cart_time
389
- ORDER BY `id` ASC ";
390
-
391
- $results = $wpdb->get_results( $wpdb->prepare( $query, $cart_ignored ) );
392
-
393
- return $results;
394
-
395
- exit;
396
- }
397
-
398
- /******
399
- * This function is used to encode the validate string.
400
- ******/
401
- function encrypt_validate( $validate ) {
402
-
403
- $cryptKey = 'qJB0rGtIn5UB1xG03efyCp';
404
- $validate_encoded = base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), $validate, MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ) );
405
- return $validate_encoded;
406
- }
407
-
408
- function check_sent_history( $user_id, $cart_update_time, $template_id, $id ) {
409
-
410
- global $wpdb;
411
-
412
- $query = "SELECT wpcs . * , wpac . abandoned_cart_time , wpac . user_id
413
- FROM `".$wpdb->prefix."ac_sent_history_lite` AS wpcs
414
- LEFT JOIN ".$wpdb->prefix."ac_abandoned_cart_history_lite AS wpac ON wpcs.abandoned_order_id = wpac.id
415
- WHERE
416
- template_id = %s
417
- AND
418
- wpcs.abandoned_order_id = %d
419
- ORDER BY 'id' DESC
420
- LIMIT 1 ";
421
-
422
- $results = $wpdb->get_results( $wpdb->prepare( $query, $template_id, $id ) );
423
- if ( count( $results ) == 0 )
424
- {
425
- return true;
426
- }
427
- elseif ( $results[0]->abandoned_cart_time < $cart_update_time )
428
- {
429
- return true;
430
- }
431
- else
432
- {
433
- return false;
434
- }
435
-
436
- }
437
-
438
-
439
- }
440
-
441
- }
442
-
443
- $woocommerce_abandon_cart_cron = new woocommerce_abandon_cart_cron();
444
-
445
- $woocommerce_abandon_cart_cron->woocommerce_ac_send_email();
446
-
447
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cron/wcal_send_email.php ADDED
@@ -0,0 +1,481 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ static $wp_load; // Since this will be called twice, hold onto it.
4
+ if ( ! isset( $wp_load ) ) {
5
+ $wp_load = false;
6
+ $dir = __FILE__;
7
+ while( '/' != ( $dir = dirname( $dir ) ) ) {
8
+ if( file_exists( $wp_load = "{$dir}/wp-load.php" ) ) {
9
+ break;
10
+ }
11
+ }
12
+ }
13
+
14
+ $wcal_root = dirname( dirname(__FILE__) ); // go two level up for directory from this file.
15
+
16
+ require_once $wp_load;
17
+ require_once $wcal_root.'/includes/classes/class-wcal-aes.php';
18
+ require_once $wcal_root.'/includes/classes/class-wcal-aes-counter.php';
19
+
20
+
21
+ /**
22
+ * woocommerce_abandon_cart_cron class
23
+ **/
24
+ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
25
+
26
+ class woocommerce_abandon_cart_cron {
27
+ var $cart_settings_cron;
28
+ var $cart_abandon_cut_off_time_cron;
29
+ public function __construct() {
30
+ $this->cart_settings_cron = get_option( 'ac_lite_cart_abandoned_time' );
31
+ $this->cart_abandon_cut_off_time_cron = ( $this->cart_settings_cron ) * 60;
32
+ }
33
+
34
+ /**
35
+ * Function to send emails
36
+ */
37
+ function wcal_send_email_notification() {
38
+ global $wpdb, $woocommerce;
39
+ // Delete any guest abandoned carts that might be pending because user did not go to Order Received page after payment
40
+ //search for the guest carts
41
+ $query_guest_records = "SELECT id,email_id FROM `" . $wpdb->prefix . "ac_guest_abandoned_cart_history_lite`";
42
+ $results_guest_list = $wpdb->get_results( $query_guest_records );
43
+
44
+ // This is to ensure that recovered guest carts are removed from the delete list
45
+ $query_records = "SELECT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
46
+ WHERE user_type = 'GUEST' AND recovered_cart != '0'";
47
+ $results_query = $wpdb->get_results( $query_records );
48
+
49
+ foreach ( $results_guest_list as $key => $value ) {
50
+ $record_found = "NO";
51
+ foreach ( $results_query as $k => $v ) {
52
+ if ( $value->id == $v->user_id ) {
53
+ $record_found = "YES";
54
+ unset( $results_guest_list[ $key ] );
55
+ }
56
+ }
57
+ }
58
+ foreach( $results_guest_list as $key => $value ) {
59
+ $query_email_id = "SELECT post_id FROM `" . $wpdb->prefix . "postmeta` WHERE meta_key = '_billing_email' AND meta_value = %s";
60
+ $results_query_email = $wpdb->get_results( $wpdb->prepare( $query_email_id, $value->email_id ) );
61
+
62
+ //if any orders are found with the same email addr..delete those ac records
63
+ if ( $results_query_email ) {
64
+ for ( $i = 0; $i < count( $results_query_email ); $i++ ) {
65
+ $query_post = "SELECT post_date,post_status FROM `" . $wpdb->prefix . "posts`
66
+ WHERE ID = %d";
67
+ $results_post = $wpdb->get_results ( $wpdb->prepare( $query_post, $results_query_email[ $i ]->post_id ) );
68
+
69
+ if ( $results_post[0]->post_status == "wc-pending" || $results_post[0]->post_status == "wc-failed" ) {
70
+ continue;
71
+ }
72
+ $order_date_time = $results_post[0]->post_date;
73
+ $order_date = substr( $order_date_time , 0 , 10 );
74
+ $current_time = current_time( 'timestamp' );
75
+ $today_date = date( 'Y-m-d', $current_time );
76
+
77
+ if ( $order_date == $today_date ) {
78
+ $query_delete = "DELETE FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
79
+ WHERE user_id = '" . $value->id . "'";
80
+ $wpdb->query( $query_delete );
81
+ $query_guest = "DELETE FROM `" . $wpdb->prefix . "ac_guest_abandoned_cart_history_lite`
82
+ WHERE email_id = '" . $value->email_id . "'";
83
+ $wpdb->query( $query_guest );
84
+ break;
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ // Delete any logged in user carts that might be pending because user did not go to Order Received page after payment
91
+ $query_records = "SELECT DISTINCT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
92
+ WHERE user_type = 'REGISTERED' AND cart_ignored = '0' AND recovered_cart = '0'";
93
+ $results_list = $wpdb->get_results( $query_records );
94
+
95
+
96
+ foreach( $results_list as $key => $value ) {
97
+ $user_id = $value->user_id;
98
+ $key = 'billing_email';
99
+ $single = true;
100
+ $user_billing_email = get_user_meta( $user_id, $key, $single );
101
+ if( isset( $user_billing_email ) && $user_billing_email == '' ){
102
+ $user_id = $value->user_id;
103
+ if( is_multisite() ) {
104
+ // get main site's table prefix
105
+ $main_prefix = $wpdb->get_blog_prefix(1);
106
+ $query_email = "SELECT user_email FROM `".$main_prefix."users` WHERE ID = %d";
107
+
108
+ } else {
109
+ // non-multisite - regular table name
110
+ $query_email = "SELECT user_email FROM `".$wpdb->prefix."users` WHERE ID = %d";
111
+ }
112
+ $results_email = $wpdb->get_results( $wpdb->prepare( $query_email, $user_id ) );
113
+ if ( isset( $results_guest[0]->user_email ) ) {
114
+ $user_billing_email = $results_email[0]->user_email;
115
+ }
116
+ }
117
+
118
+ $query_email_id = "SELECT post_id FROM `" . $wpdb->prefix . "postmeta`
119
+ WHERE meta_key = '_billing_email' AND meta_value = %s";
120
+ $results_query_email = $wpdb->get_results( $wpdb->prepare( $query_email_id, $user_billing_email ) );
121
+
122
+ //if any orders are found with the same email address then delete those abandoned cart records
123
+ if ( is_array( $results_query_email ) && count( $results_query_email ) > 0 ) {
124
+ for ( $i = 0; $i < count( $results_query_email ); $i++ ) {
125
+ $query_post = "SELECT post_date,post_status FROM `" . $wpdb->prefix . "posts`
126
+ WHERE ID = %d ";
127
+ $results_post = $wpdb->get_results ( $wpdb->prepare( $query_post, $results_query_email[ $i ]->post_id ) );
128
+
129
+ if ( $results_post[0]->post_status == "wc-pending" || $results_post[0]->post_status == "wc-failed" ) {
130
+ continue;
131
+ }
132
+ $order_date_time = $results_post[0]->post_date;
133
+ $order_date = substr( $order_date_time, 0, 10 );
134
+ $current_time = current_time( 'timestamp' );
135
+ $today_date = date( 'Y-m-d', $current_time );
136
+
137
+ if ( $order_date == $today_date ) {
138
+ $query_delete = "DELETE FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
139
+ WHERE user_id = '" . $user_id . "'
140
+ AND cart_ignored = '0'
141
+ AND recovered_cart = '0'";
142
+
143
+ $wpdb->query( $query_delete );
144
+ break;
145
+ }
146
+ }
147
+ }
148
+ }
149
+
150
+ //Grab the cart abandoned cut-off time from database.
151
+ $cart_settings = get_option( 'ac_lite_cart_abandoned_time' );
152
+ $cart_abandon_cut_off_time = $cart_settings * 60;
153
+
154
+ //Fetch all active templates present in the system
155
+ $query = "SELECT wpet . * FROM `".$wpdb->prefix."ac_email_templates_lite` AS wpet
156
+ WHERE wpet.is_active = '1' ORDER BY `day_or_hour` DESC, `frequency` ASC ";
157
+ $results = $wpdb->get_results( $query );
158
+
159
+ $hour_seconds = 3600; // 60 * 60
160
+ $day_seconds = 86400; // 24 * 60 * 60
161
+ foreach ( $results as $key => $value ) {
162
+ if ( $value->day_or_hour == 'Days' ) {
163
+ $time_to_send_template_after = $value->frequency * $day_seconds;
164
+ } elseif ( $value->day_or_hour == 'Hours' ) {
165
+ $time_to_send_template_after = $value->frequency * $hour_seconds;
166
+ }
167
+
168
+ $carts = $this->wcal_get_carts( $time_to_send_template_after, $cart_abandon_cut_off_time );
169
+ /**
170
+ * When there are 3 templates and for cart id 1 all template time has been reached. BUt all templates are deactivated.
171
+ * If we activate all 3 template then at a 1 time all 3 email templates send to the users.
172
+ * So below function check that after first email is sent time and then from that time it will send the 2nd template time. ( It will not consider the cart abadoned time in this case. )
173
+ */
174
+ $carts = $this->wcal_remove_cart_for_mutiple_templates( $carts, $time_to_send_template_after, $value->id );
175
+
176
+ $email_frequency = $value->frequency;
177
+ $email_body_template = $value->body;
178
+ $email_subject = stripslashes ( $value->subject );
179
+ $headers = "From: " . $value->from_name . " <" . $value->from_email . ">" . "\r\n";
180
+ $headers .= "Content-Type: text/html"."\r\n";
181
+ $headers .= "Reply-To: " . $value->reply_email . " " . "\r\n";
182
+ $template_id = $value->id;
183
+ $is_wc_template = $value->is_wc_template;
184
+ $wc_template_header_text = $value->wc_email_header != '' ? $value->wc_email_header : __( 'Abandoned cart reminder', 'woocommerce-ac');
185
+ $wc_template_header = stripslashes( $wc_template_header_text );
186
+ if ( '' != $email_body_template ) {
187
+ foreach ( $carts as $key => $value ) {
188
+ if ( $value->user_type == "GUEST" ) {
189
+ $value->user_login = "";
190
+ $query_guest = "SELECT billing_first_name, billing_last_name, email_id FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite`
191
+ WHERE id = %d";
192
+ $results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $value->user_id ) );
193
+ $value->user_email = $results_guest[0]->email_id;
194
+ } else {
195
+ if( isset( $value->user_id ) ) {
196
+ $user_id = $value->user_id;
197
+ }
198
+ $key = 'billing_email';
199
+ $single = true;
200
+ $user_biiling_email = get_user_meta( $user_id, $key, $single );
201
+
202
+ if( isset( $user_biiling_email ) && $user_biiling_email != '' ){
203
+ $value->user_email = $user_biiling_email;
204
+ }
205
+ }
206
+ if( isset( $value->abandoned_cart_info ) ) {
207
+ $cart_info_db_field = json_decode( $value->abandoned_cart_info );
208
+ }
209
+ if( count( $cart_info_db_field->cart ) > 0 ) {
210
+ $cart_update_time = $value->abandoned_cart_time;
211
+ $new_user = $this->wcal_check_sent_history( $value->user_id, $cart_update_time, $template_id, $value->id );
212
+
213
+ if ( $new_user == true ) {
214
+ $cart_info_db = $value->abandoned_cart_info;
215
+ $email_body = $email_body_template;
216
+
217
+ if ( $value->user_type == "GUEST" ) {
218
+ if ( isset( $results_guest[0]->billing_first_name ) ) {
219
+ $email_body = str_replace( "{{customer.firstname}}", $results_guest[0]->billing_first_name, $email_body );
220
+ $email_subject = str_replace( "{{customer.firstname}}", $results_guest[0]->billing_first_name, $email_subject );
221
+ }
222
+ if ( isset( $results_guest[0]->billing_last_name ) ) {
223
+ $email_body = str_replace( "{{customer.lastname}}", $results_guest[0]->billing_last_name, $email_body );
224
+ }
225
+
226
+ if ( isset( $results_guest[0]->billing_first_name ) && isset( $results_guest[0]->billing_last_name ) ) {
227
+ $email_body = str_replace( "{{customer.fullname}}", $results_guest[0]->billing_first_name." ".$results_guest[0]->billing_last_name, $email_body );
228
+ }
229
+ else if ( isset( $results_guest[0]->billing_first_name ) ) {
230
+ $email_body = str_replace( "{{customer.fullname}}", $results_guest[0]->billing_first_name, $email_body );
231
+ }
232
+ else if ( isset( $results_guest[0]->billing_last_name ) ) {
233
+ $email_body = str_replace( "{{customer.fullname}}", $results_guest[0]->billing_last_name, $email_body );
234
+ }
235
+ } else {
236
+ $user_first_name = '';
237
+ //
238
+ $user_first_name_temp = get_user_meta( $value->user_id, 'billing_first_name', true );
239
+ if( isset( $user_first_name_temp ) && "" == $user_first_name_temp ) {
240
+ $user_data = get_userdata( $user_id );
241
+ $user_first_name = $user_data->first_name;
242
+ } else {
243
+ $user_first_name = $user_first_name_temp;
244
+ }
245
+
246
+ $email_body = str_replace( "{{customer.firstname}}", $user_first_name, $email_body );
247
+ $email_subject = str_replace( "{{customer.firstname}}", $user_first_name, $email_subject );
248
+ $user_last_name = '';
249
+ $user_last_name_temp = get_user_meta( $value->user_id, 'billing_last_name', true );
250
+ if( isset( $user_last_name_temp ) && "" == $user_last_name_temp ) {
251
+ $user_data = get_userdata( $user_id );
252
+ $user_last_name = $user_data->last_name;
253
+ } else {
254
+ $user_last_name = $user_last_name_temp;
255
+ }
256
+ $email_body = str_replace( "{{customer.lastname}}", $user_last_name, $email_body );
257
+ $email_body = str_replace( "{{customer.fullname}}", $user_first_name." ".$user_last_name, $email_body );
258
+ }
259
+
260
+ $order_date = "";
261
+ if( $cart_update_time != "" && $cart_update_time != 0 ) {
262
+ $order_date = date( 'd M, Y h:i A', $cart_update_time );
263
+ }
264
+
265
+ $email_body = str_replace( "{{cart.abandoned_date}}", $order_date, $email_body );
266
+
267
+ $query_sent = "INSERT INTO `".$wpdb->prefix."ac_sent_history_lite` ( template_id, abandoned_order_id, sent_time, sent_email_id )
268
+ VALUES ( %s, %s, '".current_time( 'mysql' )."', %s )";
269
+
270
+ $wpdb->query( $wpdb->prepare( $query_sent, $template_id, $value->id, $value->user_email ) );
271
+
272
+ $query_id = "SELECT * FROM `".$wpdb->prefix."ac_sent_history_lite`
273
+ WHERE template_id = %s AND abandoned_order_id = %s
274
+ ORDER BY id DESC
275
+ LIMIT 1 ";
276
+ $results_sent = $wpdb->get_results( $wpdb->prepare( $query_id, $template_id, $value->id ) );
277
+
278
+ $email_sent_id = $results_sent[0]->id;
279
+
280
+ if( $woocommerce->version < '2.3' ) {
281
+ $cart_page_link = $woocommerce->cart->get_cart_url();
282
+ } else {
283
+ $cart_page_id = woocommerce_get_page_id( 'cart' );
284
+ $cart_page_link = $cart_page_id ? get_permalink( $cart_page_id ) : '';
285
+ }
286
+
287
+ $encoding_cart = $email_sent_id.'&url='.$cart_page_link;
288
+ $validate_cart = $this->wcal_encrypt_validate( $encoding_cart );
289
+ $cart_link_track = get_option('siteurl').'/?wcal_action=track_links&validate=' . $validate_cart;
290
+ $email_body = str_replace( "{{cart.link}}", $cart_link_track, $email_body );
291
+
292
+ $validate_unsubscribe = $this->wcal_encrypt_validate( $email_sent_id );
293
+ $email_sent_id_address = $results_sent[0]->sent_email_id;
294
+ $encrypt_email_sent_id_address = hash( 'sha256', $email_sent_id_address );
295
+ $plugins_url = get_option( 'siteurl' ) . "/?wcal_track_unsubscribe=wcal_unsubscribe&validate=" . $validate_unsubscribe . "&track_email_id=" . $encrypt_email_sent_id_address;
296
+ $unsubscribe_link_track = $plugins_url;
297
+ $email_body = str_replace( "{{cart.unsubscribe}}" , $unsubscribe_link_track , $email_body );
298
+ $var = '';
299
+ if( preg_match( "{{products.cart}}", $email_body, $matched ) ) {
300
+ $var = '<h3>'.__( "Your Shopping Cart", "woocommerce-ac" ).'</h3>
301
+ <table border="0" cellpadding="10" cellspacing="0" class="templateDataTable">
302
+ <tr>
303
+ <th>'.__( "Item", "woocommerce-ac" ).'</th>
304
+ <th>'.__( "Name", "woocommerce-ac" ).'</th>
305
+ <th>'.__( "Quantity", "woocommerce-ac" ).'</th>
306
+ <th>'.__( "Price", "woocommerce-ac" ).'</th>
307
+ <th>'.__( "Line Subtotal", "woocommerce-ac" ).'</th>
308
+ </tr>';
309
+ $cart_details = $cart_info_db_field->cart;
310
+ $cart_total = $item_subtotal = $item_total = 0;
311
+ $sub_line_prod_name = '';
312
+ foreach ( $cart_details as $k => $v ) {
313
+ $quantity_total = $v->quantity;
314
+ $product_id = $v->product_id;
315
+ $prod_name = get_post( $product_id );
316
+ $product_link_track = get_permalink( $product_id );
317
+ $product_name = $prod_name->post_title;
318
+ if( $sub_line_prod_name == '' ) {
319
+ $sub_line_prod_name = $product_name;
320
+ }
321
+ // Item subtotal is calculated as product total including taxes
322
+ if( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
323
+ $item_subtotal = $item_subtotal + $v->line_total + $v->line_subtotal_tax;
324
+ } else {
325
+ $item_subtotal = $item_subtotal + $v->line_total;
326
+ }
327
+
328
+ // Line total
329
+ $item_total = $item_subtotal;
330
+ $item_subtotal = $item_subtotal / $quantity_total;
331
+ $item_total_display = wc_price( $item_total );
332
+ $item_subtotal = wc_price( $item_subtotal );
333
+ $product = get_product( $product_id );
334
+ $prod_image = $product->get_image();
335
+ $image_url = wp_get_attachment_url( get_post_thumbnail_id( $product_id ) );
336
+
337
+ if ( isset( $v->variation_id ) && '' != $v->variation_id ){
338
+ $variation_id = $v->variation_id;
339
+ $variation = wc_get_product( $variation_id );
340
+ $name = $variation->get_formatted_name() ;
341
+ $explode_all = explode ( "&ndash;", $name );
342
+ $pro_name_variation = array_slice( $explode_all, 1, -1 );
343
+ $product_name_with_variable = '';
344
+ $explode_many_varaition = array();
345
+
346
+ foreach ( $pro_name_variation as $pro_name_variation_key => $pro_name_variation_value ){
347
+ $explode_many_varaition = explode ( ",", $pro_name_variation_value );
348
+ if ( !empty( $explode_many_varaition ) ) {
349
+ foreach( $explode_many_varaition as $explode_many_varaition_key => $explode_many_varaition_value ){
350
+ $product_name_with_variable = $product_name_with_variable . "<br>". html_entity_decode ( $explode_many_varaition_value );
351
+ }
352
+ } else {
353
+ $product_name_with_variable = $product_name_with_variable . "<br>". html_entity_decode ( $explode_many_varaition_value );
354
+ }
355
+ }
356
+
357
+ $product_name = $product_name_with_variable;
358
+ }
359
+ $var .='<tr align="center">
360
+ <td> <a href="'.$cart_link_track.'"> <img src="' . $image_url . '" alt="" height="42" width="42" /> </a></td>
361
+ <td> <a href="'.$cart_link_track.'">'.__( $product_name, "woocommerce-ac" ).'</a></td>
362
+ <td> '.$quantity_total.'</td>
363
+ <td> '.$item_subtotal.'</td>
364
+ <td> '.$item_total_display.'</td>
365
+ </tr>';
366
+ $cart_total += $item_total;
367
+ $item_subtotal = $item_total = 0;
368
+ }
369
+ $cart_total = wc_price( $cart_total );
370
+ $var .= '<tr align="center">
371
+ <td> </td>
372
+ <td> </td>
373
+ <td> </td>
374
+ <td>'.__( "Cart Total:", "woocommerce-ac" ).'</td>
375
+ <td> '.$cart_total.'</td>
376
+ </tr>';
377
+ $var .= '</table>
378
+ ';
379
+ $email_body = str_replace( "{{products.cart}}", $var, $email_body );
380
+ $email_subject = str_replace( "{{product.name}}", __( $sub_line_prod_name, "woocommerce-ac" ), $email_subject );
381
+ }
382
+
383
+ $user_email = $value->user_email;
384
+ $email_body_final = stripslashes( $email_body );
385
+
386
+ if ( isset( $is_wc_template ) && "1" == $is_wc_template ){
387
+ ob_start();
388
+
389
+ wc_get_template( 'emails/email-header.php', array( 'email_heading' => $wc_template_header ) );
390
+ $email_body_template_header = ob_get_clean();
391
+
392
+ ob_start();
393
+
394
+ wc_get_template( 'emails/email-footer.php' );
395
+ $email_body_template_footer = ob_get_clean();
396
+
397
+ $final_email_body = $email_body_template_header . $email_body_final . $email_body_template_footer;
398
+
399
+ wc_mail( $user_email, $email_subject, $final_email_body, $headers );
400
+
401
+ } else {
402
+ wp_mail( $user_email, $email_subject, __( $email_body_final, 'woocommerce-ac' ), $headers );
403
+ }
404
+ }
405
+ }
406
+ }
407
+ }
408
+ }
409
+ }
410
+ /**
411
+ * get all carts which have the creation time earlier than the one that is passed
412
+ */
413
+ function wcal_get_carts( $template_to_send_after_time, $cart_abandon_cut_off_time ) {
414
+ global $wpdb;
415
+ $cart_time = current_time( 'timestamp' ) - $template_to_send_after_time - $cart_abandon_cut_off_time;
416
+ $cart_ignored = 0;
417
+ $unsubscribe = 0;
418
+ $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac
419
+ LEFT JOIN ".$wpdb->base_prefix."users AS wpu ON wpac.user_id = wpu.id
420
+ WHERE cart_ignored = %s AND unsubscribe_link = %s AND abandoned_cart_time < $cart_time
421
+ ORDER BY `id` ASC ";
422
+
423
+ $results = $wpdb->get_results( $wpdb->prepare( $query, $cart_ignored, $unsubscribe ) );
424
+ return $results;
425
+ exit;
426
+ }
427
+
428
+ public static function wcal_remove_cart_for_mutiple_templates( $carts, $time_to_send_template_after, $template_id ) {
429
+ global $wpdb;
430
+
431
+ foreach( $carts as $carts_key => $carts_value ) {
432
+ $wcal_get_last_email_sent_time = "SELECT * FROM `" . $wpdb->prefix . "ac_sent_history_lite` WHERE abandoned_order_id = $carts_value->id ORDER BY `sent_time` DESC LIMIT 1";
433
+ $wcal_get_last_email_sent_time_results_list = $wpdb->get_results( $wcal_get_last_email_sent_time );
434
+
435
+ if( count( $wcal_get_last_email_sent_time_results_list ) > 0 ) {
436
+ $last_template_send_time = strtotime( $wcal_get_last_email_sent_time_results_list[0]->sent_time );
437
+ $second_template_send_time = $last_template_send_time + $time_to_send_template_after ;
438
+ $current_time_test = current_time( 'timestamp' );
439
+
440
+ if( $second_template_send_time > $current_time_test ) {
441
+ unset( $carts [ $carts_key ] );
442
+ }
443
+ }
444
+ }
445
+ return $carts;
446
+ }
447
+ /******
448
+ * This function is used to encode the validate string.
449
+ ******/
450
+ function wcal_encrypt_validate( $validate ) {
451
+ $cryptKey = get_option( 'wcal_security_key' );
452
+ $validate_encoded = Wcal_Aes_Ctr::encrypt( $validate, $cryptKey, 256 );
453
+ return( $validate_encoded );
454
+ }
455
+
456
+ function wcal_check_sent_history( $user_id, $cart_update_time, $template_id, $id ) {
457
+ global $wpdb;
458
+ $query = "SELECT wpcs . * , wpac . abandoned_cart_time , wpac . user_id FROM `".$wpdb->prefix."ac_sent_history_lite` AS wpcs
459
+ LEFT JOIN ".$wpdb->prefix."ac_abandoned_cart_history_lite AS wpac ON wpcs.abandoned_order_id = wpac.id
460
+ WHERE template_id = %s AND wpcs.abandoned_order_id = %d ORDER BY 'id' DESC LIMIT 1 ";
461
+
462
+ $results = $wpdb->get_results( $wpdb->prepare( $query, $template_id, $id ) );
463
+ if ( count( $results ) == 0 )
464
+ {
465
+ return true;
466
+ }
467
+ elseif ( $results[0]->abandoned_cart_time < $cart_update_time )
468
+ {
469
+ return true;
470
+ }
471
+ else
472
+ {
473
+ return false;
474
+ }
475
+ }
476
+ }
477
+ }
478
+ $woocommerce_abandon_cart_cron = new woocommerce_abandon_cart_cron();
479
+ $woocommerce_abandon_cart_cron->wcal_send_email_notification();
480
+
481
+ ?>
{languages → i18n/languages}/messages.pot RENAMED
@@ -1,268 +1,268 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- #, fuzzy
7
- msgid ""
8
- msgstr ""
9
- "Project-Id-Version: PACKAGE VERSION\n"
10
- "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2015-07-08 16:30+0530\n"
12
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "Language: \n"
16
- "MIME-Version: 1.0\n"
17
- "Content-Type: text/plain; charset=CHARSET\n"
18
- "Content-Transfer-Encoding: 8bit\n"
19
-
20
- #: woocommerce-ac.php:22
21
- msgid "Once Every Five Minutes"
22
- msgstr ""
23
-
24
- #: woocommerce-ac.php:204
25
- #, php-format
26
- msgid ""
27
- "You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
28
- "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
29
- "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
30
- "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
31
- "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
32
- msgstr ""
33
-
34
- #: woocommerce-ac.php:314
35
- msgid "Abandoned Carts"
36
- msgstr ""
37
-
38
- #: woocommerce-ac.php:516
39
- msgid "Abandoned Orders"
40
- msgstr ""
41
-
42
- #: woocommerce-ac.php:517
43
- msgid "Email Templates"
44
- msgstr ""
45
-
46
- #: woocommerce-ac.php:518 woocommerce-ac.php:712
47
- msgid "Settings"
48
- msgstr ""
49
-
50
- #: woocommerce-ac.php:519
51
- msgid "Recovered Orders"
52
- msgstr ""
53
-
54
- #: woocommerce-ac.php:661
55
- msgid "You do not have sufficient permissions to access this page."
56
- msgstr ""
57
-
58
- #: woocommerce-ac.php:670
59
- msgid "WooCommerce - Abandon Cart Lite"
60
- msgstr ""
61
-
62
- #: woocommerce-ac.php:696
63
- msgid "Your settings have been saved."
64
- msgstr ""
65
-
66
- #: woocommerce-ac.php:718
67
- msgid "Cart abandoned cut-off time"
68
- msgstr ""
69
-
70
- #: woocommerce-ac.php:741
71
- msgid "minutes"
72
- msgstr ""
73
-
74
- #: woocommerce-ac.php:742 woocommerce-ac.php:743
75
- msgid ""
76
- "Consider cart abandoned after X minutes of item being added to cart & order "
77
- "not placed"
78
- msgstr ""
79
-
80
- #: woocommerce-ac.php:753
81
- msgid "Save Changes"
82
- msgstr ""
83
-
84
- #: woocommerce-ac.php:763
85
- msgid ""
86
- "The list below shows all Abandoned Carts which have remained in cart for a "
87
- "time higher than the \"Cart abandoned cut-off time\" setting."
88
- msgstr ""
89
-
90
- #: woocommerce-ac.php:858 woocommerce-ac.php:1501
91
- msgid "Customer"
92
- msgstr ""
93
-
94
- #: woocommerce-ac.php:859 woocommerce-ac.php:1514
95
- msgid "Order Total"
96
- msgstr ""
97
-
98
- #: woocommerce-ac.php:862
99
- msgid "Date"
100
- msgstr ""
101
-
102
- #: woocommerce-ac.php:868
103
- msgid "Status"
104
- msgstr ""
105
-
106
- #: woocommerce-ac.php:872 woocommerce-ac.php:1159
107
- msgid "Actions"
108
- msgstr ""
109
-
110
- #: woocommerce-ac.php:953
111
- msgid ""
112
- "Add email templates at different intervals to maximize the possibility of "
113
- "recovering your abandoned carts."
114
- msgstr ""
115
-
116
- #: woocommerce-ac.php:1054
117
- msgid "The Email Template has been successfully added."
118
- msgstr ""
119
-
120
- #: woocommerce-ac.php:1057
121
- msgid "The Email Template has been successfully updated."
122
- msgstr ""
123
-
124
- #: woocommerce-ac.php:1145
125
- msgid "Sr"
126
- msgstr ""
127
-
128
- #: woocommerce-ac.php:1148
129
- msgid "Template Name"
130
- msgstr ""
131
-
132
- #: woocommerce-ac.php:1154
133
- msgid "Sent"
134
- msgstr ""
135
-
136
- #: woocommerce-ac.php:1158
137
- msgid "Active ?"
138
- msgstr ""
139
-
140
- #: woocommerce-ac.php:1276
141
- msgid ""
142
- "The Report below shows how many Abandoned Carts we were able to recover for "
143
- "you by sending automatic emails to encourage shoppers."
144
- msgstr ""
145
-
146
- #: woocommerce-ac.php:1331
147
- msgid "Start Date:"
148
- msgstr ""
149
-
150
- #: woocommerce-ac.php:1334
151
- msgid "End Date:"
152
- msgstr ""
153
-
154
- #: woocommerce-ac.php:1337
155
- msgid "Go"
156
- msgstr ""
157
-
158
- #: woocommerce-ac.php:1495
159
- msgid "During the selected range"
160
- msgstr ""
161
-
162
- #: woocommerce-ac.php:1495
163
- msgid "carts totaling"
164
- msgstr ""
165
-
166
- #: woocommerce-ac.php:1495
167
- msgid "were abandoned. We were able to recover"
168
- msgstr ""
169
-
170
- #: woocommerce-ac.php:1495
171
- msgid "of them, which led to an extra"
172
- msgstr ""
173
-
174
- #: woocommerce-ac.php:1495
175
- msgid "in sales"
176
- msgstr ""
177
-
178
- #: woocommerce-ac.php:1504
179
- msgid "Created On"
180
- msgstr ""
181
-
182
- #: woocommerce-ac.php:1510
183
- msgid "Recovered Date"
184
- msgstr ""
185
-
186
- #: woocommerce-ac.php:1561
187
- msgid "Template Name:"
188
- msgstr ""
189
-
190
- #: woocommerce-ac.php:1572
191
- msgid "Enter a template name for reference"
192
- msgstr ""
193
-
194
- #: woocommerce-ac.php:1577
195
- msgid "Send From This Name:"
196
- msgstr ""
197
-
198
- #: woocommerce-ac.php:1588
199
- msgid "Enter the name that should appear in the email sent"
200
- msgstr ""
201
-
202
- #: woocommerce-ac.php:1594
203
- msgid "Subject:"
204
- msgstr ""
205
-
206
- #: woocommerce-ac.php:1605
207
- msgid "Enter the subject that should appear in the email sent"
208
- msgstr ""
209
-
210
- #: woocommerce-ac.php:1611
211
- msgid "Email Body:"
212
- msgstr ""
213
-
214
- #: woocommerce-ac.php:1627
215
- msgid "Message to be sent in the reminder email."
216
- msgstr ""
217
-
218
- #: woocommerce-ac.php:1634
219
- msgid "Send this email:"
220
- msgstr ""
221
-
222
- #: woocommerce-ac.php:1686
223
- msgid "after cart is abandoned."
224
- msgstr ""
225
-
226
- #: woocommerce-ac.php:1693
227
- msgid "Send a test email to:"
228
- msgstr ""
229
-
230
- #: woocommerce-ac.php:1699
231
- msgid "Enter the email id to which the test email needs to be sent."
232
- msgstr ""
233
-
234
- #: woocommerce-ac.php:1835 send_email.php:109
235
- msgid "Your Shopping Cart"
236
- msgstr ""
237
-
238
- #: woocommerce-ac.php:1838 send_email.php:112
239
- msgid "Item"
240
- msgstr ""
241
-
242
- #: woocommerce-ac.php:1839 send_email.php:113
243
- msgid "Name"
244
- msgstr ""
245
-
246
- #: woocommerce-ac.php:1840 send_email.php:114
247
- msgid "Quantity"
248
- msgstr ""
249
-
250
- #: woocommerce-ac.php:1841 send_email.php:115
251
- msgid "Price"
252
- msgstr ""
253
-
254
- #: woocommerce-ac.php:1842 send_email.php:116
255
- msgid "Line Subtotal"
256
- msgstr ""
257
-
258
- #: woocommerce-ac.php:1846
259
- msgid "Men\\'\\s Formal Shoes"
260
- msgstr ""
261
-
262
- #: woocommerce-ac.php:1853
263
- msgid "Woman\\'\\s Hand Bags"
264
- msgstr ""
265
-
266
- #: woocommerce-ac.php:1862 send_email.php:160
267
- msgid "Cart Total:"
268
- msgstr ""
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: PACKAGE VERSION\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2015-07-08 16:30+0530\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "Language: \n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=CHARSET\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+
20
+ #: woocommerce-ac.php:22
21
+ msgid "Once Every Five Minutes"
22
+ msgstr ""
23
+
24
+ #: woocommerce-ac.php:204
25
+ #, php-format
26
+ msgid ""
27
+ "You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
28
+ "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
29
+ "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
30
+ "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
31
+ "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
32
+ msgstr ""
33
+
34
+ #: woocommerce-ac.php:314
35
+ msgid "Abandoned Carts"
36
+ msgstr ""
37
+
38
+ #: woocommerce-ac.php:516
39
+ msgid "Abandoned Orders"
40
+ msgstr ""
41
+
42
+ #: woocommerce-ac.php:517
43
+ msgid "Email Templates"
44
+ msgstr ""
45
+
46
+ #: woocommerce-ac.php:518 woocommerce-ac.php:712
47
+ msgid "Settings"
48
+ msgstr ""
49
+
50
+ #: woocommerce-ac.php:519
51
+ msgid "Recovered Orders"
52
+ msgstr ""
53
+
54
+ #: woocommerce-ac.php:661
55
+ msgid "You do not have sufficient permissions to access this page."
56
+ msgstr ""
57
+
58
+ #: woocommerce-ac.php:670
59
+ msgid "WooCommerce - Abandon Cart Lite"
60
+ msgstr ""
61
+
62
+ #: woocommerce-ac.php:696
63
+ msgid "Your settings have been saved."
64
+ msgstr ""
65
+
66
+ #: woocommerce-ac.php:718
67
+ msgid "Cart abandoned cut-off time"
68
+ msgstr ""
69
+
70
+ #: woocommerce-ac.php:741
71
+ msgid "minutes"
72
+ msgstr ""
73
+
74
+ #: woocommerce-ac.php:742 woocommerce-ac.php:743
75
+ msgid ""
76
+ "Consider cart abandoned after X minutes of item being added to cart & order "
77
+ "not placed"
78
+ msgstr ""
79
+
80
+ #: woocommerce-ac.php:753
81
+ msgid "Save Changes"
82
+ msgstr ""
83
+
84
+ #: woocommerce-ac.php:763
85
+ msgid ""
86
+ "The list below shows all Abandoned Carts which have remained in cart for a "
87
+ "time higher than the \"Cart abandoned cut-off time\" setting."
88
+ msgstr ""
89
+
90
+ #: woocommerce-ac.php:858 woocommerce-ac.php:1501
91
+ msgid "Customer"
92
+ msgstr ""
93
+
94
+ #: woocommerce-ac.php:859 woocommerce-ac.php:1514
95
+ msgid "Order Total"
96
+ msgstr ""
97
+
98
+ #: woocommerce-ac.php:862
99
+ msgid "Date"
100
+ msgstr ""
101
+
102
+ #: woocommerce-ac.php:868
103
+ msgid "Status"
104
+ msgstr ""
105
+
106
+ #: woocommerce-ac.php:872 woocommerce-ac.php:1159
107
+ msgid "Actions"
108
+ msgstr ""
109
+
110
+ #: woocommerce-ac.php:953
111
+ msgid ""
112
+ "Add email templates at different intervals to maximize the possibility of "
113
+ "recovering your abandoned carts."
114
+ msgstr ""
115
+
116
+ #: woocommerce-ac.php:1054
117
+ msgid "The Email Template has been successfully added."
118
+ msgstr ""
119
+
120
+ #: woocommerce-ac.php:1057
121
+ msgid "The Email Template has been successfully updated."
122
+ msgstr ""
123
+
124
+ #: woocommerce-ac.php:1145
125
+ msgid "Sr"
126
+ msgstr ""
127
+
128
+ #: woocommerce-ac.php:1148
129
+ msgid "Template Name"
130
+ msgstr ""
131
+
132
+ #: woocommerce-ac.php:1154
133
+ msgid "Sent"
134
+ msgstr ""
135
+
136
+ #: woocommerce-ac.php:1158
137
+ msgid "Active ?"
138
+ msgstr ""
139
+
140
+ #: woocommerce-ac.php:1276
141
+ msgid ""
142
+ "The Report below shows how many Abandoned Carts we were able to recover for "
143
+ "you by sending automatic emails to encourage shoppers."
144
+ msgstr ""
145
+
146
+ #: woocommerce-ac.php:1331
147
+ msgid "Start Date:"
148
+ msgstr ""
149
+
150
+ #: woocommerce-ac.php:1334
151
+ msgid "End Date:"
152
+ msgstr ""
153
+
154
+ #: woocommerce-ac.php:1337
155
+ msgid "Go"
156
+ msgstr ""
157
+
158
+ #: woocommerce-ac.php:1495
159
+ msgid "During the selected range"
160
+ msgstr ""
161
+
162
+ #: woocommerce-ac.php:1495
163
+ msgid "carts totaling"
164
+ msgstr ""
165
+
166
+ #: woocommerce-ac.php:1495
167
+ msgid "were abandoned. We were able to recover"
168
+ msgstr ""
169
+
170
+ #: woocommerce-ac.php:1495
171
+ msgid "of them, which led to an extra"
172
+ msgstr ""
173
+
174
+ #: woocommerce-ac.php:1495
175
+ msgid "in sales"
176
+ msgstr ""
177
+
178
+ #: woocommerce-ac.php:1504
179
+ msgid "Created On"
180
+ msgstr ""
181
+
182
+ #: woocommerce-ac.php:1510
183
+ msgid "Recovered Date"
184
+ msgstr ""
185
+
186
+ #: woocommerce-ac.php:1561
187
+ msgid "Template Name:"
188
+ msgstr ""
189
+
190
+ #: woocommerce-ac.php:1572
191
+ msgid "Enter a template name for reference"
192
+ msgstr ""
193
+
194
+ #: woocommerce-ac.php:1577
195
+ msgid "Send From This Name:"
196
+ msgstr ""
197
+
198
+ #: woocommerce-ac.php:1588
199
+ msgid "Enter the name that should appear in the email sent"
200
+ msgstr ""
201
+
202
+ #: woocommerce-ac.php:1594
203
+ msgid "Subject:"
204
+ msgstr ""
205
+
206
+ #: woocommerce-ac.php:1605
207
+ msgid "Enter the subject that should appear in the email sent"
208
+ msgstr ""
209
+
210
+ #: woocommerce-ac.php:1611
211
+ msgid "Email Body:"
212
+ msgstr ""
213
+
214
+ #: woocommerce-ac.php:1627
215
+ msgid "Message to be sent in the reminder email."
216
+ msgstr ""
217
+
218
+ #: woocommerce-ac.php:1634
219
+ msgid "Send this email:"
220
+ msgstr ""
221
+
222
+ #: woocommerce-ac.php:1686
223
+ msgid "after cart is abandoned."
224
+ msgstr ""
225
+
226
+ #: woocommerce-ac.php:1693
227
+ msgid "Send a test email to:"
228
+ msgstr ""
229
+
230
+ #: woocommerce-ac.php:1699
231
+ msgid "Enter the email id to which the test email needs to be sent."
232
+ msgstr ""
233
+
234
+ #: woocommerce-ac.php:1835 send_email.php:109
235
+ msgid "Your Shopping Cart"
236
+ msgstr ""
237
+
238
+ #: woocommerce-ac.php:1838 send_email.php:112
239
+ msgid "Item"
240
+ msgstr ""
241
+
242
+ #: woocommerce-ac.php:1839 send_email.php:113
243
+ msgid "Name"
244
+ msgstr ""
245
+
246
+ #: woocommerce-ac.php:1840 send_email.php:114
247
+ msgid "Quantity"
248
+ msgstr ""
249
+
250
+ #: woocommerce-ac.php:1841 send_email.php:115
251
+ msgid "Price"
252
+ msgstr ""
253
+
254
+ #: woocommerce-ac.php:1842 send_email.php:116
255
+ msgid "Line Subtotal"
256
+ msgstr ""
257
+
258
+ #: woocommerce-ac.php:1846
259
+ msgid "Men\\'\\s Formal Shoes"
260
+ msgstr ""
261
+
262
+ #: woocommerce-ac.php:1853
263
+ msgid "Woman\\'\\s Hand Bags"
264
+ msgstr ""
265
+
266
+ #: woocommerce-ac.php:1862 send_email.php:160
267
+ msgid "Cart Total:"
268
+ msgstr ""
{languages → i18n/languages}/woocommerce-ac-de_DE.mo RENAMED
File without changes
{languages → i18n/languages}/woocommerce-ac-de_DE.po RENAMED
@@ -1,283 +1,283 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- msgid ""
7
- msgstr ""
8
- "Project-Id-Version: \n"
9
- "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2015-08-28 16:46+0200\n"
11
- "PO-Revision-Date: 2015-08-28 17:51+0200\n"
12
- "Language-Team: \n"
13
- "MIME-Version: 1.0\n"
14
- "Content-Type: text/plain; charset=UTF-8\n"
15
- "Content-Transfer-Encoding: 8bit\n"
16
- "X-Generator: Poedit 1.8.4\n"
17
- "Last-Translator: \n"
18
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
- "Language: de_DE\n"
20
-
21
- #: woocommerce-ac.php:22
22
- msgid "Once Every Five Minutes"
23
- msgstr "Alle fünf Minuten"
24
-
25
- #: woocommerce-ac.php:204
26
- #, php-format
27
- msgid ""
28
- "You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
29
- "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
30
- "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
31
- "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
32
- "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
33
- msgstr ""
34
- "Sie können auf die <a href=\"https://www.tychesoftwares.com/store/premium-"
35
- "plugins/woocommerce-abandoned-cart-pro/\">PRO version von WooCommerce "
36
- "Abandoned Cart plugin</a> mit 20% Rabatt upgraden. Nutzen Sie den Coupon-"
37
- "Code <b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
38
- "plugins/woocommerce-abandoned-cart-pro/\"> Jetzt kaufen </a> & $24 sparen!"
39
-
40
- #: woocommerce-ac.php:314
41
- msgid "Abandoned Carts"
42
- msgstr "Verlassene Warenkörbe"
43
-
44
- #: woocommerce-ac.php:516
45
- msgid "Abandoned Orders"
46
- msgstr "Abgebrochene Bestellungen"
47
-
48
- #: woocommerce-ac.php:517
49
- msgid "Email Templates"
50
- msgstr "E-Mail-Vorlagen"
51
-
52
- #: woocommerce-ac.php:518 woocommerce-ac.php:712
53
- msgid "Settings"
54
- msgstr "Einstellungen"
55
-
56
- #: woocommerce-ac.php:519
57
- msgid "Recovered Orders"
58
- msgstr "Gerettete Bestellungen"
59
-
60
- #: woocommerce-ac.php:661
61
- msgid "You do not have sufficient permissions to access this page."
62
- msgstr "Sie sind nicht befugt, auf diese Seite zuzugreifen."
63
-
64
- #: woocommerce-ac.php:670
65
- msgid "WooCommerce - Abandon Cart Lite"
66
- msgstr "WooCommerce - Abandon Cart Lite"
67
-
68
- #: woocommerce-ac.php:696
69
- msgid "Your settings have been saved."
70
- msgstr "Die Einstellungen wurden gespeichert."
71
-
72
- #: woocommerce-ac.php:718
73
- msgid "Cart abandoned cut-off time"
74
- msgstr "Verlassene Warenkörbe Cut-Off Zeit"
75
-
76
- #: woocommerce-ac.php:741
77
- msgid "minutes"
78
- msgstr "Minuten"
79
-
80
- #: woocommerce-ac.php:742 woocommerce-ac.php:743
81
- msgid ""
82
- "Consider cart abandoned after X minutes of item being added to cart & order "
83
- "not placed"
84
- msgstr ""
85
- "Warenkorb gilt nach X Minuten zwischen Warenkorb gefüllt und Bestellung "
86
- "abgebrochen als verlassen."
87
-
88
- #: woocommerce-ac.php:753
89
- msgid "Save Changes"
90
- msgstr "Änderungen Speichern"
91
-
92
- #: woocommerce-ac.php:763
93
- msgid ""
94
- "The list below shows all Abandoned Carts which have remained in cart for a "
95
- "time higher than the \"Cart abandoned cut-off time\" setting."
96
- msgstr ""
97
- "Die untenstehende Liste zeigt alle verlassenen Warenkörbe, die nach der Zeit "
98
- "bei \"Verlassene Warenkörbe Cut-Off Zeit\" noch existieren."
99
-
100
- #: woocommerce-ac.php:858 woocommerce-ac.php:1501
101
- msgid "Customer"
102
- msgstr "Kunde"
103
-
104
- #: woocommerce-ac.php:859 woocommerce-ac.php:1514
105
- msgid "Order Total"
106
- msgstr "Bestellung gesamt"
107
-
108
- #: woocommerce-ac.php:862
109
- msgid "Date"
110
- msgstr "Datum:"
111
-
112
- #: woocommerce-ac.php:868
113
- msgid "Status"
114
- msgstr "Status"
115
-
116
- #: woocommerce-ac.php:872 woocommerce-ac.php:1159
117
- msgid "Actions"
118
- msgstr "Aktionen"
119
-
120
- #: woocommerce-ac.php:953
121
- msgid ""
122
- "Add email templates at different intervals to maximize the possibility of "
123
- "recovering your abandoned carts."
124
- msgstr ""
125
- "Fügen Sie E-Mail Vorlagen für unterschiedliche Zeitintervalle hinzu, um die "
126
- "Chancen zu erhöhen, einen verlassenen Warenkorb in eine Bestellung zu "
127
- "konvertieren."
128
-
129
- #: woocommerce-ac.php:1054
130
- msgid "The Email Template has been successfully added."
131
- msgstr "Die E-Mail Vorlage wurde erfolgreich hinzugefügt."
132
-
133
- #: woocommerce-ac.php:1057
134
- msgid "The Email Template has been successfully updated."
135
- msgstr "Die E-Mail Vorlage wurde erfolgreich angepasst."
136
-
137
- #: woocommerce-ac.php:1145
138
- msgid "Sr"
139
- msgstr "Nr."
140
-
141
- #: woocommerce-ac.php:1148
142
- msgid "Template Name"
143
- msgstr "Vorlagenname"
144
-
145
- #: woocommerce-ac.php:1154
146
- msgid "Sent"
147
- msgstr "Gesendet"
148
-
149
- #: woocommerce-ac.php:1158
150
- msgid "Active ?"
151
- msgstr "aktiv?"
152
-
153
- #: woocommerce-ac.php:1276
154
- msgid ""
155
- "The Report below shows how many Abandoned Carts we were able to recover for "
156
- "you by sending automatic emails to encourage shoppers."
157
- msgstr ""
158
- "Der untenstehende Report zeigt, wieviele verlassene Warenkörbe aufgrund der "
159
- "E-Mailautomatik gerettet wurden."
160
-
161
- #: woocommerce-ac.php:1331
162
- msgid "Start Date:"
163
- msgstr "Startdatum:"
164
-
165
- #: woocommerce-ac.php:1334
166
- msgid "End Date:"
167
- msgstr "Enddatum:"
168
-
169
- #: woocommerce-ac.php:1337
170
- msgid "Go"
171
- msgstr "Los"
172
-
173
- #: woocommerce-ac.php:1495
174
- msgid "During the selected range"
175
- msgstr "Während des gewählten Zeitraums wurden"
176
-
177
- #: woocommerce-ac.php:1495
178
- msgid "carts totaling"
179
- msgstr "Warenkörbe mit einem Gesamtwert von"
180
-
181
- #: woocommerce-ac.php:1495
182
- msgid "were abandoned. We were able to recover"
183
- msgstr "verlassen. Es konnten"
184
-
185
- #: woocommerce-ac.php:1495
186
- msgid "of them, which led to an extra"
187
- msgstr "dieser Warenkörbe gerettet werden, was zu einem Extra-Umsatz von"
188
-
189
- #: woocommerce-ac.php:1495
190
- msgid "in sales"
191
- msgstr "führte."
192
-
193
- #: woocommerce-ac.php:1504
194
- msgid "Created On"
195
- msgstr "Erstellt Am"
196
-
197
- #: woocommerce-ac.php:1510
198
- msgid "Recovered Date"
199
- msgstr "Datum der Rettung"
200
-
201
- #: woocommerce-ac.php:1561
202
- msgid "Template Name:"
203
- msgstr "Vorlagenname"
204
-
205
- #: woocommerce-ac.php:1572
206
- msgid "Enter a template name for reference"
207
- msgstr "Geben Sie einen Vorlagennamen als Referenz an"
208
-
209
- #: woocommerce-ac.php:1577
210
- msgid "Send From This Name:"
211
- msgstr "Absendername"
212
-
213
- #: woocommerce-ac.php:1588
214
- msgid "Enter the name that should appear in the email sent"
215
- msgstr "Geben Sie den Absendernamen an, der erscheinen soll"
216
-
217
- #: woocommerce-ac.php:1594
218
- msgid "Subject:"
219
- msgstr "Betreff:"
220
-
221
- #: woocommerce-ac.php:1605
222
- msgid "Enter the subject that should appear in the email sent"
223
- msgstr "Geben Sie den Betreff an, der in der Mail erscheinen soll"
224
-
225
- #: woocommerce-ac.php:1611
226
- msgid "Email Body:"
227
- msgstr "E-Mail-Text:"
228
-
229
- #: woocommerce-ac.php:1627
230
- msgid "Message to be sent in the reminder email."
231
- msgstr "Zu sendende Nachricht in der Erinnerungsmail."
232
-
233
- #: woocommerce-ac.php:1634
234
- msgid "Send this email:"
235
- msgstr "Senden Sie diese e-Mail:"
236
-
237
- #: woocommerce-ac.php:1686
238
- msgid "after cart is abandoned."
239
- msgstr "nachdem der Waernkorb verlassen wurde."
240
-
241
- #: woocommerce-ac.php:1693
242
- msgid "Send a test email to:"
243
- msgstr "Sende Test E-Mail an:"
244
-
245
- #: woocommerce-ac.php:1699
246
- msgid "Enter the email id to which the test email needs to be sent."
247
- msgstr "Geben Sie die Mailadresse für die Test E-Mail ein"
248
-
249
- #: woocommerce-ac.php:1835 send_email.php:109
250
- msgid "Your Shopping Cart"
251
- msgstr "Ihr Warenkorb"
252
-
253
- #: woocommerce-ac.php:1838 send_email.php:112
254
- msgid "Item"
255
- msgstr "Art."
256
-
257
- #: woocommerce-ac.php:1839 send_email.php:113
258
- msgid "Name"
259
- msgstr "Name"
260
-
261
- #: woocommerce-ac.php:1840 send_email.php:114
262
- msgid "Quantity"
263
- msgstr "Anzahl"
264
-
265
- #: woocommerce-ac.php:1841 send_email.php:115
266
- msgid "Price"
267
- msgstr "Preis"
268
-
269
- #: woocommerce-ac.php:1842 send_email.php:116
270
- msgid "Line Subtotal"
271
- msgstr "Zwischensumme"
272
-
273
- #: woocommerce-ac.php:1846
274
- msgid "Men\\'\\s Formal Shoes"
275
- msgstr "Herrenschuhe"
276
-
277
- #: woocommerce-ac.php:1853
278
- msgid "Woman\\'\\s Hand Bags"
279
- msgstr "Frauen Handtaschen"
280
-
281
- #: woocommerce-ac.php:1862 send_email.php:160
282
- msgid "Cart Total:"
283
- msgstr "Warenkorb Total:"
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: \n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2015-08-28 16:46+0200\n"
11
+ "PO-Revision-Date: 2015-08-28 17:51+0200\n"
12
+ "Language-Team: \n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+ "X-Generator: Poedit 1.8.4\n"
17
+ "Last-Translator: \n"
18
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+ "Language: de_DE\n"
20
+
21
+ #: woocommerce-ac.php:22
22
+ msgid "Once Every Five Minutes"
23
+ msgstr "Alle fünf Minuten"
24
+
25
+ #: woocommerce-ac.php:204
26
+ #, php-format
27
+ msgid ""
28
+ "You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
29
+ "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
30
+ "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
31
+ "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
32
+ "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
33
+ msgstr ""
34
+ "Sie können auf die <a href=\"https://www.tychesoftwares.com/store/premium-"
35
+ "plugins/woocommerce-abandoned-cart-pro/\">PRO version von WooCommerce "
36
+ "Abandoned Cart plugin</a> mit 20% Rabatt upgraden. Nutzen Sie den Coupon-"
37
+ "Code <b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
38
+ "plugins/woocommerce-abandoned-cart-pro/\"> Jetzt kaufen </a> & $24 sparen!"
39
+
40
+ #: woocommerce-ac.php:314
41
+ msgid "Abandoned Carts"
42
+ msgstr "Verlassene Warenkörbe"
43
+
44
+ #: woocommerce-ac.php:516
45
+ msgid "Abandoned Orders"
46
+ msgstr "Abgebrochene Bestellungen"
47
+
48
+ #: woocommerce-ac.php:517
49
+ msgid "Email Templates"
50
+ msgstr "E-Mail-Vorlagen"
51
+
52
+ #: woocommerce-ac.php:518 woocommerce-ac.php:712
53
+ msgid "Settings"
54
+ msgstr "Einstellungen"
55
+
56
+ #: woocommerce-ac.php:519
57
+ msgid "Recovered Orders"
58
+ msgstr "Gerettete Bestellungen"
59
+
60
+ #: woocommerce-ac.php:661
61
+ msgid "You do not have sufficient permissions to access this page."
62
+ msgstr "Sie sind nicht befugt, auf diese Seite zuzugreifen."
63
+
64
+ #: woocommerce-ac.php:670
65
+ msgid "WooCommerce - Abandon Cart Lite"
66
+ msgstr "WooCommerce - Abandon Cart Lite"
67
+
68
+ #: woocommerce-ac.php:696
69
+ msgid "Your settings have been saved."
70
+ msgstr "Die Einstellungen wurden gespeichert."
71
+
72
+ #: woocommerce-ac.php:718
73
+ msgid "Cart abandoned cut-off time"
74
+ msgstr "Verlassene Warenkörbe Cut-Off Zeit"
75
+
76
+ #: woocommerce-ac.php:741
77
+ msgid "minutes"
78
+ msgstr "Minuten"
79
+
80
+ #: woocommerce-ac.php:742 woocommerce-ac.php:743
81
+ msgid ""
82
+ "Consider cart abandoned after X minutes of item being added to cart & order "
83
+ "not placed"
84
+ msgstr ""
85
+ "Warenkorb gilt nach X Minuten zwischen Warenkorb gefüllt und Bestellung "
86
+ "abgebrochen als verlassen."
87
+
88
+ #: woocommerce-ac.php:753
89
+ msgid "Save Changes"
90
+ msgstr "Änderungen Speichern"
91
+
92
+ #: woocommerce-ac.php:763
93
+ msgid ""
94
+ "The list below shows all Abandoned Carts which have remained in cart for a "
95
+ "time higher than the \"Cart abandoned cut-off time\" setting."
96
+ msgstr ""
97
+ "Die untenstehende Liste zeigt alle verlassenen Warenkörbe, die nach der Zeit "
98
+ "bei \"Verlassene Warenkörbe Cut-Off Zeit\" noch existieren."
99
+
100
+ #: woocommerce-ac.php:858 woocommerce-ac.php:1501
101
+ msgid "Customer"
102
+ msgstr "Kunde"
103
+
104
+ #: woocommerce-ac.php:859 woocommerce-ac.php:1514
105
+ msgid "Order Total"
106
+ msgstr "Bestellung gesamt"
107
+
108
+ #: woocommerce-ac.php:862
109
+ msgid "Date"
110
+ msgstr "Datum:"
111
+
112
+ #: woocommerce-ac.php:868
113
+ msgid "Status"
114
+ msgstr "Status"
115
+
116
+ #: woocommerce-ac.php:872 woocommerce-ac.php:1159
117
+ msgid "Actions"
118
+ msgstr "Aktionen"
119
+
120
+ #: woocommerce-ac.php:953
121
+ msgid ""
122
+ "Add email templates at different intervals to maximize the possibility of "
123
+ "recovering your abandoned carts."
124
+ msgstr ""
125
+ "Fügen Sie E-Mail Vorlagen für unterschiedliche Zeitintervalle hinzu, um die "
126
+ "Chancen zu erhöhen, einen verlassenen Warenkorb in eine Bestellung zu "
127
+ "konvertieren."
128
+
129
+ #: woocommerce-ac.php:1054
130
+ msgid "The Email Template has been successfully added."
131
+ msgstr "Die E-Mail Vorlage wurde erfolgreich hinzugefügt."
132
+
133
+ #: woocommerce-ac.php:1057
134
+ msgid "The Email Template has been successfully updated."
135
+ msgstr "Die E-Mail Vorlage wurde erfolgreich angepasst."
136
+
137
+ #: woocommerce-ac.php:1145
138
+ msgid "Sr"
139
+ msgstr "Nr."
140
+
141
+ #: woocommerce-ac.php:1148
142
+ msgid "Template Name"
143
+ msgstr "Vorlagenname"
144
+
145
+ #: woocommerce-ac.php:1154
146
+ msgid "Sent"
147
+ msgstr "Gesendet"
148
+
149
+ #: woocommerce-ac.php:1158
150
+ msgid "Active ?"
151
+ msgstr "aktiv?"
152
+
153
+ #: woocommerce-ac.php:1276
154
+ msgid ""
155
+ "The Report below shows how many Abandoned Carts we were able to recover for "
156
+ "you by sending automatic emails to encourage shoppers."
157
+ msgstr ""
158
+ "Der untenstehende Report zeigt, wieviele verlassene Warenkörbe aufgrund der "
159
+ "E-Mailautomatik gerettet wurden."
160
+
161
+ #: woocommerce-ac.php:1331
162
+ msgid "Start Date:"
163
+ msgstr "Startdatum:"
164
+
165
+ #: woocommerce-ac.php:1334
166
+ msgid "End Date:"
167
+ msgstr "Enddatum:"
168
+
169
+ #: woocommerce-ac.php:1337
170
+ msgid "Go"
171
+ msgstr "Los"
172
+
173
+ #: woocommerce-ac.php:1495
174
+ msgid "During the selected range"
175
+ msgstr "Während des gewählten Zeitraums wurden"
176
+
177
+ #: woocommerce-ac.php:1495
178
+ msgid "carts totaling"
179
+ msgstr "Warenkörbe mit einem Gesamtwert von"
180
+
181
+ #: woocommerce-ac.php:1495
182
+ msgid "were abandoned. We were able to recover"
183
+ msgstr "verlassen. Es konnten"
184
+
185
+ #: woocommerce-ac.php:1495
186
+ msgid "of them, which led to an extra"
187
+ msgstr "dieser Warenkörbe gerettet werden, was zu einem Extra-Umsatz von"
188
+
189
+ #: woocommerce-ac.php:1495
190
+ msgid "in sales"
191
+ msgstr "führte."
192
+
193
+ #: woocommerce-ac.php:1504
194
+ msgid "Created On"
195
+ msgstr "Erstellt Am"
196
+
197
+ #: woocommerce-ac.php:1510
198
+ msgid "Recovered Date"
199
+ msgstr "Datum der Rettung"
200
+
201
+ #: woocommerce-ac.php:1561
202
+ msgid "Template Name:"
203
+ msgstr "Vorlagenname"
204
+
205
+ #: woocommerce-ac.php:1572
206
+ msgid "Enter a template name for reference"
207
+ msgstr "Geben Sie einen Vorlagennamen als Referenz an"
208
+
209
+ #: woocommerce-ac.php:1577
210
+ msgid "Send From This Name:"
211
+ msgstr "Absendername"
212
+
213
+ #: woocommerce-ac.php:1588
214
+ msgid "Enter the name that should appear in the email sent"
215
+ msgstr "Geben Sie den Absendernamen an, der erscheinen soll"
216
+
217
+ #: woocommerce-ac.php:1594
218
+ msgid "Subject:"
219
+ msgstr "Betreff:"
220
+
221
+ #: woocommerce-ac.php:1605
222
+ msgid "Enter the subject that should appear in the email sent"
223
+ msgstr "Geben Sie den Betreff an, der in der Mail erscheinen soll"
224
+
225
+ #: woocommerce-ac.php:1611
226
+ msgid "Email Body:"
227
+ msgstr "E-Mail-Text:"
228
+
229
+ #: woocommerce-ac.php:1627
230
+ msgid "Message to be sent in the reminder email."
231
+ msgstr "Zu sendende Nachricht in der Erinnerungsmail."
232
+
233
+ #: woocommerce-ac.php:1634
234
+ msgid "Send this email:"
235
+ msgstr "Senden Sie diese e-Mail:"
236
+
237
+ #: woocommerce-ac.php:1686
238
+ msgid "after cart is abandoned."
239
+ msgstr "nachdem der Waernkorb verlassen wurde."
240
+
241
+ #: woocommerce-ac.php:1693
242
+ msgid "Send a test email to:"
243
+ msgstr "Sende Test E-Mail an:"
244
+
245
+ #: woocommerce-ac.php:1699
246
+ msgid "Enter the email id to which the test email needs to be sent."
247
+ msgstr "Geben Sie die Mailadresse für die Test E-Mail ein"
248
+
249
+ #: woocommerce-ac.php:1835 send_email.php:109
250
+ msgid "Your Shopping Cart"
251
+ msgstr "Ihr Warenkorb"
252
+
253
+ #: woocommerce-ac.php:1838 send_email.php:112
254
+ msgid "Item"
255
+ msgstr "Art."
256
+
257
+ #: woocommerce-ac.php:1839 send_email.php:113
258
+ msgid "Name"
259
+ msgstr "Name"
260
+
261
+ #: woocommerce-ac.php:1840 send_email.php:114
262
+ msgid "Quantity"
263
+ msgstr "Anzahl"
264
+
265
+ #: woocommerce-ac.php:1841 send_email.php:115
266
+ msgid "Price"
267
+ msgstr "Preis"
268
+
269
+ #: woocommerce-ac.php:1842 send_email.php:116
270
+ msgid "Line Subtotal"
271
+ msgstr "Zwischensumme"
272
+
273
+ #: woocommerce-ac.php:1846
274
+ msgid "Men\\'\\s Formal Shoes"
275
+ msgstr "Herrenschuhe"
276
+
277
+ #: woocommerce-ac.php:1853
278
+ msgid "Woman\\'\\s Hand Bags"
279
+ msgstr "Frauen Handtaschen"
280
+
281
+ #: woocommerce-ac.php:1862 send_email.php:160
282
+ msgid "Cart Total:"
283
+ msgstr "Warenkorb Total:"
{languages → i18n/languages}/woocommerce-ac-he_IL.mo RENAMED
File without changes
{languages → i18n/languages}/woocommerce-ac-he_IL.po RENAMED
@@ -1,281 +1,281 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- msgid ""
7
- msgstr ""
8
- "Project-Id-Version: \n"
9
- "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2015-08-11 18:39+0300\n"
11
- "PO-Revision-Date: 2015-08-11 19:03+0300\n"
12
- "Language-Team: \n"
13
- "MIME-Version: 1.0\n"
14
- "Content-Type: text/plain; charset=UTF-8\n"
15
- "Content-Transfer-Encoding: 8bit\n"
16
- "X-Generator: Poedit 1.8.4\n"
17
- "Last-Translator: \n"
18
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
- "Language: he_IL\n"
20
-
21
- #: woocommerce-ac.php:22
22
- msgid "Once Every Five Minutes"
23
- msgstr "פעם אחת כל חמש דקות"
24
-
25
- #: woocommerce-ac.php:204
26
- #, php-format
27
- msgid ""
28
- "You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
29
- "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
30
- "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
31
- "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
32
- "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
33
- msgstr ""
34
- "‏You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
35
- "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
36
- "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
37
- "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
38
- "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
39
-
40
- #: woocommerce-ac.php:314
41
- msgid "Abandoned Carts"
42
- msgstr "עגלות שננטשו"
43
-
44
- #: woocommerce-ac.php:516
45
- msgid "Abandoned Orders"
46
- msgstr "הזמנות שננטשו"
47
-
48
- #: woocommerce-ac.php:517
49
- msgid "Email Templates"
50
- msgstr "תבניות אימייל"
51
-
52
- #: woocommerce-ac.php:518 woocommerce-ac.php:712
53
- msgid "Settings"
54
- msgstr "הגדרות"
55
-
56
- #: woocommerce-ac.php:519
57
- msgid "Recovered Orders"
58
- msgstr "הזמנות ששוחזרו"
59
-
60
- #: woocommerce-ac.php:661
61
- msgid "You do not have sufficient permissions to access this page."
62
- msgstr "אין לך הרשאה מתאימה לגשת לעמוד זה."
63
-
64
- #: woocommerce-ac.php:670
65
- msgid "WooCommerce - Abandon Cart Lite"
66
- msgstr "‏Woocommerce - עגלות נטושות לייט"
67
-
68
- #: woocommerce-ac.php:696
69
- msgid "Your settings have been saved."
70
- msgstr "ההגדרות שלך נשמרו"
71
-
72
- #: woocommerce-ac.php:718
73
- msgid "Cart abandoned cut-off time"
74
- msgstr "זמן חישוב עגלה כנטושה"
75
-
76
- #: woocommerce-ac.php:741
77
- msgid "minutes"
78
- msgstr "דקות"
79
-
80
- #: woocommerce-ac.php:742 woocommerce-ac.php:743
81
- msgid ""
82
- "Consider cart abandoned after X minutes of item being added to cart & order "
83
- "not placed"
84
- msgstr ""
85
- "החשב עגלה כנטושה אחרי X דקות מאז הפריט הוסף לעגלת הקניות וההזמנה לא בוצעה"
86
-
87
- #: woocommerce-ac.php:753
88
- msgid "Save Changes"
89
- msgstr "שמור שינויים"
90
-
91
- #: woocommerce-ac.php:763
92
- msgid ""
93
- "The list below shows all Abandoned Carts which have remained in cart for a "
94
- "time higher than the \"Cart abandoned cut-off time\" setting."
95
- msgstr ""
96
- "רשימה זו מציגה את כל העגלות שננטשו אשר נותרו בעגלה לפרק זמן העולה על ״זמן "
97
- "חישוב עגלה כנטושה״."
98
-
99
- #: woocommerce-ac.php:858 woocommerce-ac.php:1501
100
- msgid "Customer"
101
- msgstr "לקוח"
102
-
103
- #: woocommerce-ac.php:859 woocommerce-ac.php:1514
104
- msgid "Order Total"
105
- msgstr "סה״כ להזמנה"
106
-
107
- #: woocommerce-ac.php:862
108
- msgid "Date"
109
- msgstr "תאריך"
110
-
111
- #: woocommerce-ac.php:868
112
- msgid "Status"
113
- msgstr "סטטוס"
114
-
115
- #: woocommerce-ac.php:872 woocommerce-ac.php:1159
116
- msgid "Actions"
117
- msgstr "פעולות"
118
-
119
- #: woocommerce-ac.php:953
120
- msgid ""
121
- "Add email templates at different intervals to maximize the possibility of "
122
- "recovering your abandoned carts."
123
- msgstr ""
124
- "הוסף תבניות אימייל בפרקי זמן שונים כדי למקסם את האפשרות לשחזר עגלות נטושות "
125
- "שלך."
126
-
127
- #: woocommerce-ac.php:1054
128
- msgid "The Email Template has been successfully added."
129
- msgstr "תבנית אימייל התווספה בהצלחה."
130
-
131
- #: woocommerce-ac.php:1057
132
- msgid "The Email Template has been successfully updated."
133
- msgstr "תבנית אימייל עודכנה בהצלחה."
134
-
135
- #: woocommerce-ac.php:1145
136
- msgid "Sr"
137
- msgstr "‏Sr"
138
-
139
- #: woocommerce-ac.php:1148
140
- msgid "Template Name"
141
- msgstr "שם תבנית"
142
-
143
- #: woocommerce-ac.php:1154
144
- msgid "Sent"
145
- msgstr "נשלח"
146
-
147
- #: woocommerce-ac.php:1158
148
- msgid "Active ?"
149
- msgstr "פעיל?"
150
-
151
- #: woocommerce-ac.php:1276
152
- msgid ""
153
- "The Report below shows how many Abandoned Carts we were able to recover for "
154
- "you by sending automatic emails to encourage shoppers."
155
- msgstr ""
156
- "הדו״ח שלהלן מציג כמה עגלות שננטשו שוחזרו עבורך על ידי שליחה אוטומטית של "
157
- "אימיילים לטובת עידוד קונים."
158
-
159
- #: woocommerce-ac.php:1331
160
- msgid "Start Date:"
161
- msgstr "תאריך התחלה:"
162
-
163
- #: woocommerce-ac.php:1334
164
- msgid "End Date:"
165
- msgstr "תאריך סיום:"
166
-
167
- #: woocommerce-ac.php:1337
168
- msgid "Go"
169
- msgstr "שלח"
170
-
171
- #: woocommerce-ac.php:1495
172
- msgid "During the selected range"
173
- msgstr "במהלך התקופה הנקובה"
174
-
175
- #: woocommerce-ac.php:1495
176
- msgid "carts totaling"
177
- msgstr "עגלות בסך"
178
-
179
- #: woocommerce-ac.php:1495
180
- msgid "were abandoned. We were able to recover"
181
- msgstr "ננטשו. הצלחנו לשחזר"
182
-
183
- #: woocommerce-ac.php:1495
184
- msgid "of them, which led to an extra"
185
- msgstr "מתוכן, אשר הוביל לתוספת של"
186
-
187
- #: woocommerce-ac.php:1495
188
- msgid "in sales"
189
- msgstr "במכירות"
190
-
191
- #: woocommerce-ac.php:1504
192
- msgid "Created On"
193
- msgstr "נוצר ב"
194
-
195
- #: woocommerce-ac.php:1510
196
- msgid "Recovered Date"
197
- msgstr "תאריך שחזור"
198
-
199
- #: woocommerce-ac.php:1561
200
- msgid "Template Name:"
201
- msgstr "שם תבנית:"
202
-
203
- #: woocommerce-ac.php:1572
204
- msgid "Enter a template name for reference"
205
- msgstr "הכנס שם לתבנית לטובת סימוכין"
206
-
207
- #: woocommerce-ac.php:1577
208
- msgid "Send From This Name:"
209
- msgstr "מאת:"
210
-
211
- #: woocommerce-ac.php:1588
212
- msgid "Enter the name that should appear in the email sent"
213
- msgstr "הכנס את השם אשר יופיע באימייל שיישלח"
214
-
215
- #: woocommerce-ac.php:1594
216
- msgid "Subject:"
217
- msgstr "נושא:"
218
-
219
- #: woocommerce-ac.php:1605
220
- msgid "Enter the subject that should appear in the email sent"
221
- msgstr "הכנס את הנושא אשר יופיע באימייל שיישלח"
222
-
223
- #: woocommerce-ac.php:1611
224
- msgid "Email Body:"
225
- msgstr "גוף האימייל:"
226
-
227
- #: woocommerce-ac.php:1627
228
- msgid "Message to be sent in the reminder email."
229
- msgstr "הודעה אשר תישלח באימייל תזכורת."
230
-
231
- #: woocommerce-ac.php:1634
232
- msgid "Send this email:"
233
- msgstr "שלח אימייל זה:"
234
-
235
- #: woocommerce-ac.php:1686
236
- msgid "after cart is abandoned."
237
- msgstr "אחרי שננטשת עגלה."
238
-
239
- #: woocommerce-ac.php:1693
240
- msgid "Send a test email to:"
241
- msgstr "שלח מייל בדיקה אל:"
242
-
243
- #: woocommerce-ac.php:1699
244
- msgid "Enter the email id to which the test email needs to be sent."
245
- msgstr "הכנס את כתובת האימייל אליה יישלח מייל בדיקה."
246
-
247
- #: woocommerce-ac.php:1835 send_email.php:109
248
- msgid "Your Shopping Cart"
249
- msgstr "עגלת הקניות שלך"
250
-
251
- #: woocommerce-ac.php:1838 send_email.php:112
252
- msgid "Item"
253
- msgstr "פריט"
254
-
255
- #: woocommerce-ac.php:1839 send_email.php:113
256
- msgid "Name"
257
- msgstr "שם"
258
-
259
- #: woocommerce-ac.php:1840 send_email.php:114
260
- msgid "Quantity"
261
- msgstr "כמות"
262
-
263
- #: woocommerce-ac.php:1841 send_email.php:115
264
- msgid "Price"
265
- msgstr "מחיר"
266
-
267
- #: woocommerce-ac.php:1842 send_email.php:116
268
- msgid "Line Subtotal"
269
- msgstr "סכום ביניים"
270
-
271
- #: woocommerce-ac.php:1846
272
- msgid "Men\\'\\s Formal Shoes"
273
- msgstr "נעלי גברים"
274
-
275
- #: woocommerce-ac.php:1853
276
- msgid "Woman\\'\\s Hand Bags"
277
- msgstr "תיקי יד של נשים"
278
-
279
- #: woocommerce-ac.php:1862 send_email.php:160
280
- msgid "Cart Total:"
281
- msgstr "סה״כ בעגלה:"
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: \n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2015-08-11 18:39+0300\n"
11
+ "PO-Revision-Date: 2015-08-11 19:03+0300\n"
12
+ "Language-Team: \n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+ "X-Generator: Poedit 1.8.4\n"
17
+ "Last-Translator: \n"
18
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+ "Language: he_IL\n"
20
+
21
+ #: woocommerce-ac.php:22
22
+ msgid "Once Every Five Minutes"
23
+ msgstr "פעם אחת כל חמש דקות"
24
+
25
+ #: woocommerce-ac.php:204
26
+ #, php-format
27
+ msgid ""
28
+ "You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
29
+ "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
30
+ "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
31
+ "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
32
+ "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
33
+ msgstr ""
34
+ "‏You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
35
+ "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
36
+ "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
37
+ "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
38
+ "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
39
+
40
+ #: woocommerce-ac.php:314
41
+ msgid "Abandoned Carts"
42
+ msgstr "עגלות שננטשו"
43
+
44
+ #: woocommerce-ac.php:516
45
+ msgid "Abandoned Orders"
46
+ msgstr "הזמנות שננטשו"
47
+
48
+ #: woocommerce-ac.php:517
49
+ msgid "Email Templates"
50
+ msgstr "תבניות אימייל"
51
+
52
+ #: woocommerce-ac.php:518 woocommerce-ac.php:712
53
+ msgid "Settings"
54
+ msgstr "הגדרות"
55
+
56
+ #: woocommerce-ac.php:519
57
+ msgid "Recovered Orders"
58
+ msgstr "הזמנות ששוחזרו"
59
+
60
+ #: woocommerce-ac.php:661
61
+ msgid "You do not have sufficient permissions to access this page."
62
+ msgstr "אין לך הרשאה מתאימה לגשת לעמוד זה."
63
+
64
+ #: woocommerce-ac.php:670
65
+ msgid "WooCommerce - Abandon Cart Lite"
66
+ msgstr "‏Woocommerce - עגלות נטושות לייט"
67
+
68
+ #: woocommerce-ac.php:696
69
+ msgid "Your settings have been saved."
70
+ msgstr "ההגדרות שלך נשמרו"
71
+
72
+ #: woocommerce-ac.php:718
73
+ msgid "Cart abandoned cut-off time"
74
+ msgstr "זמן חישוב עגלה כנטושה"
75
+
76
+ #: woocommerce-ac.php:741
77
+ msgid "minutes"
78
+ msgstr "דקות"
79
+
80
+ #: woocommerce-ac.php:742 woocommerce-ac.php:743
81
+ msgid ""
82
+ "Consider cart abandoned after X minutes of item being added to cart & order "
83
+ "not placed"
84
+ msgstr ""
85
+ "החשב עגלה כנטושה אחרי X דקות מאז הפריט הוסף לעגלת הקניות וההזמנה לא בוצעה"
86
+
87
+ #: woocommerce-ac.php:753
88
+ msgid "Save Changes"
89
+ msgstr "שמור שינויים"
90
+
91
+ #: woocommerce-ac.php:763
92
+ msgid ""
93
+ "The list below shows all Abandoned Carts which have remained in cart for a "
94
+ "time higher than the \"Cart abandoned cut-off time\" setting."
95
+ msgstr ""
96
+ "רשימה זו מציגה את כל העגלות שננטשו אשר נותרו בעגלה לפרק זמן העולה על ״זמן "
97
+ "חישוב עגלה כנטושה״."
98
+
99
+ #: woocommerce-ac.php:858 woocommerce-ac.php:1501
100
+ msgid "Customer"
101
+ msgstr "לקוח"
102
+
103
+ #: woocommerce-ac.php:859 woocommerce-ac.php:1514
104
+ msgid "Order Total"
105
+ msgstr "סה״כ להזמנה"
106
+
107
+ #: woocommerce-ac.php:862
108
+ msgid "Date"
109
+ msgstr "תאריך"
110
+
111
+ #: woocommerce-ac.php:868
112
+ msgid "Status"
113
+ msgstr "סטטוס"
114
+
115
+ #: woocommerce-ac.php:872 woocommerce-ac.php:1159
116
+ msgid "Actions"
117
+ msgstr "פעולות"
118
+
119
+ #: woocommerce-ac.php:953
120
+ msgid ""
121
+ "Add email templates at different intervals to maximize the possibility of "
122
+ "recovering your abandoned carts."
123
+ msgstr ""
124
+ "הוסף תבניות אימייל בפרקי זמן שונים כדי למקסם את האפשרות לשחזר עגלות נטושות "
125
+ "שלך."
126
+
127
+ #: woocommerce-ac.php:1054
128
+ msgid "The Email Template has been successfully added."
129
+ msgstr "תבנית אימייל התווספה בהצלחה."
130
+
131
+ #: woocommerce-ac.php:1057
132
+ msgid "The Email Template has been successfully updated."
133
+ msgstr "תבנית אימייל עודכנה בהצלחה."
134
+
135
+ #: woocommerce-ac.php:1145
136
+ msgid "Sr"
137
+ msgstr "‏Sr"
138
+
139
+ #: woocommerce-ac.php:1148
140
+ msgid "Template Name"
141
+ msgstr "שם תבנית"
142
+
143
+ #: woocommerce-ac.php:1154
144
+ msgid "Sent"
145
+ msgstr "נשלח"
146
+
147
+ #: woocommerce-ac.php:1158
148
+ msgid "Active ?"
149
+ msgstr "פעיל?"
150
+
151
+ #: woocommerce-ac.php:1276
152
+ msgid ""
153
+ "The Report below shows how many Abandoned Carts we were able to recover for "
154
+ "you by sending automatic emails to encourage shoppers."
155
+ msgstr ""
156
+ "הדו״ח שלהלן מציג כמה עגלות שננטשו שוחזרו עבורך על ידי שליחה אוטומטית של "
157
+ "אימיילים לטובת עידוד קונים."
158
+
159
+ #: woocommerce-ac.php:1331
160
+ msgid "Start Date:"
161
+ msgstr "תאריך התחלה:"
162
+
163
+ #: woocommerce-ac.php:1334
164
+ msgid "End Date:"
165
+ msgstr "תאריך סיום:"
166
+
167
+ #: woocommerce-ac.php:1337
168
+ msgid "Go"
169
+ msgstr "שלח"
170
+
171
+ #: woocommerce-ac.php:1495
172
+ msgid "During the selected range"
173
+ msgstr "במהלך התקופה הנקובה"
174
+
175
+ #: woocommerce-ac.php:1495
176
+ msgid "carts totaling"
177
+ msgstr "עגלות בסך"
178
+
179
+ #: woocommerce-ac.php:1495
180
+ msgid "were abandoned. We were able to recover"
181
+ msgstr "ננטשו. הצלחנו לשחזר"
182
+
183
+ #: woocommerce-ac.php:1495
184
+ msgid "of them, which led to an extra"
185
+ msgstr "מתוכן, אשר הוביל לתוספת של"
186
+
187
+ #: woocommerce-ac.php:1495
188
+ msgid "in sales"
189
+ msgstr "במכירות"
190
+
191
+ #: woocommerce-ac.php:1504
192
+ msgid "Created On"
193
+ msgstr "נוצר ב"
194
+
195
+ #: woocommerce-ac.php:1510
196
+ msgid "Recovered Date"
197
+ msgstr "תאריך שחזור"
198
+
199
+ #: woocommerce-ac.php:1561
200
+ msgid "Template Name:"
201
+ msgstr "שם תבנית:"
202
+
203
+ #: woocommerce-ac.php:1572
204
+ msgid "Enter a template name for reference"
205
+ msgstr "הכנס שם לתבנית לטובת סימוכין"
206
+
207
+ #: woocommerce-ac.php:1577
208
+ msgid "Send From This Name:"
209
+ msgstr "מאת:"
210
+
211
+ #: woocommerce-ac.php:1588
212
+ msgid "Enter the name that should appear in the email sent"
213
+ msgstr "הכנס את השם אשר יופיע באימייל שיישלח"
214
+
215
+ #: woocommerce-ac.php:1594
216
+ msgid "Subject:"
217
+ msgstr "נושא:"
218
+
219
+ #: woocommerce-ac.php:1605
220
+ msgid "Enter the subject that should appear in the email sent"
221
+ msgstr "הכנס את הנושא אשר יופיע באימייל שיישלח"
222
+
223
+ #: woocommerce-ac.php:1611
224
+ msgid "Email Body:"
225
+ msgstr "גוף האימייל:"
226
+
227
+ #: woocommerce-ac.php:1627
228
+ msgid "Message to be sent in the reminder email."
229
+ msgstr "הודעה אשר תישלח באימייל תזכורת."
230
+
231
+ #: woocommerce-ac.php:1634
232
+ msgid "Send this email:"
233
+ msgstr "שלח אימייל זה:"
234
+
235
+ #: woocommerce-ac.php:1686
236
+ msgid "after cart is abandoned."
237
+ msgstr "אחרי שננטשת עגלה."
238
+
239
+ #: woocommerce-ac.php:1693
240
+ msgid "Send a test email to:"
241
+ msgstr "שלח מייל בדיקה אל:"
242
+
243
+ #: woocommerce-ac.php:1699
244
+ msgid "Enter the email id to which the test email needs to be sent."
245
+ msgstr "הכנס את כתובת האימייל אליה יישלח מייל בדיקה."
246
+
247
+ #: woocommerce-ac.php:1835 send_email.php:109
248
+ msgid "Your Shopping Cart"
249
+ msgstr "עגלת הקניות שלך"
250
+
251
+ #: woocommerce-ac.php:1838 send_email.php:112
252
+ msgid "Item"
253
+ msgstr "פריט"
254
+
255
+ #: woocommerce-ac.php:1839 send_email.php:113
256
+ msgid "Name"
257
+ msgstr "שם"
258
+
259
+ #: woocommerce-ac.php:1840 send_email.php:114
260
+ msgid "Quantity"
261
+ msgstr "כמות"
262
+
263
+ #: woocommerce-ac.php:1841 send_email.php:115
264
+ msgid "Price"
265
+ msgstr "מחיר"
266
+
267
+ #: woocommerce-ac.php:1842 send_email.php:116
268
+ msgid "Line Subtotal"
269
+ msgstr "סכום ביניים"
270
+
271
+ #: woocommerce-ac.php:1846
272
+ msgid "Men\\'\\s Formal Shoes"
273
+ msgstr "נעלי גברים"
274
+
275
+ #: woocommerce-ac.php:1853
276
+ msgid "Woman\\'\\s Hand Bags"
277
+ msgstr "תיקי יד של נשים"
278
+
279
+ #: woocommerce-ac.php:1862 send_email.php:160
280
+ msgid "Cart Total:"
281
+ msgstr "סה״כ בעגלה:"
{languages → i18n/languages}/woocommerce-ac-sk_SK.mo RENAMED
File without changes
{languages → i18n/languages}/woocommerce-ac-sk_SK.po RENAMED
@@ -1,283 +1,283 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- msgid ""
7
- msgstr ""
8
- "Project-Id-Version: woocommerce-ac\n"
9
- "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2015-07-08 16:30+0530\n"
11
- "PO-Revision-Date: 2015-12-16 10:00+0100\n"
12
- "Last-Translator: \n"
13
- "Language-Team: Mauro <marek9.danko@gmail.com>\n"
14
- "MIME-Version: 1.0\n"
15
- "Content-Type: text/plain; charset=UTF-8\n"
16
- "Content-Transfer-Encoding: 8bit\n"
17
- "X-Generator: Poedit 1.8.1\n"
18
- "X-Poedit-KeywordsList: __;_e\n"
19
- "X-Poedit-Basepath: .\n"
20
- "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
21
- "Language: sk_SK\n"
22
-
23
- #: woocommerce-ac.php:22
24
- msgid "Once Every Five Minutes"
25
- msgstr "Po každých piatich minútach"
26
-
27
- #: woocommerce-ac.php:204
28
- msgid ""
29
- "You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
30
- "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
31
- "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
32
- "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
33
- "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
34
- msgstr ""
35
- "Môžete upgradovať na <a href=\"https://www.tychesoftwares.com/store/premium-"
36
- "plugins/woocommerce-abandoned-cart-pro/\">PRO verziu WooCommerce Abandoned "
37
- "Cart plugin</a> s <b>20% zľavou</b>. Použite kód: <b>ACPRO20</b>.<a href="
38
- "\"https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-"
39
- "cart-pro/\"> Zakúpte teraz </a> a ušetrite 24$ !"
40
-
41
- #: woocommerce-ac.php:314
42
- msgid "Abandoned Carts"
43
- msgstr "Opustené Košíky"
44
-
45
- #: woocommerce-ac.php:516
46
- msgid "Abandoned Orders"
47
- msgstr "Opustené Objednávky"
48
-
49
- #: woocommerce-ac.php:517
50
- msgid "Email Templates"
51
- msgstr "E-mailové šablóny"
52
-
53
- #: woocommerce-ac.php:518 woocommerce-ac.php:712
54
- msgid "Settings"
55
- msgstr "Nastavenia"
56
-
57
- #: woocommerce-ac.php:519
58
- msgid "Recovered Orders"
59
- msgstr "Spätne získaná objednávka "
60
-
61
- #: woocommerce-ac.php:661
62
- msgid "You do not have sufficient permissions to access this page."
63
- msgstr "Nemáte dostatočné oprávnenia k prístupu na túto stránku."
64
-
65
- #: woocommerce-ac.php:670
66
- msgid "WooCommerce - Abandon Cart Lite"
67
- msgstr ""
68
-
69
- #: woocommerce-ac.php:696
70
- msgid "Your settings have been saved."
71
- msgstr "Vaše nastavenia boli uložené."
72
-
73
- #: woocommerce-ac.php:718
74
- msgid "Cart abandoned cut-off time"
75
- msgstr "Limit pre opustený košík"
76
-
77
- #: woocommerce-ac.php:741
78
- msgid "minutes"
79
- msgstr "minút"
80
-
81
- #: woocommerce-ac.php:742 woocommerce-ac.php:743
82
- msgid ""
83
- "Consider cart abandoned after X minutes of item being added to cart & order "
84
- "not placed"
85
- msgstr ""
86
- "Košík je opustený po X minútach potom čo bola položka vložená do košíka ale "
87
- "objednávka nebola odoslaná"
88
-
89
- #: woocommerce-ac.php:753
90
- msgid "Save Changes"
91
- msgstr "Uložiť zmeny"
92
-
93
- #: woocommerce-ac.php:763
94
- msgid ""
95
- "The list below shows all Abandoned Carts which have remained in cart for a "
96
- "time higher than the \"Cart abandoned cut-off time\" setting."
97
- msgstr ""
98
- "Tento zoznam ukazuje všetky opustené košíky, pri ktorých nebol zmenený stav "
99
- "dlhší čas ako je nastavený \"Limit pre opustený košík\"."
100
-
101
- #: woocommerce-ac.php:858 woocommerce-ac.php:1501
102
- msgid "Customer"
103
- msgstr "Zákazník"
104
-
105
- #: woocommerce-ac.php:859 woocommerce-ac.php:1514
106
- msgid "Order Total"
107
- msgstr "Objednávka Celkom"
108
-
109
- #: woocommerce-ac.php:862
110
- msgid "Date"
111
- msgstr "Dátum"
112
-
113
- #: woocommerce-ac.php:868
114
- msgid "Status"
115
- msgstr "Stav"
116
-
117
- #: woocommerce-ac.php:872 woocommerce-ac.php:1159
118
- msgid "Actions"
119
- msgstr "Akcie"
120
-
121
- #: woocommerce-ac.php:953
122
- msgid ""
123
- "Add email templates at different intervals to maximize the possibility of "
124
- "recovering your abandoned carts."
125
- msgstr ""
126
- "Add email templates at different intervals to maximize the possibility of "
127
- "recovering your abandoned carts."
128
-
129
- #: woocommerce-ac.php:1054
130
- msgid "The Email Template has been successfully added."
131
- msgstr "Emailová šablóna bola úspešne pridaná."
132
-
133
- #: woocommerce-ac.php:1057
134
- msgid "The Email Template has been successfully updated."
135
- msgstr "Emailová šablóna bola úspešne uložená."
136
-
137
- #: woocommerce-ac.php:1145
138
- msgid "Sr"
139
- msgstr ""
140
-
141
- #: woocommerce-ac.php:1148
142
- msgid "Template Name"
143
- msgstr "Názov šablóny"
144
-
145
- #: woocommerce-ac.php:1154
146
- msgid "Sent"
147
- msgstr "Odoslané"
148
-
149
- #: woocommerce-ac.php:1158
150
- msgid "Active ?"
151
- msgstr "Aktívne ?"
152
-
153
- #: woocommerce-ac.php:1276
154
- msgid ""
155
- "The Report below shows how many Abandoned Carts we were able to recover for "
156
- "you by sending automatic emails to encourage shoppers."
157
- msgstr ""
158
- "Tento report ukazuje koľko Opustených košíkov sme boli schopný znovuzískať "
159
- "pre Vás po odoslaní automatického emailu pre povzbudenie nakupujúceho."
160
-
161
- #: woocommerce-ac.php:1331
162
- msgid "Start Date:"
163
- msgstr "Začiatočný dátum:"
164
-
165
- #: woocommerce-ac.php:1334
166
- msgid "End Date:"
167
- msgstr "Dátum ukončenia:"
168
-
169
- #: woocommerce-ac.php:1337
170
- msgid "Go"
171
- msgstr "Spustiť"
172
-
173
- #: woocommerce-ac.php:1495
174
- msgid "During the selected range"
175
- msgstr "Vo vybranom intarvale: "
176
-
177
- #: woocommerce-ac.php:1495
178
- msgid "carts totaling"
179
- msgstr "(v celkovej výške: "
180
-
181
- #: woocommerce-ac.php:1495
182
- msgid "were abandoned. We were able to recover"
183
- msgstr ") opustených košíkov. Objednávku sme spätne získali z"
184
-
185
- #: woocommerce-ac.php:1495
186
- msgid "of them, which led to an extra"
187
- msgstr ",čo viedlo k "
188
-
189
- #: woocommerce-ac.php:1495
190
- msgid "in sales"
191
- msgstr "obratu."
192
-
193
- #: woocommerce-ac.php:1504
194
- msgid "Created On"
195
- msgstr "Vytvorené"
196
-
197
- #: woocommerce-ac.php:1510
198
- msgid "Recovered Date"
199
- msgstr "Dátum znovuzískania"
200
-
201
- #: woocommerce-ac.php:1561
202
- msgid "Template Name:"
203
- msgstr "Názov šablóny:"
204
-
205
- #: woocommerce-ac.php:1572
206
- msgid "Enter a template name for reference"
207
- msgstr "Zadajte názov šablóny pre priradenie"
208
-
209
- #: woocommerce-ac.php:1577
210
- msgid "Send From This Name:"
211
- msgstr "Meno odosielateľa:"
212
-
213
- #: woocommerce-ac.php:1588
214
- msgid "Enter the name that should appear in the email sent"
215
- msgstr "Zadajte meno ktoré sa zobrazí ako odosielateľ"
216
-
217
- #: woocommerce-ac.php:1594
218
- msgid "Subject:"
219
- msgstr "Predmet:"
220
-
221
- #: woocommerce-ac.php:1605
222
- msgid "Enter the subject that should appear in the email sent"
223
- msgstr "Zadajte predmet, ktorý by sa mal objaviť v odolsanom emaile"
224
-
225
- #: woocommerce-ac.php:1611
226
- msgid "Email Body:"
227
- msgstr "Telo emailu:"
228
-
229
- #: woocommerce-ac.php:1627
230
- msgid "Message to be sent in the reminder email."
231
- msgstr "Správa odoslaná ako pripomienkobý email."
232
-
233
- #: woocommerce-ac.php:1634
234
- msgid "Send this email:"
235
- msgstr "Odoslat tento email."
236
-
237
- #: woocommerce-ac.php:1686
238
- msgid "after cart is abandoned."
239
- msgstr "po opustení košíka."
240
-
241
- #: woocommerce-ac.php:1693
242
- msgid "Send a test email to:"
243
- msgstr "Odoslať testovací email na:"
244
-
245
- #: woocommerce-ac.php:1699
246
- msgid "Enter the email id to which the test email needs to be sent."
247
- msgstr "Zadajte email na ktorý sa ma testovací email odoslať."
248
-
249
- #: woocommerce-ac.php:1835 send_email.php:109
250
- msgid "Your Shopping Cart"
251
- msgstr "Váš nakúpný košík"
252
-
253
- #: woocommerce-ac.php:1838 send_email.php:112
254
- msgid "Item"
255
- msgstr "Položka"
256
-
257
- #: woocommerce-ac.php:1839 send_email.php:113
258
- msgid "Name"
259
- msgstr "Meno"
260
-
261
- #: woocommerce-ac.php:1840 send_email.php:114
262
- msgid "Quantity"
263
- msgstr "Množstvo"
264
-
265
- #: woocommerce-ac.php:1841 send_email.php:115
266
- msgid "Price"
267
- msgstr "Cena"
268
-
269
- #: woocommerce-ac.php:1842 send_email.php:116
270
- msgid "Line Subtotal"
271
- msgstr "Subtotal"
272
-
273
- #: woocommerce-ac.php:1846
274
- msgid "Men\\'\\s Formal Shoes"
275
- msgstr ""
276
-
277
- #: woocommerce-ac.php:1853
278
- msgid "Woman\\'\\s Hand Bags"
279
- msgstr ""
280
-
281
- #: woocommerce-ac.php:1862 send_email.php:160
282
- msgid "Cart Total:"
283
- msgstr "Košík spolu:"
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: woocommerce-ac\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2015-07-08 16:30+0530\n"
11
+ "PO-Revision-Date: 2015-12-16 10:00+0100\n"
12
+ "Last-Translator: \n"
13
+ "Language-Team: Mauro <marek9.danko@gmail.com>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Generator: Poedit 1.8.1\n"
18
+ "X-Poedit-KeywordsList: __;_e\n"
19
+ "X-Poedit-Basepath: .\n"
20
+ "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
21
+ "Language: sk_SK\n"
22
+
23
+ #: woocommerce-ac.php:22
24
+ msgid "Once Every Five Minutes"
25
+ msgstr "Po každých piatich minútach"
26
+
27
+ #: woocommerce-ac.php:204
28
+ msgid ""
29
+ "You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
30
+ "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
31
+ "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
32
+ "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
33
+ "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
34
+ msgstr ""
35
+ "Môžete upgradovať na <a href=\"https://www.tychesoftwares.com/store/premium-"
36
+ "plugins/woocommerce-abandoned-cart-pro/\">PRO verziu WooCommerce Abandoned "
37
+ "Cart plugin</a> s <b>20% zľavou</b>. Použite kód: <b>ACPRO20</b>.<a href="
38
+ "\"https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-"
39
+ "cart-pro/\"> Zakúpte teraz </a> a ušetrite 24$ !"
40
+
41
+ #: woocommerce-ac.php:314
42
+ msgid "Abandoned Carts"
43
+ msgstr "Opustené Košíky"
44
+
45
+ #: woocommerce-ac.php:516
46
+ msgid "Abandoned Orders"
47
+ msgstr "Opustené Objednávky"
48
+
49
+ #: woocommerce-ac.php:517
50
+ msgid "Email Templates"
51
+ msgstr "E-mailové šablóny"
52
+
53
+ #: woocommerce-ac.php:518 woocommerce-ac.php:712
54
+ msgid "Settings"
55
+ msgstr "Nastavenia"
56
+
57
+ #: woocommerce-ac.php:519
58
+ msgid "Recovered Orders"
59
+ msgstr "Spätne získaná objednávka "
60
+
61
+ #: woocommerce-ac.php:661
62
+ msgid "You do not have sufficient permissions to access this page."
63
+ msgstr "Nemáte dostatočné oprávnenia k prístupu na túto stránku."
64
+
65
+ #: woocommerce-ac.php:670
66
+ msgid "WooCommerce - Abandon Cart Lite"
67
+ msgstr ""
68
+
69
+ #: woocommerce-ac.php:696
70
+ msgid "Your settings have been saved."
71
+ msgstr "Vaše nastavenia boli uložené."
72
+
73
+ #: woocommerce-ac.php:718
74
+ msgid "Cart abandoned cut-off time"
75
+ msgstr "Limit pre opustený košík"
76
+
77
+ #: woocommerce-ac.php:741
78
+ msgid "minutes"
79
+ msgstr "minút"
80
+
81
+ #: woocommerce-ac.php:742 woocommerce-ac.php:743
82
+ msgid ""
83
+ "Consider cart abandoned after X minutes of item being added to cart & order "
84
+ "not placed"
85
+ msgstr ""
86
+ "Košík je opustený po X minútach potom čo bola položka vložená do košíka ale "
87
+ "objednávka nebola odoslaná"
88
+
89
+ #: woocommerce-ac.php:753
90
+ msgid "Save Changes"
91
+ msgstr "Uložiť zmeny"
92
+
93
+ #: woocommerce-ac.php:763
94
+ msgid ""
95
+ "The list below shows all Abandoned Carts which have remained in cart for a "
96
+ "time higher than the \"Cart abandoned cut-off time\" setting."
97
+ msgstr ""
98
+ "Tento zoznam ukazuje všetky opustené košíky, pri ktorých nebol zmenený stav "
99
+ "dlhší čas ako je nastavený \"Limit pre opustený košík\"."
100
+
101
+ #: woocommerce-ac.php:858 woocommerce-ac.php:1501
102
+ msgid "Customer"
103
+ msgstr "Zákazník"
104
+
105
+ #: woocommerce-ac.php:859 woocommerce-ac.php:1514
106
+ msgid "Order Total"
107
+ msgstr "Objednávka Celkom"
108
+
109
+ #: woocommerce-ac.php:862
110
+ msgid "Date"
111
+ msgstr "Dátum"
112
+
113
+ #: woocommerce-ac.php:868
114
+ msgid "Status"
115
+ msgstr "Stav"
116
+
117
+ #: woocommerce-ac.php:872 woocommerce-ac.php:1159
118
+ msgid "Actions"
119
+ msgstr "Akcie"
120
+
121
+ #: woocommerce-ac.php:953
122
+ msgid ""
123
+ "Add email templates at different intervals to maximize the possibility of "
124
+ "recovering your abandoned carts."
125
+ msgstr ""
126
+ "Add email templates at different intervals to maximize the possibility of "
127
+ "recovering your abandoned carts."
128
+
129
+ #: woocommerce-ac.php:1054
130
+ msgid "The Email Template has been successfully added."
131
+ msgstr "Emailová šablóna bola úspešne pridaná."
132
+
133
+ #: woocommerce-ac.php:1057
134
+ msgid "The Email Template has been successfully updated."
135
+ msgstr "Emailová šablóna bola úspešne uložená."
136
+
137
+ #: woocommerce-ac.php:1145
138
+ msgid "Sr"
139
+ msgstr ""
140
+
141
+ #: woocommerce-ac.php:1148
142
+ msgid "Template Name"
143
+ msgstr "Názov šablóny"
144
+
145
+ #: woocommerce-ac.php:1154
146
+ msgid "Sent"
147
+ msgstr "Odoslané"
148
+
149
+ #: woocommerce-ac.php:1158
150
+ msgid "Active ?"
151
+ msgstr "Aktívne ?"
152
+
153
+ #: woocommerce-ac.php:1276
154
+ msgid ""
155
+ "The Report below shows how many Abandoned Carts we were able to recover for "
156
+ "you by sending automatic emails to encourage shoppers."
157
+ msgstr ""
158
+ "Tento report ukazuje koľko Opustených košíkov sme boli schopný znovuzískať "
159
+ "pre Vás po odoslaní automatického emailu pre povzbudenie nakupujúceho."
160
+
161
+ #: woocommerce-ac.php:1331
162
+ msgid "Start Date:"
163
+ msgstr "Začiatočný dátum:"
164
+
165
+ #: woocommerce-ac.php:1334
166
+ msgid "End Date:"
167
+ msgstr "Dátum ukončenia:"
168
+
169
+ #: woocommerce-ac.php:1337
170
+ msgid "Go"
171
+ msgstr "Spustiť"
172
+
173
+ #: woocommerce-ac.php:1495
174
+ msgid "During the selected range"
175
+ msgstr "Vo vybranom intarvale: "
176
+
177
+ #: woocommerce-ac.php:1495
178
+ msgid "carts totaling"
179
+ msgstr "(v celkovej výške: "
180
+
181
+ #: woocommerce-ac.php:1495
182
+ msgid "were abandoned. We were able to recover"
183
+ msgstr ") opustených košíkov. Objednávku sme spätne získali z"
184
+
185
+ #: woocommerce-ac.php:1495
186
+ msgid "of them, which led to an extra"
187
+ msgstr ",čo viedlo k "
188
+
189
+ #: woocommerce-ac.php:1495
190
+ msgid "in sales"
191
+ msgstr "obratu."
192
+
193
+ #: woocommerce-ac.php:1504
194
+ msgid "Created On"
195
+ msgstr "Vytvorené"
196
+
197
+ #: woocommerce-ac.php:1510
198
+ msgid "Recovered Date"
199
+ msgstr "Dátum znovuzískania"
200
+
201
+ #: woocommerce-ac.php:1561
202
+ msgid "Template Name:"
203
+ msgstr "Názov šablóny:"
204
+
205
+ #: woocommerce-ac.php:1572
206
+ msgid "Enter a template name for reference"
207
+ msgstr "Zadajte názov šablóny pre priradenie"
208
+
209
+ #: woocommerce-ac.php:1577
210
+ msgid "Send From This Name:"
211
+ msgstr "Meno odosielateľa:"
212
+
213
+ #: woocommerce-ac.php:1588
214
+ msgid "Enter the name that should appear in the email sent"
215
+ msgstr "Zadajte meno ktoré sa zobrazí ako odosielateľ"
216
+
217
+ #: woocommerce-ac.php:1594
218
+ msgid "Subject:"
219
+ msgstr "Predmet:"
220
+
221
+ #: woocommerce-ac.php:1605
222
+ msgid "Enter the subject that should appear in the email sent"
223
+ msgstr "Zadajte predmet, ktorý by sa mal objaviť v odolsanom emaile"
224
+
225
+ #: woocommerce-ac.php:1611
226
+ msgid "Email Body:"
227
+ msgstr "Telo emailu:"
228
+
229
+ #: woocommerce-ac.php:1627
230
+ msgid "Message to be sent in the reminder email."
231
+ msgstr "Správa odoslaná ako pripomienkobý email."
232
+
233
+ #: woocommerce-ac.php:1634
234
+ msgid "Send this email:"
235
+ msgstr "Odoslat tento email."
236
+
237
+ #: woocommerce-ac.php:1686
238
+ msgid "after cart is abandoned."
239
+ msgstr "po opustení košíka."
240
+
241
+ #: woocommerce-ac.php:1693
242
+ msgid "Send a test email to:"
243
+ msgstr "Odoslať testovací email na:"
244
+
245
+ #: woocommerce-ac.php:1699
246
+ msgid "Enter the email id to which the test email needs to be sent."
247
+ msgstr "Zadajte email na ktorý sa ma testovací email odoslať."
248
+
249
+ #: woocommerce-ac.php:1835 send_email.php:109
250
+ msgid "Your Shopping Cart"
251
+ msgstr "Váš nakúpný košík"
252
+
253
+ #: woocommerce-ac.php:1838 send_email.php:112
254
+ msgid "Item"
255
+ msgstr "Položka"
256
+
257
+ #: woocommerce-ac.php:1839 send_email.php:113
258
+ msgid "Name"
259
+ msgstr "Meno"
260
+
261
+ #: woocommerce-ac.php:1840 send_email.php:114
262
+ msgid "Quantity"
263
+ msgstr "Množstvo"
264
+
265
+ #: woocommerce-ac.php:1841 send_email.php:115
266
+ msgid "Price"
267
+ msgstr "Cena"
268
+
269
+ #: woocommerce-ac.php:1842 send_email.php:116
270
+ msgid "Line Subtotal"
271
+ msgstr "Subtotal"
272
+
273
+ #: woocommerce-ac.php:1846
274
+ msgid "Men\\'\\s Formal Shoes"
275
+ msgstr ""
276
+
277
+ #: woocommerce-ac.php:1853
278
+ msgid "Woman\\'\\s Hand Bags"
279
+ msgstr ""
280
+
281
+ #: woocommerce-ac.php:1862 send_email.php:160
282
+ msgid "Cart Total:"
283
+ msgstr "Košík spolu:"
{languages → i18n/languages}/woocommerce-ac.mo RENAMED
File without changes
{languages → i18n/languages}/woocommerce-ac.po RENAMED
@@ -1,269 +1,269 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- msgid ""
7
- msgstr ""
8
- "Project-Id-Version: woocommerce-ac\n"
9
- "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2015-07-08 16:30+0530\n"
11
- "PO-Revision-Date: 2015-07-16 11:02+0530\n"
12
- "Last-Translator: \n"
13
- "Language-Team: \n"
14
- "MIME-Version: 1.0\n"
15
- "Content-Type: text/plain; charset=UTF-8\n"
16
- "Content-Transfer-Encoding: 8bit\n"
17
- "X-Generator: Poedit 1.5.7\n"
18
- "X-Poedit-KeywordsList: __;_e\n"
19
- "X-Poedit-Basepath: .\n"
20
-
21
- #: woocommerce-ac.php:22
22
- msgid "Once Every Five Minutes"
23
- msgstr ""
24
-
25
- #: woocommerce-ac.php:204
26
- #, php-format
27
- msgid ""
28
- "You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
29
- "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
30
- "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
31
- "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
32
- "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
33
- msgstr ""
34
-
35
- #: woocommerce-ac.php:314
36
- msgid "Abandoned Carts"
37
- msgstr ""
38
-
39
- #: woocommerce-ac.php:516
40
- msgid "Abandoned Orders"
41
- msgstr ""
42
-
43
- #: woocommerce-ac.php:517
44
- msgid "Email Templates"
45
- msgstr ""
46
-
47
- #: woocommerce-ac.php:518 woocommerce-ac.php:712
48
- msgid "Settings"
49
- msgstr ""
50
-
51
- #: woocommerce-ac.php:519
52
- msgid "Recovered Orders"
53
- msgstr ""
54
-
55
- #: woocommerce-ac.php:661
56
- msgid "You do not have sufficient permissions to access this page."
57
- msgstr ""
58
-
59
- #: woocommerce-ac.php:670
60
- msgid "WooCommerce - Abandon Cart Lite"
61
- msgstr ""
62
-
63
- #: woocommerce-ac.php:696
64
- msgid "Your settings have been saved."
65
- msgstr ""
66
-
67
- #: woocommerce-ac.php:718
68
- msgid "Cart abandoned cut-off time"
69
- msgstr ""
70
-
71
- #: woocommerce-ac.php:741
72
- msgid "minutes"
73
- msgstr ""
74
-
75
- #: woocommerce-ac.php:742 woocommerce-ac.php:743
76
- msgid ""
77
- "Consider cart abandoned after X minutes of item being added to cart & order "
78
- "not placed"
79
- msgstr ""
80
-
81
- #: woocommerce-ac.php:753
82
- msgid "Save Changes"
83
- msgstr ""
84
-
85
- #: woocommerce-ac.php:763
86
- msgid ""
87
- "The list below shows all Abandoned Carts which have remained in cart for a "
88
- "time higher than the \"Cart abandoned cut-off time\" setting."
89
- msgstr ""
90
-
91
- #: woocommerce-ac.php:858 woocommerce-ac.php:1501
92
- msgid "Customer"
93
- msgstr ""
94
-
95
- #: woocommerce-ac.php:859 woocommerce-ac.php:1514
96
- msgid "Order Total"
97
- msgstr ""
98
-
99
- #: woocommerce-ac.php:862
100
- msgid "Date"
101
- msgstr ""
102
-
103
- #: woocommerce-ac.php:868
104
- msgid "Status"
105
- msgstr ""
106
-
107
- #: woocommerce-ac.php:872 woocommerce-ac.php:1159
108
- msgid "Actions"
109
- msgstr ""
110
-
111
- #: woocommerce-ac.php:953
112
- msgid ""
113
- "Add email templates at different intervals to maximize the possibility of "
114
- "recovering your abandoned carts."
115
- msgstr ""
116
-
117
- #: woocommerce-ac.php:1054
118
- msgid "The Email Template has been successfully added."
119
- msgstr ""
120
-
121
- #: woocommerce-ac.php:1057
122
- msgid "The Email Template has been successfully updated."
123
- msgstr ""
124
-
125
- #: woocommerce-ac.php:1145
126
- msgid "Sr"
127
- msgstr ""
128
-
129
- #: woocommerce-ac.php:1148
130
- msgid "Template Name"
131
- msgstr ""
132
-
133
- #: woocommerce-ac.php:1154
134
- msgid "Sent"
135
- msgstr ""
136
-
137
- #: woocommerce-ac.php:1158
138
- msgid "Active ?"
139
- msgstr ""
140
-
141
- #: woocommerce-ac.php:1276
142
- msgid ""
143
- "The Report below shows how many Abandoned Carts we were able to recover for "
144
- "you by sending automatic emails to encourage shoppers."
145
- msgstr ""
146
-
147
- #: woocommerce-ac.php:1331
148
- msgid "Start Date:"
149
- msgstr ""
150
-
151
- #: woocommerce-ac.php:1334
152
- msgid "End Date:"
153
- msgstr ""
154
-
155
- #: woocommerce-ac.php:1337
156
- msgid "Go"
157
- msgstr ""
158
-
159
- #: woocommerce-ac.php:1495
160
- msgid "During the selected range"
161
- msgstr ""
162
-
163
- #: woocommerce-ac.php:1495
164
- msgid "carts totaling"
165
- msgstr ""
166
-
167
- #: woocommerce-ac.php:1495
168
- msgid "were abandoned. We were able to recover"
169
- msgstr ""
170
-
171
- #: woocommerce-ac.php:1495
172
- msgid "of them, which led to an extra"
173
- msgstr ""
174
-
175
- #: woocommerce-ac.php:1495
176
- msgid "in sales"
177
- msgstr ""
178
-
179
- #: woocommerce-ac.php:1504
180
- msgid "Created On"
181
- msgstr ""
182
-
183
- #: woocommerce-ac.php:1510
184
- msgid "Recovered Date"
185
- msgstr ""
186
-
187
- #: woocommerce-ac.php:1561
188
- msgid "Template Name:"
189
- msgstr ""
190
-
191
- #: woocommerce-ac.php:1572
192
- msgid "Enter a template name for reference"
193
- msgstr ""
194
-
195
- #: woocommerce-ac.php:1577
196
- msgid "Send From This Name:"
197
- msgstr ""
198
-
199
- #: woocommerce-ac.php:1588
200
- msgid "Enter the name that should appear in the email sent"
201
- msgstr ""
202
-
203
- #: woocommerce-ac.php:1594
204
- msgid "Subject:"
205
- msgstr ""
206
-
207
- #: woocommerce-ac.php:1605
208
- msgid "Enter the subject that should appear in the email sent"
209
- msgstr ""
210
-
211
- #: woocommerce-ac.php:1611
212
- msgid "Email Body:"
213
- msgstr ""
214
-
215
- #: woocommerce-ac.php:1627
216
- msgid "Message to be sent in the reminder email."
217
- msgstr ""
218
-
219
- #: woocommerce-ac.php:1634
220
- msgid "Send this email:"
221
- msgstr ""
222
-
223
- #: woocommerce-ac.php:1686
224
- msgid "after cart is abandoned."
225
- msgstr ""
226
-
227
- #: woocommerce-ac.php:1693
228
- msgid "Send a test email to:"
229
- msgstr ""
230
-
231
- #: woocommerce-ac.php:1699
232
- msgid "Enter the email id to which the test email needs to be sent."
233
- msgstr ""
234
-
235
- #: woocommerce-ac.php:1835 send_email.php:109
236
- msgid "Your Shopping Cart"
237
- msgstr ""
238
-
239
- #: woocommerce-ac.php:1838 send_email.php:112
240
- msgid "Item"
241
- msgstr ""
242
-
243
- #: woocommerce-ac.php:1839 send_email.php:113
244
- msgid "Name"
245
- msgstr ""
246
-
247
- #: woocommerce-ac.php:1840 send_email.php:114
248
- msgid "Quantity"
249
- msgstr ""
250
-
251
- #: woocommerce-ac.php:1841 send_email.php:115
252
- msgid "Price"
253
- msgstr ""
254
-
255
- #: woocommerce-ac.php:1842 send_email.php:116
256
- msgid "Line Subtotal"
257
- msgstr ""
258
-
259
- #: woocommerce-ac.php:1846
260
- msgid "Men\\'\\s Formal Shoes"
261
- msgstr ""
262
-
263
- #: woocommerce-ac.php:1853
264
- msgid "Woman\\'\\s Hand Bags"
265
- msgstr ""
266
-
267
- #: woocommerce-ac.php:1862 send_email.php:160
268
- msgid "Cart Total:"
269
- msgstr ""
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: woocommerce-ac\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2015-07-08 16:30+0530\n"
11
+ "PO-Revision-Date: 2015-07-16 11:02+0530\n"
12
+ "Last-Translator: \n"
13
+ "Language-Team: \n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Generator: Poedit 1.5.7\n"
18
+ "X-Poedit-KeywordsList: __;_e\n"
19
+ "X-Poedit-Basepath: .\n"
20
+
21
+ #: woocommerce-ac.php:22
22
+ msgid "Once Every Five Minutes"
23
+ msgstr ""
24
+
25
+ #: woocommerce-ac.php:204
26
+ #, php-format
27
+ msgid ""
28
+ "You can upgrade to the <a href=\"https://www.tychesoftwares.com/store/"
29
+ "premium-plugins/woocommerce-abandoned-cart-pro/\">PRO version of WooCommerce "
30
+ "Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: "
31
+ "<b>ACPRO20</b>.<a href=\"https://www.tychesoftwares.com/store/premium-"
32
+ "plugins/woocommerce-abandoned-cart-pro/\"> Purchase now </a> & save $24!"
33
+ msgstr ""
34
+
35
+ #: woocommerce-ac.php:314
36
+ msgid "Abandoned Carts"
37
+ msgstr ""
38
+
39
+ #: woocommerce-ac.php:516
40
+ msgid "Abandoned Orders"
41
+ msgstr ""
42
+
43
+ #: woocommerce-ac.php:517
44
+ msgid "Email Templates"
45
+ msgstr ""
46
+
47
+ #: woocommerce-ac.php:518 woocommerce-ac.php:712
48
+ msgid "Settings"
49
+ msgstr ""
50
+
51
+ #: woocommerce-ac.php:519
52
+ msgid "Recovered Orders"
53
+ msgstr ""
54
+
55
+ #: woocommerce-ac.php:661
56
+ msgid "You do not have sufficient permissions to access this page."
57
+ msgstr ""
58
+
59
+ #: woocommerce-ac.php:670
60
+ msgid "WooCommerce - Abandon Cart Lite"
61
+ msgstr ""
62
+
63
+ #: woocommerce-ac.php:696
64
+ msgid "Your settings have been saved."
65
+ msgstr ""
66
+
67
+ #: woocommerce-ac.php:718
68
+ msgid "Cart abandoned cut-off time"
69
+ msgstr ""
70
+
71
+ #: woocommerce-ac.php:741
72
+ msgid "minutes"
73
+ msgstr ""
74
+
75
+ #: woocommerce-ac.php:742 woocommerce-ac.php:743
76
+ msgid ""
77
+ "Consider cart abandoned after X minutes of item being added to cart & order "
78
+ "not placed"
79
+ msgstr ""
80
+
81
+ #: woocommerce-ac.php:753
82
+ msgid "Save Changes"
83
+ msgstr ""
84
+
85
+ #: woocommerce-ac.php:763
86
+ msgid ""
87
+ "The list below shows all Abandoned Carts which have remained in cart for a "
88
+ "time higher than the \"Cart abandoned cut-off time\" setting."
89
+ msgstr ""
90
+
91
+ #: woocommerce-ac.php:858 woocommerce-ac.php:1501
92
+ msgid "Customer"
93
+ msgstr ""
94
+
95
+ #: woocommerce-ac.php:859 woocommerce-ac.php:1514
96
+ msgid "Order Total"
97
+ msgstr ""
98
+
99
+ #: woocommerce-ac.php:862
100
+ msgid "Date"
101
+ msgstr ""
102
+
103
+ #: woocommerce-ac.php:868
104
+ msgid "Status"
105
+ msgstr ""
106
+
107
+ #: woocommerce-ac.php:872 woocommerce-ac.php:1159
108
+ msgid "Actions"
109
+ msgstr ""
110
+
111
+ #: woocommerce-ac.php:953
112
+ msgid ""
113
+ "Add email templates at different intervals to maximize the possibility of "
114
+ "recovering your abandoned carts."
115
+ msgstr ""
116
+
117
+ #: woocommerce-ac.php:1054
118
+ msgid "The Email Template has been successfully added."
119
+ msgstr ""
120
+
121
+ #: woocommerce-ac.php:1057
122
+ msgid "The Email Template has been successfully updated."
123
+ msgstr ""
124
+
125
+ #: woocommerce-ac.php:1145
126
+ msgid "Sr"
127
+ msgstr ""
128
+
129
+ #: woocommerce-ac.php:1148
130
+ msgid "Template Name"
131
+ msgstr ""
132
+
133
+ #: woocommerce-ac.php:1154
134
+ msgid "Sent"
135
+ msgstr ""
136
+
137
+ #: woocommerce-ac.php:1158
138
+ msgid "Active ?"
139
+ msgstr ""
140
+
141
+ #: woocommerce-ac.php:1276
142
+ msgid ""
143
+ "The Report below shows how many Abandoned Carts we were able to recover for "
144
+ "you by sending automatic emails to encourage shoppers."
145
+ msgstr ""
146
+
147
+ #: woocommerce-ac.php:1331
148
+ msgid "Start Date:"
149
+ msgstr ""
150
+
151
+ #: woocommerce-ac.php:1334
152
+ msgid "End Date:"
153
+ msgstr ""
154
+
155
+ #: woocommerce-ac.php:1337
156
+ msgid "Go"
157
+ msgstr ""
158
+
159
+ #: woocommerce-ac.php:1495
160
+ msgid "During the selected range"
161
+ msgstr ""
162
+
163
+ #: woocommerce-ac.php:1495
164
+ msgid "carts totaling"
165
+ msgstr ""
166
+
167
+ #: woocommerce-ac.php:1495
168
+ msgid "were abandoned. We were able to recover"
169
+ msgstr ""
170
+
171
+ #: woocommerce-ac.php:1495
172
+ msgid "of them, which led to an extra"
173
+ msgstr ""
174
+
175
+ #: woocommerce-ac.php:1495
176
+ msgid "in sales"
177
+ msgstr ""
178
+
179
+ #: woocommerce-ac.php:1504
180
+ msgid "Created On"
181
+ msgstr ""
182
+
183
+ #: woocommerce-ac.php:1510
184
+ msgid "Recovered Date"
185
+ msgstr ""
186
+
187
+ #: woocommerce-ac.php:1561
188
+ msgid "Template Name:"
189
+ msgstr ""
190
+
191
+ #: woocommerce-ac.php:1572
192
+ msgid "Enter a template name for reference"
193
+ msgstr ""
194
+
195
+ #: woocommerce-ac.php:1577
196
+ msgid "Send From This Name:"
197
+ msgstr ""
198
+
199
+ #: woocommerce-ac.php:1588
200
+ msgid "Enter the name that should appear in the email sent"
201
+ msgstr ""
202
+
203
+ #: woocommerce-ac.php:1594
204
+ msgid "Subject:"
205
+ msgstr ""
206
+
207
+ #: woocommerce-ac.php:1605
208
+ msgid "Enter the subject that should appear in the email sent"
209
+ msgstr ""
210
+
211
+ #: woocommerce-ac.php:1611
212
+ msgid "Email Body:"
213
+ msgstr ""
214
+
215
+ #: woocommerce-ac.php:1627
216
+ msgid "Message to be sent in the reminder email."
217
+ msgstr ""
218
+
219
+ #: woocommerce-ac.php:1634
220
+ msgid "Send this email:"
221
+ msgstr ""
222
+
223
+ #: woocommerce-ac.php:1686
224
+ msgid "after cart is abandoned."
225
+ msgstr ""
226
+
227
+ #: woocommerce-ac.php:1693
228
+ msgid "Send a test email to:"
229
+ msgstr ""
230
+
231
+ #: woocommerce-ac.php:1699
232
+ msgid "Enter the email id to which the test email needs to be sent."
233
+ msgstr ""
234
+
235
+ #: woocommerce-ac.php:1835 send_email.php:109
236
+ msgid "Your Shopping Cart"
237
+ msgstr ""
238
+
239
+ #: woocommerce-ac.php:1838 send_email.php:112
240
+ msgid "Item"
241
+ msgstr ""
242
+
243
+ #: woocommerce-ac.php:1839 send_email.php:113
244
+ msgid "Name"
245
+ msgstr ""
246
+
247
+ #: woocommerce-ac.php:1840 send_email.php:114
248
+ msgid "Quantity"
249
+ msgstr ""
250
+
251
+ #: woocommerce-ac.php:1841 send_email.php:115
252
+ msgid "Price"
253
+ msgstr ""
254
+
255
+ #: woocommerce-ac.php:1842 send_email.php:116
256
+ msgid "Line Subtotal"
257
+ msgstr ""
258
+
259
+ #: woocommerce-ac.php:1846
260
+ msgid "Men\\'\\s Formal Shoes"
261
+ msgstr ""
262
+
263
+ #: woocommerce-ac.php:1853
264
+ msgid "Woman\\'\\s Hand Bags"
265
+ msgstr ""
266
+
267
+ #: woocommerce-ac.php:1862 send_email.php:160
268
+ msgid "Cart Total:"
269
+ msgstr ""
includes/classes/class-wcal-abandoned-orders-table.php ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Load WP_List_Table if not loaded
3
+ if ( ! class_exists( 'WP_List_Table' ) ) {
4
+ require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
5
+ }
6
+
7
+ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
8
+
9
+ /**
10
+ * Number of results to show per page
11
+ *
12
+ * @var string
13
+ * @since 2.5.2
14
+ */
15
+ public $per_page = 30;
16
+
17
+ /**
18
+ * URL of this page
19
+ *
20
+ * @var string
21
+ * @since 2.5.2
22
+ */
23
+ public $base_url;
24
+
25
+ /**
26
+ * Total number of bookings
27
+ *
28
+ * @var int
29
+ * @since 2.5.2
30
+ */
31
+ public $total_count;
32
+
33
+ /**
34
+ * Get things started
35
+ *
36
+ * @see WP_List_Table::__construct()
37
+ */
38
+ public function __construct() {
39
+ global $status, $page;
40
+ // Set parent defaults
41
+ parent::__construct( array(
42
+ 'singular' => __( 'abandoned_order_id', 'woocommerce-ac' ), //singular name of the listed records
43
+ 'plural' => __( 'abandoned_order_ids', 'woocommerce-ac' ), //plural name of the listed records
44
+ 'ajax' => false // Does this table support ajax?
45
+ ) );
46
+ $this->process_bulk_action();
47
+ $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page' );
48
+ }
49
+
50
+ public function wcal_abandoned_order_prepare_items() {
51
+ $columns = $this->get_columns();
52
+ $hidden = array(); // No hidden columns
53
+ $sortable = $this->get_sortable_columns();
54
+ $this->total_count = 0;
55
+ $data = $this->wcal_abandoned_cart_data();
56
+ $this->_column_headers = array( $columns, $hidden, $sortable );
57
+ $total_items = $this->total_count;
58
+
59
+ if( count( $data ) > 0 ) {
60
+ $this->items = $data;
61
+ } else {
62
+ $this->items = array();
63
+ }
64
+ $this->set_pagination_args( array(
65
+ 'total_items' => $total_items, // WE have to calculate the total number of items
66
+ 'per_page' => $this->per_page, // WE have to determine how many items to show on a page
67
+ 'total_pages' => ceil( $total_items / $this->per_page ) // WE have to calculate the total number of pages
68
+ )
69
+ );
70
+ }
71
+
72
+ public function get_columns() {
73
+ $columns = array();
74
+ $columns = array(
75
+ 'cb' => '<input type="checkbox" />',
76
+ 'id' => __( 'Id', 'woocommerce-ac' ),
77
+ 'email' => __( 'Email Address', 'woocommerce-ac' ),
78
+ 'customer' => __( 'Customer', 'woocommerce-ac' ),
79
+ 'order_total' => __( 'Order Total', 'woocommerce-ac' ),
80
+ 'date' => __( 'Abandoned Date', 'woocommerce-ac' ),
81
+ 'status' => __( 'Status of Cart', 'woocommerce-ac' )
82
+ );
83
+ return apply_filters( 'wcal_abandoned_orders_columns', $columns );
84
+ }
85
+
86
+ /***
87
+ * It is used to add the check box for the items
88
+ */
89
+ function column_cb( $item ){
90
+ $abandoned_order_id = '';
91
+ if( isset( $item->id ) && "" != $item->id ) {
92
+ $abandoned_order_id = $item->id;
93
+ }
94
+ return sprintf(
95
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
96
+ 'abandoned_order_id',
97
+ $abandoned_order_id
98
+ );
99
+ }
100
+
101
+ public function get_sortable_columns() {
102
+ $columns = array(
103
+ 'date' => array( 'date', false ),
104
+ 'status' => array( 'status',false),
105
+ );
106
+ return apply_filters( 'wcal_abandoned_orders_sortable_columns', $columns );
107
+ }
108
+
109
+ /**
110
+ * Render the Email Column
111
+ *
112
+ * @access public
113
+ * @since 2.4.8
114
+ * @param array $abandoned_row_info Contains all the data of the abandoned order tabs row
115
+ * @return string Data shown in the Email column
116
+ *
117
+ * This function used for individual delete of row, It is for hover effect delete.
118
+ */
119
+ public function column_email( $abandoned_row_info ) {
120
+ $row_actions = array();
121
+ $value = '';
122
+ $abandoned_order_id = 0;
123
+
124
+ if( isset( $abandoned_row_info->email ) ) {
125
+ $abandoned_order_id = $abandoned_row_info->id ;
126
+ $row_actions['edit'] = '<a href="' . wp_nonce_url( add_query_arg( array( 'action' => 'orderdetails', 'id' => $abandoned_row_info->id ), $this->base_url ), 'abandoned_order_nonce') . '">' . __( 'View order', 'woocommerce-ac' ) . '</a>';
127
+ $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( 'action' => 'wcal_delete', 'abandoned_order_id' => $abandoned_row_info->id ), $this->base_url ), 'abandoned_order_nonce') . '">' . __( 'Delete', 'woocommerce-ac' ) . '</a>';
128
+ $email = $abandoned_row_info->email;
129
+ $value = $email . $this->row_actions( $row_actions );
130
+ }
131
+ return apply_filters( 'wcal_abandoned_orders_single_column', $value, $abandoned_order_id, 'email' );
132
+ }
133
+
134
+ public function wcal_abandoned_cart_data() {
135
+ global $wpdb;
136
+ $return_abandoned_orders = array();
137
+ $per_page = $this->per_page;
138
+ $results = array();
139
+ $blank_cart_info = '{"cart":[]}';
140
+ $blank_cart_info_guest = '[]';
141
+
142
+ // non-multisite - regular table name
143
+ $query = "SELECT wpac . * , wpu.user_login, wpu.user_email FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac
144
+ LEFT JOIN ".$wpdb->base_prefix."users AS wpu ON wpac.user_id = wpu.id
145
+ WHERE recovered_cart = '0'
146
+ AND wpac.abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND wpac.abandoned_cart_info NOT LIKE '$blank_cart_info_guest' ORDER BY wpac.abandoned_cart_time DESC";
147
+ $results = $wpdb->get_results($query);
148
+ $i = 0;
149
+
150
+ foreach( $results as $key => $value ) {
151
+ if( $value->user_type == "GUEST" ) {
152
+ $query_guest = "SELECT * from `" . $wpdb->prefix . "ac_guest_abandoned_cart_history_lite` WHERE id = %d";
153
+ $results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $value->user_id ) );
154
+ }
155
+ $abandoned_order_id = $value->id;
156
+ $user_id = $value->user_id;
157
+ $user_login = $value->user_login;
158
+
159
+ if ( $value->user_type == "GUEST" ) {
160
+
161
+ if ( isset( $results_guest[0]->email_id ) ) {
162
+ $user_email = $results_guest[0]->email_id;
163
+ }
164
+
165
+ if ( isset( $results_guest[0]->billing_first_name ) ) {
166
+ $user_first_name = $results_guest[0]->billing_first_name;
167
+ } else {
168
+ $user_first_name = "";
169
+ }
170
+
171
+ if ( isset( $results_guest[0]->billing_last_name ) ) {
172
+ $user_last_name = $results_guest[0]->billing_last_name;
173
+ } else {
174
+ $user_last_name = "";
175
+ }
176
+ } else {
177
+ $user_email_billing = get_user_meta( $value->user_id, 'billing_email', true );
178
+ if( $user_email_billing != '' ) {
179
+ $user_email = $user_email_billing;
180
+ } else {
181
+ $user_data = get_userdata( $value->user_id );
182
+ $user_email = $user_data->user_email;
183
+ }
184
+ $user_first_name = "";
185
+ $user_first_name_temp = get_user_meta( $user_id, 'billing_first_name', true );
186
+ if( isset( $user_first_name_temp ) && "" == $user_first_name_temp ) {
187
+ $user_data = get_userdata( $user_id );
188
+ $user_first_name = $user_data->first_name;
189
+ } else {
190
+ $user_first_name = $user_first_name_temp;
191
+ }
192
+
193
+ $user_last_name = "";
194
+ $user_last_name_temp = get_user_meta( $user_id, 'billing_last_name', true );
195
+ if( isset( $user_last_name_temp ) && "" == $user_last_name_temp ) {
196
+ $user_data = get_userdata( $user_id );
197
+ $user_last_name = $user_data->last_name;
198
+ } else {
199
+ $user_last_name = $user_last_name_temp;
200
+ }
201
+ }
202
+
203
+ $cart_info = json_decode( $value->abandoned_cart_info );
204
+ $order_date = "";
205
+ $cart_update_time = $value->abandoned_cart_time;
206
+
207
+ if ( $cart_update_time != "" && $cart_update_time != 0 ) {
208
+ $order_date = date( 'd M, Y h:i A', $cart_update_time );
209
+ }
210
+
211
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
212
+ $cut_off_time = $ac_cutoff_time * 60;
213
+ $current_time = current_time( 'timestamp' );
214
+ $compare_time = $current_time - $cart_update_time;
215
+ $cart_details = array();
216
+ if( isset( $cart_info->cart ) ){
217
+ $cart_details = $cart_info->cart;
218
+ }
219
+ $line_total = 0;
220
+
221
+ if( count( $cart_details ) > 0 ) {
222
+ foreach( $cart_details as $k => $v ) {
223
+ if( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
224
+ $line_total = $line_total + $v->line_total + $v->line_subtotal_tax;
225
+ } else {
226
+ $line_total = $line_total + $v->line_total;
227
+ }
228
+ }
229
+ }
230
+ //$number_decimal = wc_get_price_decimals();
231
+ $line_total = wc_price( $line_total );
232
+ $quantity_total = 0;
233
+
234
+ if ( count( $cart_details ) > 0) {
235
+ foreach( $cart_details as $k => $v ) {
236
+ $quantity_total = $quantity_total + $v->quantity;
237
+ }
238
+ }
239
+
240
+ if ( 1 == $quantity_total ) {
241
+ $item_disp = __("item", "woocommerce-ac");
242
+ } else {
243
+ $item_disp = __("items", "woocommerce-ac");
244
+ }
245
+
246
+ if( $value->cart_ignored == 0 && $value->recovered_cart == 0 ) {
247
+ $ac_status = __( "Abandoned", "woocommerce-ac" );
248
+ } elseif( $value->cart_ignored == 1 && $value->recovered_cart == 0 ) {
249
+ $ac_status = __( "Abandoned but new","woocommerce-ac" )."</br>". __( "cart created after this", "woocommerce-ac" );
250
+ } else {
251
+ $ac_status = "";
252
+ }
253
+
254
+ if( $compare_time > $cut_off_time && $ac_status != "" ) {
255
+ $return_abandoned_orders[$i] = new stdClass();
256
+ if( $quantity_total > 0 ) {
257
+ $abandoned_order_id = $abandoned_order_id;
258
+ $customer_information = $user_first_name . " ".$user_last_name;
259
+ $return_abandoned_orders[ $i ]->id = $abandoned_order_id;
260
+ $return_abandoned_orders[ $i ]->email = $user_email;
261
+ $return_abandoned_orders[ $i ]->customer = $customer_information;
262
+ $return_abandoned_orders[ $i ]->order_total = $line_total;
263
+ $return_abandoned_orders[ $i ]->date = $order_date;
264
+ $return_abandoned_orders[ $i ]->status = $ac_status;
265
+ }else {
266
+ $abandoned_order_id = $abandoned_order_id;
267
+ $return_abandoned_orders[ $i ]->id = $abandoned_order_id;
268
+ $return_abandoned_orders[ $i ]->date = $order_date;
269
+ $return_abandoned_orders[ $i ]->status = $ac_status;
270
+ }
271
+ // To get the abandoned orders count
272
+ $this->total_count = count( $return_abandoned_orders );
273
+ $i++;
274
+ }
275
+ }
276
+ // sort for order date
277
+ if( isset( $_GET['orderby'] ) && $_GET['orderby'] == 'date' ) {
278
+ if( isset( $_GET['order'] ) && $_GET['order'] == 'asc' ) {
279
+ usort( $return_abandoned_orders, array( __CLASS__ , "wcal_class_order_date_asc") );
280
+ }
281
+ else {
282
+ usort( $return_abandoned_orders, array( __CLASS__ , "wcal_class_order_date_dsc") );
283
+ }
284
+ }
285
+ // sort for customer name
286
+ else if( isset( $_GET['orderby'] ) && $_GET['orderby'] == 'status' ) {
287
+ if( isset( $_GET['order'] ) && $_GET['order'] == 'asc' ) {
288
+ usort( $return_abandoned_orders, array( __CLASS__ , "wcal_class_status_asc" ) );
289
+ } else {
290
+ usort( $return_abandoned_orders, array( __CLASS__ , "wcal_class_status_dsc" ) );
291
+ }
292
+ }
293
+
294
+ if( isset( $_GET['paged'] ) && $_GET['paged'] > 1 ) {
295
+ $page_number = $_GET['paged'] - 1;
296
+ $k = $per_page * $page_number;
297
+ } else {
298
+ $k = 0;
299
+ }
300
+ $return_abandoned_orders_display = array();
301
+ for( $j = $k; $j < ( $k+$per_page ); $j++ ) {
302
+ if( isset( $return_abandoned_orders[$j] ) ) {
303
+ $return_abandoned_orders_display[$j] = $return_abandoned_orders[$j];
304
+ } else {
305
+ break;
306
+ }
307
+ }
308
+ return apply_filters( 'wcal_abandoned_orders_table_data', $return_abandoned_orders_display );
309
+ }
310
+
311
+ function wcal_class_order_date_asc( $value1,$value2 ) {
312
+ $date_two = $date_one = '';
313
+ $value_one = $value1->date;
314
+ $value_two = $value2->date;
315
+ $date_formatted_one = date_create_from_format( 'd M, Y h:i A', $value_one );
316
+ if( isset( $date_formatted_one ) && $date_formatted_one != '' ) {
317
+ $date_one = date_format( $date_formatted_one, 'Y-m-d h:i A' );
318
+ }
319
+
320
+ $date_formatted_two = date_create_from_format( 'd M, Y h:i A', $value_two );
321
+ if( isset( $date_formatted_two ) && $date_formatted_two != '' ) {
322
+ $date_two = date_format( $date_formatted_two, 'Y-m-d h:i A' );
323
+ }
324
+ return strtotime( $date_one ) - strtotime( $date_two );
325
+ }
326
+
327
+ function wcal_class_order_date_dsc( $value1,$value2 ) {
328
+ $date_two = $date_one = '';
329
+ $value_one = $value1->date;
330
+ $value_two = $value2->date;
331
+ $date_formatted_one = date_create_from_format( 'd M, Y h:i A', $value_one );
332
+ if( isset( $date_formatted_one ) && $date_formatted_one != '' ) {
333
+ $date_one = date_format( $date_formatted_one, 'Y-m-d h:i A' );
334
+ }
335
+
336
+ $date_formatted_two = date_create_from_format( 'd M, Y h:i A', $value_two );
337
+ if( isset( $date_formatted_two ) && $date_formatted_two != '' ) {
338
+ $date_two = date_format( $date_formatted_two, 'Y-m-d h:i A' );
339
+ }
340
+ return strtotime($date_two) - strtotime($date_one);
341
+ }
342
+
343
+ function wcal_class_status_asc( $value1,$value2 ) {
344
+ return strcasecmp( $value1->status,$value2->status );
345
+ }
346
+
347
+ function wcal_class_status_dsc( $value1,$value2 ) {
348
+ return strcasecmp( $value2->status,$value1->status );
349
+ }
350
+
351
+ public function column_default( $wcal_abandoned_orders, $column_name ) {
352
+ $value = '';
353
+ switch( $column_name ) {
354
+ case 'id' :
355
+ if( isset($wcal_abandoned_orders->id ) ) {
356
+ $value = '<strong><a href="admin.php?page=woocommerce_ac_page&action=orderdetails&id='.$wcal_abandoned_orders->id.' ">'.$wcal_abandoned_orders->id.'</a> </strong>';
357
+ }
358
+ break;
359
+ case 'customer' :
360
+ if( isset( $wcal_abandoned_orders->customer ) ) {
361
+ $value = $wcal_abandoned_orders->customer;
362
+ }
363
+ break;
364
+ case 'order_total' :
365
+ if( isset( $wcal_abandoned_orders->order_total ) ) {
366
+ $value = $wcal_abandoned_orders->order_total;
367
+ }
368
+ break;
369
+ case 'date' :
370
+ if( isset( $wcal_abandoned_orders->date ) ) {
371
+ $value = $wcal_abandoned_orders->date;
372
+ }
373
+ break;
374
+ case 'status' :
375
+ if( isset( $wcal_abandoned_orders->status ) ) {
376
+ $value = $wcal_abandoned_orders->status;
377
+ }
378
+ break;
379
+ default:
380
+ $value = isset( $wcal_abandoned_orders->$column_name ) ? $wcal_abandoned_orders->$column_name : '';
381
+ break;
382
+ }
383
+ return apply_filters( 'wcal_abandoned_orders_column_default', $value, $wcal_abandoned_orders, $column_name );
384
+ }
385
+
386
+ public function get_bulk_actions() {
387
+ return array(
388
+ 'wcal_delete' => __( 'Delete', 'woocommerce-ac' )
389
+ );
390
+ }
391
+ }
392
+ ?>
includes/classes/class-wcal-aes-counter.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
3
+ /* AES counter (CTR) mode implementation in PHP */
4
+ /* (c) Chris Veness 2005-2014 www.movable-type.co.uk/scripts */
5
+ /* Right of free use is granted for all commercial or non-commercial use under CC-BY licence. */
6
+ /* No warranty of any form is offered. */
7
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
8
+
9
+ Class Wcal_Aes_Ctr extends Wcal_Aes
10
+ {
11
+
12
+ /**
13
+ * Encrypt a text using AES encryption in Counter mode of operation
14
+ * - see http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
15
+ *
16
+ * Unicode multi-byte character safe
17
+ *
18
+ * @param plaintext source text to be encrypted
19
+ * @param password the password to use to generate a key
20
+ * @param nBits number of bits to be used in the key (128, 192, or 256)
21
+ * @return encrypted text
22
+ */
23
+ public static function encrypt($plaintext, $password, $nBits)
24
+ {
25
+ $blockSize = 16; // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
26
+ if (!($nBits == 128 || $nBits == 192 || $nBits == 256)) return ''; // standard allows 128/192/256 bit keys
27
+ // note PHP (5) gives us plaintext and password in UTF8 encoding!
28
+
29
+ // use AES itself to encrypt password to get cipher key (using plain password as source for
30
+ // key expansion) - gives us well encrypted key
31
+ $nBytes = $nBits / 8; // no bytes in key
32
+ $pwBytes = array();
33
+ for ($i = 0; $i < $nBytes; $i++) $pwBytes[$i] = ord(substr($password, $i, 1)) & 0xff;
34
+ $key = Wcal_Aes::cipher($pwBytes, Wcal_Aes::keyExpansion($pwBytes));
35
+ $key = array_merge($key, array_slice($key, 0, $nBytes - 16)); // expand key to 16/24/32 bytes long
36
+
37
+ // initialise 1st 8 bytes of counter block with nonce (NIST SP800-38A �B.2): [0-1] = millisec,
38
+ // [2-3] = random, [4-7] = seconds, giving guaranteed sub-ms uniqueness up to Feb 2106
39
+ $counterBlock = array();
40
+ $nonce = floor(microtime(true) * 1000); // timestamp: milliseconds since 1-Jan-1970
41
+ $nonceMs = $nonce % 1000;
42
+ $nonceSec = floor($nonce / 1000);
43
+ $nonceRnd = floor(rand(0, 0xffff));
44
+
45
+ for ($i = 0; $i < 2; $i++) $counterBlock[$i] = self::urs($nonceMs, $i * 8) & 0xff;
46
+ for ($i = 0; $i < 2; $i++) $counterBlock[$i + 2] = self::urs($nonceRnd, $i * 8) & 0xff;
47
+ for ($i = 0; $i < 4; $i++) $counterBlock[$i + 4] = self::urs($nonceSec, $i * 8) & 0xff;
48
+
49
+ // and convert it to a string to go on the front of the ciphertext
50
+ $ctrTxt = '';
51
+ for ($i = 0; $i < 8; $i++) $ctrTxt .= chr($counterBlock[$i]);
52
+
53
+ // generate key schedule - an expansion of the key into distinct Key Rounds for each round
54
+ $keySchedule = Wcal_Aes::keyExpansion($key);
55
+ //print_r($keySchedule);
56
+
57
+ $blockCount = ceil(strlen($plaintext) / $blockSize);
58
+ $ciphertxt = array(); // ciphertext as array of strings
59
+
60
+ for ($b = 0; $b < $blockCount; $b++) {
61
+ // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
62
+ // done in two stages for 32-bit ops: using two words allows us to go past 2^32 blocks (68GB)
63
+ for ($c = 0; $c < 4; $c++) $counterBlock[15 - $c] = self::urs($b, $c * 8) & 0xff;
64
+ for ($c = 0; $c < 4; $c++) $counterBlock[15 - $c - 4] = self::urs($b / 0x100000000, $c * 8);
65
+
66
+ $cipherCntr = Wcal_Aes::cipher($counterBlock, $keySchedule); // -- encrypt counter block --
67
+
68
+ // block size is reduced on final block
69
+ $blockLength = $b < $blockCount - 1 ? $blockSize : (strlen($plaintext) - 1) % $blockSize + 1;
70
+ $cipherByte = array();
71
+
72
+ for ($i = 0; $i < $blockLength; $i++) { // -- xor plaintext with ciphered counter byte-by-byte --
73
+ $cipherByte[$i] = $cipherCntr[$i] ^ ord(substr($plaintext, $b * $blockSize + $i, 1));
74
+ $cipherByte[$i] = chr($cipherByte[$i]);
75
+ }
76
+ $ciphertxt[$b] = implode('', $cipherByte); // escape troublesome characters in ciphertext
77
+ }
78
+
79
+ // implode is more efficient than repeated string concatenation
80
+ $ciphertext = $ctrTxt . implode('', $ciphertxt);
81
+ $ciphertext = base64_encode($ciphertext);
82
+ return $ciphertext;
83
+ }
84
+
85
+
86
+ /**
87
+ * Decrypt a text encrypted by AES in counter mode of operation
88
+ *
89
+ * @param ciphertext source text to be decrypted
90
+ * @param password the password to use to generate a key
91
+ * @param nBits number of bits to be used in the key (128, 192, or 256)
92
+ * @return decrypted text
93
+ */
94
+ public static function decrypt($ciphertext, $password, $nBits)
95
+ {
96
+ $blockSize = 16; // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
97
+ if (!($nBits == 128 || $nBits == 192 || $nBits == 256)) return ''; // standard allows 128/192/256 bit keys
98
+ $ciphertext = base64_decode($ciphertext);
99
+
100
+ // use AES to encrypt password (mirroring encrypt routine)
101
+ $nBytes = $nBits / 8; // no bytes in key
102
+ $pwBytes = array();
103
+ for ($i = 0; $i < $nBytes; $i++) $pwBytes[$i] = ord(substr($password, $i, 1)) & 0xff;
104
+ $key = Wcal_Aes::cipher($pwBytes, Wcal_Aes::keyExpansion($pwBytes));
105
+ $key = array_merge($key, array_slice($key, 0, $nBytes - 16)); // expand key to 16/24/32 bytes long
106
+
107
+ // recover nonce from 1st element of ciphertext
108
+ $counterBlock = array();
109
+ $ctrTxt = substr($ciphertext, 0, 8);
110
+ for ($i = 0; $i < 8; $i++) $counterBlock[$i] = ord(substr($ctrTxt, $i, 1));
111
+
112
+ // generate key schedule
113
+ $keySchedule = Wcal_Aes::keyExpansion($key);
114
+
115
+ // separate ciphertext into blocks (skipping past initial 8 bytes)
116
+ $nBlocks = ceil((strlen($ciphertext) - 8) / $blockSize);
117
+ $ct = array();
118
+ for ($b = 0; $b < $nBlocks; $b++) $ct[$b] = substr($ciphertext, 8 + $b * $blockSize, 16);
119
+ $ciphertext = $ct; // ciphertext is now array of block-length strings
120
+
121
+ // plaintext will get generated block-by-block into array of block-length strings
122
+ $plaintxt = array();
123
+
124
+ for ($b = 0; $b < $nBlocks; $b++) {
125
+ // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
126
+ for ($c = 0; $c < 4; $c++) $counterBlock[15 - $c] = self::urs($b, $c * 8) & 0xff;
127
+ for ($c = 0; $c < 4; $c++) $counterBlock[15 - $c - 4] = self::urs(($b + 1) / 0x100000000 - 1, $c * 8) & 0xff;
128
+
129
+ $cipherCntr = Wcal_Aes::cipher($counterBlock, $keySchedule); // encrypt counter block
130
+
131
+ $plaintxtByte = array();
132
+ for ($i = 0; $i < strlen($ciphertext[$b]); $i++) {
133
+ // -- xor plaintext with ciphered counter byte-by-byte --
134
+ $plaintxtByte[$i] = $cipherCntr[$i] ^ ord(substr($ciphertext[$b], $i, 1));
135
+ $plaintxtByte[$i] = chr($plaintxtByte[$i]);
136
+
137
+ }
138
+ $plaintxt[$b] = implode('', $plaintxtByte);
139
+ }
140
+
141
+ // join array of blocks into single plaintext string
142
+ $plaintext = implode('', $plaintxt);
143
+
144
+ return $plaintext;
145
+ }
146
+
147
+
148
+ /*
149
+ * Unsigned right shift function, since PHP has neither >>> operator nor unsigned ints
150
+ *
151
+ * @param a number to be shifted (32-bit integer)
152
+ * @param b number of bits to shift a to the right (0..31)
153
+ * @return a right-shifted and zero-filled by b bits
154
+ */
155
+ private static function urs($a, $b)
156
+ {
157
+ $a &= 0xffffffff;
158
+ $b &= 0x1f; // (bounds check)
159
+ if ($a & 0x80000000 && $b > 0) { // if left-most bit set
160
+ $a = ($a >> 1) & 0x7fffffff; // right-shift one bit & clear left-most bit
161
+ $a = $a >> ($b - 1); // remaining right-shifts
162
+ } else { // otherwise
163
+ $a = ($a >> $b); // use normal right-shift
164
+ }
165
+ return $a;
166
+ }
167
+
168
+ }
169
+
170
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
includes/classes/class-wcal-aes.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
3
+ /* AES implementation in PHP */
4
+ /* (c) Chris Veness 2005-2014 www.movable-type.co.uk/scripts */
5
+ /* Right of free use is granted for all commercial or non-commercial use under CC-BY licence. */
6
+ /* No warranty of any form is offered. */
7
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
8
+
9
+ Class Wcal_Aes
10
+ {
11
+ /**
12
+ * AES Cipher function [�5.1]: encrypt 'input' with Rijndael algorithm
13
+ *
14
+ * @param input message as byte-array (16 bytes)
15
+ * @param w key schedule as 2D byte-array (Nr+1 x Nb bytes) -
16
+ * generated from the cipher key by keyExpansion()
17
+ * @return ciphertext as byte-array (16 bytes)
18
+ */
19
+ public static function cipher($input, $w)
20
+ {
21
+ $Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES)
22
+ $Nr = count($w) / $Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys
23
+ $state = array(); // initialise 4xNb byte-array 'state' with input [�3.4]
24
+ for( $i = 0; $i < 4 * $Nb; $i++ ) $state[$i % 4][floor($i / 4)] = $input[$i];
25
+
26
+ $state = self::addRoundKey( $state, $w, 0, $Nb );
27
+
28
+ for ( $round = 1; $round < $Nr; $round++ ) { // apply Nr rounds
29
+ $state = self::subBytes( $state, $Nb );
30
+ $state = self::shiftRows( $state, $Nb );
31
+ $state = self::mixColumns( $state, $Nb );
32
+ $state = self::addRoundKey( $state, $w, $round, $Nb );
33
+ }
34
+
35
+ $state = self::subBytes( $state, $Nb );
36
+ $state = self::shiftRows( $state, $Nb );
37
+ $state = self::addRoundKey( $state, $w, $Nr, $Nb );
38
+
39
+ $output = array( 4 * $Nb ); // convert state to 1-d array before returning [�3.4]
40
+ for( $i = 0; $i < 4 * $Nb; $i++ ) $output[$i] = $state[$i % 4][floor($i / 4)];
41
+ return $output;
42
+ }
43
+ /**
44
+ * Xor Round Key into state S [�5.1.4].
45
+ */
46
+ private static function addRoundKey( $state, $w, $rnd, $Nb )
47
+ {
48
+ for( $r = 0; $r < 4; $r++ ) {
49
+ for ($c = 0; $c < $Nb; $c++) $state[$r][$c] ^= $w[$rnd * 4 + $c][$r];
50
+ }
51
+ return $state;
52
+ }
53
+
54
+ /**
55
+ * Apply SBox to state S [�5.1.1].
56
+ */
57
+ private static function subBytes($s, $Nb)
58
+ {
59
+ for( $r = 0; $r < 4; $r++ ) {
60
+ for( $c = 0; $c < $Nb; $c++ ) $s[$r][$c] = self::$sBox[$s[$r][$c]];
61
+ }
62
+ return $s;
63
+ }
64
+
65
+ /**
66
+ * Shift row r of state S left by r bytes [�5.1.2].
67
+ */
68
+ private static function shiftRows($s, $Nb)
69
+ {
70
+ $t = array(4);
71
+ for ($r = 1; $r < 4; $r++) {
72
+ for ($c = 0; $c < 4; $c++) $t[$c] = $s[$r][($c + $r) % $Nb]; // shift into temp copy
73
+ for ($c = 0; $c < 4; $c++) $s[$r][$c] = $t[$c]; // and copy back
74
+ } // note that this will work for Nb=4,5,6, but not 7,8 (always 4 for AES):
75
+ return $s; // see fp.gladman.plus.com/cryptography_technology/rijndael/aes.spec.311.pdf
76
+ }
77
+
78
+ /**
79
+ * Combine bytes of each col of state S [�5.1.3].
80
+ */
81
+ private static function mixColumns($s, $Nb)
82
+ {
83
+ for ($c = 0; $c < 4; $c++) {
84
+ $a = array(4); // 'a' is a copy of the current column from 's'
85
+ $b = array(4); // 'b' is a�{02} in GF(2^8)
86
+ for ($i = 0; $i < 4; $i++) {
87
+ $a[$i] = $s[$i][$c];
88
+ $b[$i] = $s[$i][$c] & 0x80 ? $s[$i][$c] << 1 ^ 0x011b : $s[$i][$c] << 1;
89
+ }
90
+ // a[n] ^ b[n] is a�{03} in GF(2^8)
91
+ $s[0][$c] = $b[0] ^ $a[1] ^ $b[1] ^ $a[2] ^ $a[3]; // 2*a0 + 3*a1 + a2 + a3
92
+ $s[1][$c] = $a[0] ^ $b[1] ^ $a[2] ^ $b[2] ^ $a[3]; // a0 * 2*a1 + 3*a2 + a3
93
+ $s[2][$c] = $a[0] ^ $a[1] ^ $b[2] ^ $a[3] ^ $b[3]; // a0 + a1 + 2*a2 + 3*a3
94
+ $s[3][$c] = $a[0] ^ $b[0] ^ $a[1] ^ $a[2] ^ $b[3]; // 3*a0 + a1 + a2 + 2*a3
95
+ }
96
+ return $s;
97
+ }
98
+
99
+ /**
100
+ * Generate Key Schedule from Cipher Key [�5.2].
101
+ *
102
+ * Perform key expansion on cipher key to generate a key schedule.
103
+ *
104
+ * @param key cipher key byte-array (16 bytes).
105
+ * @return key schedule as 2D byte-array (Nr+1 x Nb bytes).
106
+ */
107
+ public static function keyExpansion($key)
108
+ {
109
+ $Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES)
110
+ $Nk = count($key) / 4; // key length (in words): 4/6/8 for 128/192/256-bit keys
111
+ $Nr = $Nk + 6; // no of rounds: 10/12/14 for 128/192/256-bit keys
112
+
113
+ $w = array();
114
+ $temp = array();
115
+
116
+ for ($i = 0; $i < $Nk; $i++) {
117
+ $r = array($key[4 * $i], $key[4 * $i + 1], $key[4 * $i + 2], $key[4 * $i + 3]);
118
+ $w[$i] = $r;
119
+ }
120
+
121
+ for ($i = $Nk; $i < ($Nb * ($Nr + 1)); $i++) {
122
+ $w[$i] = array();
123
+ for ($t = 0; $t < 4; $t++) $temp[$t] = $w[$i - 1][$t];
124
+ if ($i % $Nk == 0) {
125
+ $temp = self::subWord(self::rotWord($temp));
126
+ for ($t = 0; $t < 4; $t++) $temp[$t] ^= self::$rCon[$i / $Nk][$t];
127
+ } else if ($Nk > 6 && $i % $Nk == 4) {
128
+ $temp = self::subWord($temp);
129
+ }
130
+ for ($t = 0; $t < 4; $t++) $w[$i][$t] = $w[$i - $Nk][$t] ^ $temp[$t];
131
+ }
132
+ return $w;
133
+ }
134
+
135
+ /**
136
+ * Apply SBox to 4-byte word w.
137
+ */
138
+ private static function subWord($w)
139
+ {
140
+ for ($i = 0; $i < 4; $i++) $w[$i] = self::$sBox[$w[$i]];
141
+ return $w;
142
+ }
143
+
144
+ /**
145
+ * Rotate 4-byte word w left by one byte.
146
+ */
147
+ private static function rotWord($w)
148
+ {
149
+ $tmp = $w[0];
150
+ for ($i = 0; $i < 3; $i++) $w[$i] = $w[$i + 1];
151
+ $w[3] = $tmp;
152
+ return $w;
153
+ }
154
+
155
+ // sBox is pre-computed multiplicative inverse in GF(2^8) used in subBytes and keyExpansion [�5.1.1]
156
+ private static $sBox = array(
157
+ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
158
+ 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
159
+ 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
160
+ 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
161
+ 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
162
+ 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
163
+ 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
164
+ 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
165
+ 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
166
+ 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
167
+ 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
168
+ 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
169
+ 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
170
+ 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
171
+ 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
172
+ 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16);
173
+
174
+ // rCon is Round Constant used for the Key Expansion [1st col is 2^(r-1) in GF(2^8)] [�5.2]
175
+ private static $rCon = array(
176
+ array(0x00, 0x00, 0x00, 0x00),
177
+ array(0x01, 0x00, 0x00, 0x00),
178
+ array(0x02, 0x00, 0x00, 0x00),
179
+ array(0x04, 0x00, 0x00, 0x00),
180
+ array(0x08, 0x00, 0x00, 0x00),
181
+ array(0x10, 0x00, 0x00, 0x00),
182
+ array(0x20, 0x00, 0x00, 0x00),
183
+ array(0x40, 0x00, 0x00, 0x00),
184
+ array(0x80, 0x00, 0x00, 0x00),
185
+ array(0x1b, 0x00, 0x00, 0x00),
186
+ array(0x36, 0x00, 0x00, 0x00));
187
+
188
+ }
189
+
190
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
includes/classes/class-wcal-product-report-table.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if( session_id() === '' ){
4
+ //session has not started
5
+ session_start();
6
+ }
7
+ // Load WP_List_Table if not loaded
8
+ if ( ! class_exists( 'WP_List_Table' ) ) {
9
+ require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
10
+ }
11
+
12
+ class WCAL_Product_Report_Table extends WP_List_Table {
13
+
14
+ /**
15
+ * Number of results to show per page
16
+ *
17
+ * @var string
18
+ * @since 2.5.3
19
+ */
20
+ public $per_page = 30;
21
+
22
+ /**
23
+ * URL of this page
24
+ *
25
+ * @var string
26
+ * @since 2.5.3
27
+ */
28
+ public $base_url;
29
+
30
+ /**
31
+ * Total number of recovred orders
32
+ *
33
+ * @var int
34
+ * @since 2.5.3
35
+ */
36
+ public $total_count;
37
+
38
+
39
+ /**
40
+ * Total number of recovred orders
41
+ *
42
+ * @var int
43
+ * @since 2.5.3
44
+ */
45
+ public $open_emails;
46
+
47
+ /**
48
+ * Total amount of abandoned orders
49
+ *
50
+ * @var int
51
+ * @since 2.5.3
52
+ */
53
+ public $link_click_count;
54
+
55
+ /**
56
+ * Total number recovred orders
57
+ *
58
+ * @var int
59
+ * @since 2.5.3
60
+ */
61
+ public $start_date_db;
62
+
63
+ /**
64
+ * Total number recovred orders total
65
+ *
66
+ * @var int
67
+ * @since 2.5.3
68
+ */
69
+ public $end_date_db;
70
+
71
+ public $duration;
72
+
73
+ /**
74
+ * Get things started
75
+ *
76
+ * @see WP_List_Table::__construct()
77
+ */
78
+ public function __construct() {
79
+ global $status, $page;
80
+ // Set parent defaults
81
+ parent::__construct( array(
82
+ 'singular' => __( 'product_id', 'woocommerce-ac' ), //singular name of the listed records
83
+ 'plural' => __( 'product_ids', 'woocommerce-ac' ), //plural name of the listed records
84
+ 'ajax' => false // Does this table support ajax?
85
+ ) );
86
+ $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=stats' );
87
+ }
88
+
89
+ public function wcal_product_report_prepare_items() {
90
+ $columns = $this->get_columns();
91
+ $hidden = array(); // No hidden columns
92
+ $data = $this->wcal_product_report_data ();
93
+ $total_items = $this->total_count;
94
+ $this->items = $data;
95
+ $this->_column_headers = array( $columns, $hidden);
96
+ $this->set_pagination_args( array(
97
+ 'total_items' => $total_items, // WE have to calculate the total number of items
98
+ 'per_page' => $this->per_page, // WE have to determine how many items to show on a page
99
+ 'total_pages' => ceil( $total_items / $this->per_page ) // WE have to calculate the total number of pages
100
+ )
101
+ );
102
+ }
103
+
104
+ public function get_columns() {
105
+ $columns = array(
106
+ 'product_name' => __( 'Product Name', 'woocommerce-ac' ),
107
+ 'abandoned_number' => __( 'Number of Times Abandoned', 'woocommerce-ac' ),
108
+ 'recover_number' => __( 'Number of Times Recovered', 'woocommerce-ac' )
109
+ );
110
+ return apply_filters( 'wcal_product_report_columns', $columns );
111
+ }
112
+
113
+ /**
114
+ * Render the user name Column
115
+ *
116
+ * @access public
117
+ * @since 2.5.3
118
+ * @param array $abandoned_row_info Contains all the data of the template row
119
+ * @return string Data shown in the Email column
120
+ *
121
+ * This function used for individual delete of row, It is for hover effect delete.
122
+ */
123
+ public function wcal_product_report_data () {
124
+ global $wpdb;
125
+ $wcal_class = new woocommerce_abandon_cart_lite ();
126
+ $per_page = $this->per_page;
127
+ $i = 0;
128
+ $order = "desc";
129
+ $query = "SELECT abandoned_cart_time, abandoned_cart_info, recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` ORDER BY recovered_cart DESC";
130
+ $recover_query = $wpdb->get_results( $query );
131
+ $rec_carts_array = array ( );
132
+ $recover_product_array = array( );
133
+ $return_product_report = array();
134
+
135
+ foreach( $recover_query as $recovered_cart_key => $recovered_cart_value ) {
136
+ $recovered_cart_info = json_decode( $recovered_cart_value->abandoned_cart_info );
137
+ $recovered_cart_dat = json_decode( $recovered_cart_value->recovered_cart);
138
+ $order_date = "";
139
+ $cart_update_time = $recovered_cart_value->abandoned_cart_time;
140
+ $quantity_total = 0;
141
+ $cart_details = array();
142
+ if( isset( $recovered_cart_info->cart ) ){
143
+ $cart_details = $recovered_cart_info->cart;
144
+ }
145
+ if ( count( $cart_details ) > 0) {
146
+ foreach ( $cart_details as $k => $v ) {
147
+ $quantity_total = $quantity_total + $v->quantity;
148
+ }
149
+ }
150
+
151
+ if ( $cart_update_time != "" && $cart_update_time != 0 ) {
152
+ $order_date = date( 'd M, Y h:i A', $cart_update_time );
153
+ }
154
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
155
+ $cut_off_time = $ac_cutoff_time * 60 ;
156
+ $current_time = current_time( 'timestamp' );
157
+ $compare_time = $current_time - $cart_update_time;
158
+ if ( is_array( $recovered_cart_info ) || is_object( $recovered_cart_info ) ) {
159
+ foreach ( $recovered_cart_info as $rec_cart_key => $rec_cart_value ) {
160
+ foreach ( $rec_cart_value as $rec_product_id_key => $rec_product_id_value ) {
161
+ $product_id = $rec_product_id_value->product_id;
162
+ if ( $compare_time > $cut_off_time ) {
163
+ $rec_carts_array [] = $product_id;
164
+ }
165
+ if($recovered_cart_dat != 0) {
166
+ $recover_product_array[] = $product_id;
167
+ }
168
+ }
169
+ }
170
+ }
171
+ }
172
+
173
+ $count = array_count_values( $rec_carts_array );
174
+ $count1 = $count;
175
+ $count_new = $wcal_class->bubble_sort_function ( $count1 ,$order );
176
+ $recover_cart = "0";
177
+ $count_css = 0;
178
+ $chunck_array = array_chunk( $count_new,10, true ); // keep True for retaing the Array Index number which is product ids in our case.
179
+ $chunck_array_value = array();
180
+
181
+ foreach ( $chunck_array as $chunck_array_key => $chunck_array_value ) {
182
+ foreach ( $chunck_array_value as $k => $v ) {
183
+ $return_product_report[$i] = new stdClass();
184
+ $prod_name = get_post( $k );
185
+ $product_name = $prod_name->post_title;
186
+ $abandoned_count = $v;
187
+ $recover = array_count_values( $recover_product_array );
188
+ foreach ( $recover as $ke => $ve ) {
189
+ if( array_key_exists ( $ke, $count ) ) {
190
+ if ( $ke == $k ) {
191
+ $recover_cart = $ve;
192
+ }
193
+ }
194
+ if( ! array_key_exists ( $k, $recover ) ) {
195
+ $recover_cart = "0";
196
+ }
197
+ }
198
+
199
+ $return_product_report[ $i ]->product_name = $product_name ;
200
+ $return_product_report[ $i ]->abandoned_number = $abandoned_count;
201
+ $return_product_report[ $i ]->recover_number = $recover_cart;
202
+ $return_product_report[ $i ]->product_id = $k;
203
+ $i++;
204
+ }
205
+ }
206
+ $this->total_count = count ( $return_product_report ) > 0 ? count ( $return_product_report ) : 0 ;
207
+
208
+ // Pagination per page
209
+ if( isset( $_GET['paged'] ) && $_GET['paged'] > 1 ) {
210
+ $page_number = $_GET['paged'] - 1;
211
+ $k = $per_page * $page_number;
212
+ } else {
213
+ $k = 0;
214
+ }
215
+ $return_product_report_display = array();
216
+ for( $j = $k; $j < ( $k+$per_page ); $j++ ) {
217
+ if( isset( $return_product_report[$j] ) ) {
218
+ $return_product_report_display[$j] = $return_product_report[$j];
219
+ } else {
220
+ break;
221
+ }
222
+ }
223
+ return apply_filters( 'wcal_product_report_table_data', $return_product_report_display );
224
+ }
225
+
226
+ public function column_default( $wcal_sent_emails, $column_name ) {
227
+ $value = '';
228
+ switch ( $column_name ) {
229
+
230
+ case 'product_name' :
231
+ if( isset( $wcal_sent_emails->product_name ) ) {
232
+ $value = "<a href= post.php?post=$wcal_sent_emails->product_id&action=edit title = product name > $wcal_sent_emails->product_name </a>";
233
+ }
234
+ break;
235
+
236
+ case 'abandoned_number' :
237
+ if( isset( $wcal_sent_emails->abandoned_number ) ) {
238
+ $value = $wcal_sent_emails->abandoned_number;
239
+ }
240
+ break;
241
+
242
+ case 'recover_number' :
243
+ if( isset( $wcal_sent_emails->recover_number ) ) {
244
+ $value = $wcal_sent_emails->recover_number;
245
+ }
246
+ break;
247
+ default:
248
+
249
+ $value = isset( $wcal_sent_emails->$column_name ) ? $wcal_sent_emails->$column_name : '';
250
+ break;
251
+ }
252
+
253
+ return apply_filters( 'wcal_product_report_column_default', $value, $wcal_sent_emails, $column_name );
254
+ }
255
+ }
256
+ ?>
includes/classes/class-wcal-recover-orders-table.php ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Load WP_List_Table if not loaded
4
+ if ( ! class_exists( 'WP_List_Table' ) ) {
5
+ require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
6
+ }
7
+
8
+ class wcal_Recover_Orders_Table extends WP_List_Table {
9
+
10
+ /**
11
+ * Number of results to show per page
12
+ *
13
+ * @var string
14
+ * @since 2.5.2
15
+ */
16
+ public $per_page = 30;
17
+
18
+ /**
19
+ * URL of this page
20
+ *
21
+ * @var string
22
+ * @since 2.5.2
23
+ */
24
+ public $base_url;
25
+
26
+ /**
27
+ * Total number of recovered orders
28
+ *
29
+ * @var int
30
+ * @since 2.5.2
31
+ */
32
+ public $total_count;
33
+
34
+
35
+ /**
36
+ * Total number of abandoned orders
37
+ *
38
+ * @var int
39
+ * @since 2.5.2
40
+ */
41
+ public $total_abandoned_cart_count;
42
+
43
+ /**
44
+ * Total amount of abandoned orders
45
+ *
46
+ * @var int
47
+ * @since 2.5.2
48
+ */
49
+ public $total_order_amount;
50
+
51
+ /**
52
+ * Total number recovered orders
53
+ *
54
+ * @var int
55
+ * @since 2.5.2
56
+ */
57
+ public $recovered_item;
58
+
59
+ /**
60
+ * Total number recovred orders total
61
+ *
62
+ * @var int
63
+ * @since 2.5.2
64
+ */
65
+ public $total_recover_amount;
66
+
67
+ /**
68
+ * Get things started
69
+ *
70
+ * @see WP_List_Table::__construct()
71
+ */
72
+ public function __construct() {
73
+ global $status, $page;
74
+ // Set parent defaults
75
+ parent::__construct( array(
76
+ 'singular' => __( 'rec_abandoned_id', 'woocommerce-ac' ), //singular name of the listed records
77
+ 'plural' => __( 'rec_abandoned_ids', 'woocommerce-ac' ), //plural name of the listed records
78
+ 'ajax' => false // Does this table support ajax?
79
+ ) );
80
+ $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=stats' );
81
+ }
82
+
83
+ public function wcal_recovered_orders_prepare_items() {
84
+ $columns = $this->get_columns();
85
+ $hidden = array(); // No hidden columns
86
+ $sortable = $this->recovered_orders_get_sortable_columns();
87
+ $data = $this->wcal_recovered_orders_data();
88
+ $total_items = $this->total_count;
89
+ $total_abandoned_cart_count = $this->total_abandoned_cart_count;
90
+ $total_order_amount = $this->total_order_amount;
91
+ $total_recover_amount = $this->total_recover_amount;
92
+ $recovered_item = $this->recovered_item;
93
+ $this->items = $data;
94
+ $this->_column_headers = array( $columns, $hidden, $sortable);
95
+ $this->set_pagination_args( array(
96
+ 'total_items' => $total_items, // WE have to calculate the total number of items
97
+ 'per_page' => $this->per_page, // WE have to determine how many items to show on a page
98
+ 'total_pages' => ceil( $total_items / $this->per_page ) // WE have to calculate the total number of pages
99
+ )
100
+ );
101
+ }
102
+
103
+ public function get_columns() {
104
+ $columns = array(
105
+ 'user_name' => __( 'Customer Name', 'woocommerce-ac' ),
106
+ 'user_email_id' => __( 'Email Address', 'woocommerce-ac' ),
107
+ 'created_on' => __( 'Cart Abandoned Date', 'woocommerce-ac' ),
108
+ 'recovered_date' => __( 'Cart Recovered Date' , 'woocommerce-ac'),
109
+ 'order_total' => __( 'Order Total', 'woocommerce-ac' )
110
+ );
111
+ return apply_filters( 'wcal_recovered_orders_columns', $columns );
112
+ }
113
+
114
+ public function recovered_orders_get_sortable_columns() {
115
+ $columns = array(
116
+ 'created_on' => array( 'created_on', false ),
117
+ 'recovered_date' => array( 'recovered_date',false)
118
+ );
119
+ return apply_filters( 'wcal_templates_sortable_columns', $columns );
120
+ }
121
+
122
+ /**
123
+ * Render the user name Column
124
+ *
125
+ * @access public
126
+ * @since 2.5.2
127
+ * @param array $abandoned_row_info Contains all the data of the template row
128
+ * @return string Data shown in the Email column
129
+ *
130
+ * This function used for individual delete of row, It is for hover effect delete.
131
+ */
132
+ public function column_user_name( $recovered_orders_row_info ) {
133
+ $row_actions = array();
134
+ $value = '';
135
+ $recovered_id = 0;
136
+
137
+ if( isset( $recovered_orders_row_info->user_name ) ) {
138
+ $recovered_id = $recovered_orders_row_info->recovered_id ;
139
+ $row_actions['view_details'] = "<a target=_blank href = post.php?post=$recovered_id&action=edit>". __( 'View Details', 'woocommerce-ac' )."</a>";
140
+ $user_name = $recovered_orders_row_info->user_name;
141
+ $value = $user_name . $this->row_actions( $row_actions );
142
+ }
143
+ return apply_filters( 'wcal_recovered_orders_single_column', $value, $recovered_id, 'email' );
144
+ }
145
+
146
+ public function wcal_recovered_orders_data() {
147
+ global $wpdb;
148
+ $wcal_class = new woocommerce_abandon_cart_lite ();
149
+ $number_decimal = wc_get_price_decimals();
150
+
151
+ if ( isset( $_POST['duration_select'] ) ) {
152
+ $duration_range = $_POST['duration_select'];
153
+ }
154
+ else {
155
+ $duration_range = "";
156
+ }
157
+
158
+ if ( $duration_range == "" ) {
159
+ if ( isset( $_GET['duration_select'] ) ) {
160
+ $duration_range = $_GET['duration_select'];
161
+ }
162
+ }
163
+
164
+ if ( $duration_range == "" ) {
165
+ $duration_range = "last_seven";
166
+ }
167
+ else {
168
+ $duration_range = "";
169
+ }
170
+
171
+ if ( isset( $_POST['start_date'] ) ) {
172
+ $start_date_range = $_POST['start_date'];
173
+ }
174
+ else {
175
+ $start_date_range = "";
176
+ }
177
+
178
+ if ( $start_date_range == "" ) {
179
+ $start_date_range = $wcal_class->start_end_dates[$duration_range]['start_date'];
180
+ }
181
+
182
+ if ( isset( $_POST['end_date'] ) ) $end_date_range = $_POST['end_date'];
183
+ else $end_date_range = "";
184
+
185
+ if ( $end_date_range == "" ) {
186
+ $end_date_range = $wcal_class->start_end_dates[$duration_range]['end_date'];
187
+ }
188
+
189
+ $start_date = strtotime( $start_date_range." 00:01:01" );
190
+ $end_date = strtotime( $end_date_range." 23:59:59" );
191
+
192
+ $ac_cutoff_time = get_option( 'ac_lite_cart_abandoned_time' );
193
+ $cut_off_time = $ac_cutoff_time * 60;
194
+ $current_time = current_time( 'timestamp' );
195
+ $compare_time = $current_time - $cut_off_time;
196
+
197
+ $query_ac = "SELECT * FROM " . $wpdb->prefix . "ac_abandoned_cart_history_lite
198
+ WHERE abandoned_cart_time >= %d AND abandoned_cart_time <= %d AND recovered_cart > 0 AND abandoned_cart_time <= '$compare_time' ORDER BY recovered_cart desc";
199
+ $ac_results = $wpdb->get_results( $wpdb->prepare( $query_ac, $start_date, $end_date ) );
200
+
201
+ $query_ac_carts = "SELECT * FROM " . $wpdb->prefix . "ac_abandoned_cart_history_lite
202
+ WHERE abandoned_cart_time >= %d AND abandoned_cart_time <= %d AND abandoned_cart_time <= '$compare_time' ";
203
+ $ac_carts_results = $wpdb->get_results( $wpdb->prepare( $query_ac_carts, $start_date, $end_date ) );
204
+
205
+ $recovered_item = $recovered_total = $count_carts = $total_value = $order_total = 0;
206
+ $return_recovered_orders = array();
207
+ $per_page = $this->per_page;
208
+ $i = 0;
209
+
210
+ foreach ( $ac_carts_results as $key => $value ) {
211
+ $count_carts += 1;
212
+ $cart_detail = json_decode( $value->abandoned_cart_info );
213
+ $product_details = array();
214
+ if( isset( $cart_detail->cart ) ) {
215
+ $product_details = $cart_detail->cart;
216
+ }
217
+ $line_total = 0;
218
+
219
+ if ( isset( $product_details ) && count( $product_details ) > 0 && $product_details != false ) {
220
+ foreach ( $product_details as $k => $v ) {
221
+ if( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
222
+ $line_total = $line_total + $v->line_total + $v->line_subtotal_tax;
223
+ } else {
224
+ $line_total = $line_total + $v->line_total;
225
+ }
226
+ }
227
+ }
228
+ $total_value += $line_total;
229
+ }
230
+ $total_value = wc_price( $total_value );
231
+ $this->total_order_amount = $total_value ;
232
+ $this->total_abandoned_cart_count = $count_carts ;
233
+ $recovered_order_total = 0;
234
+ $this->total_recover_amount = round( $recovered_order_total, $number_decimal ) ;
235
+ $this->recovered_item = 0;
236
+ $table_data = "";
237
+
238
+ foreach ( $ac_results as $key => $value ) {
239
+ if( $value->recovered_cart != 0 ) {
240
+ $return_recovered_orders[$i] = new stdClass();
241
+
242
+ $recovered_id = $value->recovered_cart;
243
+ $rec_order = get_post_meta( $recovered_id );
244
+ $woo_order = new WC_Order( $recovered_id );
245
+ $recovered_date = strtotime( $woo_order->order_date );
246
+ $recovered_date_new = date( 'd M, Y h:i A', $recovered_date );
247
+ $recovered_item += 1;
248
+
249
+ if ( isset( $rec_order ) && $rec_order != false ) {
250
+ $recovered_total += $rec_order['_order_total'][0];
251
+ }
252
+ $abandoned_date = date( 'd M, Y h:i A', $value->abandoned_cart_time );
253
+ $abandoned_order_id = $value->id;
254
+ $billing_first_name = $billing_last_name = $billing_email = '';
255
+ $recovered_order_total = 0;
256
+
257
+ if ( isset( $rec_order['_billing_first_name'][0] ) ) {
258
+ $billing_first_name = $rec_order['_billing_first_name'][0];
259
+ }
260
+
261
+ if ( isset( $rec_order['_billing_last_name'][0] ) ) {
262
+ $billing_last_name = $rec_order['_billing_last_name'][0];
263
+ }
264
+
265
+ if ( isset( $rec_order['_billing_email'][0] ) ) {
266
+ $billing_email = $rec_order['_billing_email'][0];
267
+ }
268
+
269
+ if ( isset( $rec_order['_order_total'][0] ) ) {
270
+ $recovered_order_total = $rec_order['_order_total'][0];
271
+ }
272
+
273
+ $return_recovered_orders[ $i ]->user_name = $billing_first_name . " " . $billing_last_name ;
274
+ $return_recovered_orders[ $i ]->user_email_id = $billing_email;
275
+ $return_recovered_orders[ $i ]->created_on = $abandoned_date;
276
+ $return_recovered_orders[ $i ]->recovered_date = $recovered_date_new;
277
+ $return_recovered_orders[ $i ]->recovered_id = $recovered_id;
278
+ $return_recovered_orders[ $i ]->recover_order_date = $recovered_date;
279
+ $return_recovered_orders[ $i ]->abandoned_date = $value->abandoned_cart_time;
280
+ $return_recovered_orders[ $i ]->order_total = wc_price($recovered_order_total);
281
+
282
+ $this->recovered_item = $recovered_item;
283
+ $this->total_recover_amount = round( ( $recovered_order_total + $this->total_recover_amount ) , $number_decimal );
284
+ $i++;
285
+ }
286
+ }
287
+ $templates_count = count( $return_recovered_orders );
288
+ $this->total_count = $templates_count;
289
+ // sort for order date
290
+ if( isset( $_GET['orderby'] ) && $_GET['orderby'] == 'created_on' ) {
291
+ if( isset( $_GET['order'] ) && $_GET['order'] == 'asc' ) {
292
+ usort( $return_recovered_orders, array( __CLASS__ , "wcal_class_recovered_created_on_asc" ) );
293
+ } else {
294
+ usort( $return_recovered_orders, array( __CLASS__ , "wcal_class_recovered_created_on_dsc" ) );
295
+ }
296
+ }
297
+ // sort for customer name
298
+ else if ( isset( $_GET['orderby']) && $_GET['orderby'] == 'recovered_date' ) {
299
+ if( isset( $_GET['order'] ) && $_GET['order'] == 'asc' ) {
300
+ usort( $return_recovered_orders, array( __CLASS__ , "wcal_class_recovered_date_asc" ) );
301
+ }else {
302
+ usort( $return_recovered_orders, array( __CLASS__ , "wcal_class_recovered_date_dsc" ) );
303
+ }
304
+ }
305
+ // Pagination per page
306
+ if( isset( $_GET['paged'] ) && $_GET['paged'] > 1 ) {
307
+ $page_number = $_GET['paged'] - 1;
308
+ $k = $per_page * $page_number;
309
+ } else {
310
+ $k = 0;
311
+ }
312
+ $return_recovered_orders_display = array();
313
+ for( $j = $k; $j < ( $k+$per_page ); $j++ ) {
314
+ if( isset( $return_recovered_orders[$j] ) ) {
315
+ $return_recovered_orders_display[$j] = $return_recovered_orders[$j];
316
+ } else {
317
+ break;
318
+ }
319
+ }
320
+ return apply_filters( 'wcal_recovered_orders_table_data', $return_recovered_orders_display );
321
+ }
322
+
323
+ function wcal_class_recovered_created_on_asc( $value1,$value2 ) {
324
+ return $value1->abandoned_date - $value2->abandoned_date;
325
+ }
326
+
327
+ function wcal_class_recovered_created_on_dsc( $value1,$value2 ) {
328
+ return $value2->abandoned_date - $value1->abandoned_date;
329
+ }
330
+
331
+ function wcal_class_recovered_date_asc( $value1,$value2 ) {
332
+ return $value1->recover_order_date - $value2->recover_order_date;
333
+ }
334
+
335
+ function wcal_class_recovered_date_dsc( $value1,$value2 ) {
336
+ return $value2->recover_order_date - $value1->recover_order_date;
337
+ }
338
+
339
+ public function column_default( $wcal_abandoned_orders, $column_name ) {
340
+ $value = '';
341
+ switch ( $column_name ) {
342
+ case 'user_email_id' :
343
+ if( isset( $wcal_abandoned_orders->user_email_id ) ) {
344
+
345
+ $user_email_id = "<a href= mailto:$wcal_abandoned_orders->user_email_id>". $wcal_abandoned_orders->user_email_id."</a>" ;
346
+ $value = $user_email_id;
347
+ }
348
+ break;
349
+ case 'created_on' :
350
+ if( isset( $wcal_abandoned_orders->created_on ) ) {
351
+ $value = $wcal_abandoned_orders->created_on;
352
+ }
353
+ break;
354
+ case 'recovered_date' :
355
+ if( isset( $wcal_abandoned_orders->recovered_date ) ) {
356
+ $value = $wcal_abandoned_orders->recovered_date;
357
+ }
358
+ break;
359
+ case 'order_total' :
360
+ if( isset( $wcal_abandoned_orders->order_total ) ) {
361
+ $value = $wcal_abandoned_orders->order_total;
362
+ }
363
+ break;
364
+ default:
365
+ $value = isset( $wcal_abandoned_orders->$column_name ) ? $wcal_abandoned_orders->$column_name : '';
366
+ break;
367
+ }
368
+ return apply_filters( 'wcal_recovered_orders_column_default', $value, $wcal_abandoned_orders, $column_name );
369
+ }
370
+ }
371
+ ?>
includes/classes/class-wcal-templates-table.php ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Load WP_List_Table if not loaded
4
+ if ( ! class_exists( 'WP_List_Table' ) ) {
5
+ require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
6
+ }
7
+
8
+ class WCAL_Templates_Table extends WP_List_Table {
9
+
10
+ /**
11
+ * Number of results to show per page
12
+ *
13
+ * @var string
14
+ * @since 2.5.2
15
+ */
16
+ public $per_page = 30;
17
+
18
+ /**
19
+ * URL of this page
20
+ *
21
+ * @var string
22
+ * @since 2.5.2
23
+ */
24
+ public $base_url;
25
+
26
+ /**
27
+ * Total number of email templates
28
+ *
29
+ * @var int
30
+ * @since 2.5.3
31
+ */
32
+ public $total_count;
33
+
34
+ /**
35
+ * Get things started
36
+ *
37
+ * @see WP_List_Table::__construct()
38
+ */
39
+ public function __construct() {
40
+ global $status, $page;
41
+ // Set parent defaults
42
+ parent::__construct( array(
43
+ 'singular' => __( 'template_id', 'woocommerce-ac' ), //singular name of the listed records
44
+ 'plural' => __( 'template_ids', 'woocommerce-ac' ), //plural name of the listed records
45
+ 'ajax' => false // Does this table support ajax?
46
+ ) );
47
+ $this->process_bulk_action();
48
+ $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=emailtemplates' );
49
+ }
50
+
51
+ public function wcal_templates_prepare_items() {
52
+ $columns = $this->get_columns();
53
+ $hidden = array(); // No hidden columns
54
+ $sortable = $this->templates_get_sortable_columns();
55
+ $data = $this->wcal_templates_data();
56
+
57
+ $this->_column_headers = array( $columns, $hidden, $sortable );
58
+ $total_items = $this->total_count;
59
+ $this->items = $data;
60
+
61
+ $this->set_pagination_args( array(
62
+ 'total_items' => $total_items, // WE have to calculate the total number of items
63
+ 'per_page' => $this->per_page, // WE have to determine how many items to show on a page
64
+ 'total_pages' => ceil( $total_items / $this->per_page ) // WE have to calculate the total number of pages
65
+ )
66
+ );
67
+ }
68
+
69
+ public function get_columns() {
70
+ $columns = array(
71
+ 'cb' => '<input type="checkbox" />',
72
+ 'sr' => __( 'Sr', 'woocommerce-ac' ),
73
+ 'template_name' => __( 'Name Of Template', 'woocommerce-ac' ),
74
+ 'sent_time' => __( 'Sent After Set Time', 'woocommerce-ac' ),
75
+ 'activate' => __( 'Active ?', 'woocommerce-ac' )
76
+ );
77
+ return apply_filters( 'wcal_templates_columns', $columns );
78
+ }
79
+ /***
80
+ * It is used to add the check box for the items
81
+ */
82
+ function column_cb( $item ) {
83
+ $template_id = '';
84
+ if( isset( $item->id ) && "" != $item->id ) {
85
+ $template_id = $item->id;
86
+ }
87
+ return sprintf(
88
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
89
+ 'template_id',
90
+ $template_id
91
+ );
92
+ }
93
+
94
+ public function templates_get_sortable_columns() {
95
+ $columns = array(
96
+ 'template_name' => array( 'template_name', false ),
97
+ 'sent_time' => array( 'sent_time',false),
98
+ );
99
+ return apply_filters( 'wcal_templates_sortable_columns', $columns );
100
+ }
101
+
102
+ /**
103
+ * Render the Email Column
104
+ *
105
+ * @access public
106
+ * @since 2.5.2
107
+ * @param array $abandoned_row_info Contains all the data of the template row
108
+ * @return string Data shown in the Email column
109
+ *
110
+ * This function used for individual delete of row, It is for hover effect delete.
111
+ */
112
+ public function column_template_name( $template_row_info ) {
113
+ $row_actions = array();
114
+ $value = '';
115
+ $template_id = 0;
116
+ if( isset( $template_row_info->template_name ) ) {
117
+ $template_id = $template_row_info->id ;
118
+
119
+ $row_actions['edit'] = '<a href="' . wp_nonce_url( add_query_arg( array( 'action' => 'emailtemplates', 'mode'=>'edittemplate', 'id' => $template_row_info->id ), $this->base_url ), 'abandoned_order_nonce') . '">' . __( 'Edit', 'woocommerce-ac' ) . '</a>';
120
+ $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( 'action' => 'wcal_delete_template', 'template_id' => $template_row_info->id ), $this->base_url ), 'abandoned_order_nonce') . '">' . __( 'Delete', 'woocommerce-ac' ) . '</a>';
121
+
122
+ $email = $template_row_info->template_name;
123
+ $value = $email . $this->row_actions( $row_actions );
124
+ }
125
+ return apply_filters( 'wcal_template_single_column', $value, $template_id, 'email' );
126
+ }
127
+
128
+ public function wcal_templates_data() {
129
+ global $wpdb;
130
+ $return_templates_data = array();
131
+ $per_page = $this->per_page;
132
+ $results = array();
133
+ $query = "SELECT wpet . * FROM `" . $wpdb->prefix . "ac_email_templates_lite` AS wpet ORDER BY day_or_hour desc , frequency asc";
134
+ $results = $wpdb->get_results( $query );
135
+ $i = 0;
136
+
137
+ foreach ( $results as $key => $value ) {
138
+ $return_templates_data[$i] = new stdClass();
139
+ $id = $value->id;
140
+ $query_no_emails = "SELECT * FROM " . $wpdb->prefix . "ac_sent_history_lite WHERE template_id= %d";
141
+ $from = $value->from_email;
142
+ $subject = $value->subject;
143
+ $body = $value->body;
144
+ $is_active = $value->is_active;
145
+
146
+ if ( $is_active == '1' ) {
147
+ $active = "Deactivate";
148
+ } else {
149
+ $active = "Activate";
150
+ }
151
+ $frequency = $value->frequency;
152
+ $day_or_hour = $value->day_or_hour;
153
+ $return_templates_data[ $i ]->sr = $i+1;
154
+ $return_templates_data[ $i ]->id = $id;
155
+ $return_templates_data[ $i ]->template_name = $value->template_name;
156
+ $return_templates_data[ $i ]->sent_time = __( $frequency . " " . $day_or_hour . " After Abandonment", 'woocommerce-ac' );
157
+ $return_templates_data[ $i ]->activate = $active;
158
+ $return_templates_data[ $i ]->is_active = $is_active;
159
+ $i++;
160
+ }
161
+ $templates_count = count( $return_templates_data );
162
+ $this->total_count = $templates_count;
163
+ // sort for order date
164
+ if( isset( $_GET['orderby'] ) && $_GET['orderby'] == 'template_name' ) {
165
+ if( isset($_GET['order'] ) && $_GET['order'] == 'asc' ) {
166
+ usort( $return_templates_data, array( __CLASS__ , "wcal_class_template_name_asc" ) );
167
+ } else {
168
+ usort( $return_templates_data, array( __CLASS__ , "wcal_class_template_name_dsc") );
169
+ }
170
+ }
171
+ // sort for customer name
172
+ else if ( isset( $_GET['orderby']) && $_GET['orderby'] == 'sent_time' ) {
173
+ if ( isset( $_GET['order'] ) && $_GET['order'] == 'asc' ) {
174
+ usort( $return_templates_data, array( __CLASS__ , "wcal_class_sent_time_asc" ) );
175
+ } else {
176
+ usort( $return_templates_data, array( __CLASS__ , "wcal_class_sent_time_dsc" ) );
177
+ }
178
+ }
179
+ // Pagination per page
180
+ if( isset( $_GET['paged'] ) && $_GET['paged'] > 1 ) {
181
+ $page_number = $_GET['paged'] - 1;
182
+ $k = $per_page * $page_number;
183
+ } else {
184
+ $k = 0;
185
+ }
186
+ $return_templates_data_display = array();
187
+ for( $j = $k; $j < ( $k+$per_page ); $j++ ) {
188
+ if( isset( $return_templates_data[$j] ) ) {
189
+ $return_templates_data_display[$j] = $return_templates_data[$j];
190
+ } else {
191
+ break;
192
+ }
193
+ }
194
+
195
+ return apply_filters( 'wcal_templates_table_data', $return_templates_data_display );
196
+ }
197
+
198
+ function wcal_class_template_name_asc( $value1,$value2 ) {
199
+ return strcasecmp( $value1->template_name,$value2->template_name );
200
+ }
201
+
202
+ function wcal_class_template_name_dsc( $value1,$value2 ) {
203
+ return strcasecmp( $value2->template_name,$value1->template_name );
204
+ }
205
+
206
+ function wcal_class_sent_time_asc( $value1,$value2 ) {
207
+ return strnatcasecmp( $value1->sent_time,$value2->sent_time );
208
+ }
209
+
210
+ function wcal_class_sent_time_dsc( $value1,$value2 ) {
211
+ return strnatcasecmp( $value2->sent_time,$value1->sent_time );
212
+ }
213
+
214
+ public function column_default( $wcal_abandoned_orders, $column_name ) {
215
+ $value = '';
216
+ switch ( $column_name ) {
217
+ case 'sr' :
218
+ if( isset( $wcal_abandoned_orders->sr ) ) {
219
+ $value = $wcal_abandoned_orders->sr;
220
+ }
221
+ break;
222
+ case 'template_name' :
223
+ if( isset( $wcal_abandoned_orders->template_name ) ) {
224
+ $value = $wcal_abandoned_orders->template_name;
225
+ }
226
+ break;
227
+ case 'sent_time' :
228
+ if( isset( $wcal_abandoned_orders->sent_time ) ) {
229
+ $value = $wcal_abandoned_orders->sent_time;
230
+ }
231
+ break;
232
+ case 'activate' :
233
+ if( isset( $wcal_abandoned_orders->activate ) ) {
234
+ $active = $wcal_abandoned_orders->activate;
235
+ $id = $wcal_abandoned_orders->id;
236
+ $is_active = $wcal_abandoned_orders->is_active;
237
+ $active = '';
238
+ if ( $is_active == '1' ) {
239
+ $active = "Deactivate";
240
+ } else {
241
+ $active = "Activate";
242
+ }
243
+ $active_text = __( $active, 'woocommerce-ac' );
244
+ $value = '<a href="#" onclick="wcal_activate_email_template('. $id.', '.$is_active.' )"> '.$active_text.'</a>';
245
+ }
246
+ break;
247
+ default:
248
+ $value = isset( $wcal_abandoned_orders->$column_name ) ? $wcal_abandoned_orders->$column_name : '';
249
+ break;
250
+ }
251
+ return apply_filters( 'wcal_template_column_default', $value, $wcal_abandoned_orders, $column_name );
252
+ }
253
+
254
+ public function get_bulk_actions() {
255
+ return array(
256
+ 'wcal_delete_template' => __( 'Delete', 'woocommerce-ac' )
257
+ );
258
+ }
259
+ }
260
+ ?>
actions.php → includes/wcal_actions.php RENAMED
@@ -1,46 +1,46 @@
1
- <?php
2
-
3
- // Exit if accessed directly
4
- if ( ! defined( 'ABSPATH' ) ) exit;
5
-
6
- /**
7
- * Trigger a abadoned cart Deletion
8
- *
9
- * @since 2.5.2
10
- * @param $abadoned_cart_id Arguments passed
11
- * @return void
12
- */
13
-
14
- class wcap_delete_bulk_action_handler{
15
-
16
- function wcap_delete_bulk_action_handler_function_lite( $abadoned_cart_id ) {
17
- global $wpdb;
18
-
19
- $get_user_id = "SELECT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE id = '$abadoned_cart_id' ";
20
- $results_get_user_id = $wpdb->get_results( $get_user_id );
21
- $user_id_of_guest = $results_get_user_id[0]->user_id;
22
-
23
- $query_delete = "DELETE FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE id = '$abadoned_cart_id' ";
24
- $results_delete = $wpdb->get_results( $query_delete );
25
-
26
-
27
- if ( $user_id_of_guest >= '63000000' ) {
28
- $guest_query_delete = "DELETE FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE id = '" . $user_id_of_guest . "'";
29
- $results_guest = $wpdb->get_results( $guest_query_delete );
30
- //guest user
31
- }
32
-
33
- wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&wcap_deleted=YES' ) );
34
-
35
- }
36
- function wcap_delete_template_bulk_action_handler_function_lite( $template_id ) {
37
- global $wpdb;
38
-
39
- $id_remove = $template_id;
40
- $query_remove = "DELETE FROM `" . $wpdb->prefix . "ac_email_templates_lite` WHERE id='" . $id_remove . "' ";
41
- $wpdb->query( $query_remove );
42
-
43
- wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&action=emailtemplates&wcap_template_deleted=YES' ) );
44
-
45
- }
46
  }
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ /**
8
+ * Trigger a abandoned cart Deletion
9
+ *
10
+ * @since 2.5.2
11
+ * @param $abandoned_cart_id Arguments passed
12
+ * @return void
13
+ */
14
+
15
+ class wcal_delete_bulk_action_handler {
16
+
17
+ function wcal_delete_bulk_action_handler_function( $abandoned_cart_id ) {
18
+ global $wpdb;
19
+ $get_user_id = "SELECT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
20
+ WHERE id = '$abandoned_cart_id' ";
21
+ $results_get_user_id = $wpdb->get_results( $get_user_id );
22
+ $user_id_of_guest = $results_get_user_id[0]->user_id;
23
+
24
+ $query_delete = "DELETE FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
25
+ WHERE id = '$abandoned_cart_id' ";
26
+ $results_delete = $wpdb->get_results( $query_delete );
27
+
28
+ if ( $user_id_of_guest >= '63000000' ) {
29
+ $guest_query_delete = "DELETE FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
30
+ WHERE id = '" . $user_id_of_guest . "'";
31
+ $results_guest = $wpdb->get_results( $guest_query_delete );
32
+ //guest user
33
+ }
34
+ wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&wcal_deleted=YES' ) );
35
+ }
36
+ function wcal_delete_template_bulk_action_handler_function( $template_id ) {
37
+ global $wpdb;
38
+ $id_remove = $template_id;
39
+ $query_remove = "DELETE FROM `" . $wpdb->prefix . "ac_email_templates_lite`
40
+ WHERE id='" . $id_remove . "' ";
41
+ $wpdb->query( $query_remove );
42
+
43
+ wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&action=emailtemplates&wcal_template_deleted=YES' ) );
44
+
45
+ }
46
  }
includes/wcal_class-guest.php ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Woocommerce Abandoned Cart Lite Plugin - Saves guest cart information
4
+ */
5
+ if ( ! class_exists( 'woocommerce_guest_ac' ) ) {
6
+
7
+ class woocommerce_guest_ac {
8
+ var $a;
9
+ public function __construct() {
10
+ add_action( 'woocommerce_after_checkout_billing_form', 'user_side_js' );
11
+ add_action( 'init','load_ac_ajax' );
12
+ add_filter( 'woocommerce_checkout_fields', 'guest_checkout_fields' );
13
+ }
14
+ }
15
+ /*-----------------------------------------------------------------------------------*/
16
+ /* Class Functions */
17
+ /*-----------------------------------------------------------------------------------*/
18
+ function load_ac_ajax() {
19
+ if ( ! is_user_logged_in() ) {
20
+ add_action( 'wp_ajax_nopriv_save_data', 'save_data' );
21
+ } else {
22
+ add_action( 'wp_ajax_save_data', 'save_data' );
23
+ }
24
+ }
25
+
26
+ function user_side_js() {
27
+ ?>
28
+ <script type="text/javascript">
29
+ jQuery( 'input#billing_email' ).on( 'change', function() {
30
+ var data = {
31
+ billing_first_name : jQuery('#billing_first_name').val(),
32
+ billing_last_name : jQuery('#billing_last_name').val(),
33
+ billing_company : jQuery('#billing_company').val(),
34
+ billing_address_1 : jQuery('#billing_address_1').val(),
35
+ billing_address_2 : jQuery('#billing_address_2').val(),
36
+ billing_city : jQuery('#billing_city').val(),
37
+ billing_state : jQuery('#billing_state').val(),
38
+ billing_postcode : jQuery('#billing_postcode').val(),
39
+ billing_country : jQuery('#billing_country').val(),
40
+ billing_phone : jQuery('#billing_phone').val(),
41
+ billing_email : jQuery('#billing_email').val(),
42
+ order_notes : jQuery('#order_comments').val(),
43
+ shipping_first_name : jQuery('#shipping_first_name').val(),
44
+ shipping_last_name : jQuery('#shipping_last_name').val(),
45
+ shipping_company : jQuery('#shipping_company').val(),
46
+ shipping_address_1 : jQuery('#shipping_address_1').val(),
47
+ shipping_address_2 : jQuery('#shipping_address_2').val(),
48
+ shipping_city : jQuery('#shipping_city').val(),
49
+ shipping_state : jQuery('#shipping_state').val(),
50
+ shipping_postcode : jQuery('#shipping_postcode').val(),
51
+ shipping_country : jQuery('#shipping_country').val(),
52
+ ship_to_billing : jQuery('#shiptobilling-checkbox').val(),
53
+ action: 'save_data'
54
+ };
55
+ jQuery.post( "<?php echo get_admin_url();?>admin-ajax.php", data, function(response) {
56
+ });
57
+ });
58
+ </script>
59
+ <?php
60
+ }
61
+
62
+ function save_data() {
63
+ if ( ! is_user_logged_in() ) {
64
+ if( session_id() === '' ) {
65
+ //session has not started
66
+ session_start();
67
+ }
68
+ global $wpdb, $woocommerce;
69
+ if ( isset($_POST['billing_first_name']) && $_POST['billing_first_name'] != '' ){
70
+ $_SESSION['billing_first_name'] = $_POST['billing_first_name'];
71
+ }
72
+ if ( isset($_POST['billing_last_name']) && $_POST['billing_last_name'] != '' ) {
73
+ $_SESSION['billing_last_name'] = $_POST['billing_last_name'];
74
+ }
75
+ if ( isset($_POST['billing_company']) && $_POST['billing_company'] != '' ) {
76
+ $_SESSION['billing_company'] = $_POST['billing_company'];
77
+ }
78
+ if ( isset($_POST['billing_address_1']) && $_POST['billing_address_1'] != '' ) {
79
+ $_SESSION['billing_address_1'] = $_POST['billing_address_1'];
80
+ }
81
+ if ( isset($_POST['billing_address_2']) && $_POST['billing_address_2'] != '' ) {
82
+ $_SESSION['billing_address_2'] = $_POST['billing_address_2'];
83
+ }
84
+ if ( isset($_POST['billing_city']) && $_POST['billing_city'] != '' ) {
85
+ $_SESSION['billing_city'] = $_POST['billing_city'];
86
+ }
87
+ if ( isset($_POST['billing_state']) && $_POST['billing_state'] != '' ) {
88
+ $_SESSION['billing_state'] = $_POST['billing_state'];
89
+ }
90
+ if ( isset($_POST['billing_postcode']) && $_POST['billing_postcode'] != '' ) {
91
+ $_SESSION['billing_postcode'] = $_POST['billing_postcode'];
92
+ }
93
+ if ( isset($_POST['billing_country']) && $_POST['billing_country'] != '' ) {
94
+ $_SESSION['billing_country'] = $_POST['billing_country'];
95
+ }
96
+ if ( isset($_POST['billing_email']) && $_POST['billing_email'] != '' ) {
97
+ $_SESSION['billing_email'] = $_POST['billing_email'];
98
+ }
99
+ if ( isset($_POST['billing_phone']) && $_POST['billing_phone'] != '' ) {
100
+ $_SESSION['billing_phone'] = $_POST['billing_phone'];
101
+ }
102
+ if ( isset($_POST['order_notes']) && $_POST['order_notes'] != '' ) {
103
+ $_SESSION['order_notes'] = $_POST['order_notes'];
104
+ }
105
+ if( isset( $_POST['ship_to_billing'] ) && $_POST['ship_to_billing'] != '' ) {
106
+ $_SESSION['ship_to_billing'] = $_POST['ship_to_billing'];
107
+ }
108
+ if ( isset($_POST['shipping_first_name']) && $_POST['shipping_first_name'] != '' ) {
109
+ $_SESSION['shipping_first_name'] = $_POST['shipping_first_name'];
110
+ }
111
+ if ( isset($_POST['shipping_last_name']) && $_POST['shipping_last_name'] != '' ) {
112
+ $_SESSION['shipping_last_name'] = $_POST['shipping_last_name'];
113
+ }
114
+ if ( isset($_POST['shipping_company']) && $_POST['shipping_company'] != '' ) {
115
+ $_SESSION['shipping_company'] = $_POST['shipping_company'];
116
+ }
117
+ if ( isset($_POST['shipping_address_1']) && $_POST['shipping_address_1'] != '' ) {
118
+ $_SESSION['shipping_address_1'] = $_POST['shipping_address_1'];
119
+ }
120
+ if ( isset($_POST['shipping_address_2']) && $_POST['shipping_address_2'] != '' ) {
121
+ $_SESSION['shipping_address_2'] = $_POST['shipping_address_2'];
122
+ }
123
+ if ( isset($_POST['shipping_city']) && $_POST['shipping_city'] != '' ) {
124
+ $_SESSION['shipping_city'] = $_POST['shipping_city'];
125
+ }
126
+ if ( isset($_POST['shipping_state']) && $_POST['shipping_state'] != '' ) {
127
+ $_SESSION['shipping_state'] = $_POST['shipping_state'];
128
+ }
129
+ if ( isset($_POST['shipping_postcode']) && $_POST['shipping_postcode'] != '' ) {
130
+ $_SESSION['shipping_postcode'] = $_POST['shipping_postcode'];
131
+ }
132
+ if ( isset($_POST['shipping_country']) && $_POST['shipping_country'] != '' ) {
133
+ $_SESSION['shipping_country'] = $_POST['shipping_country'];
134
+ }
135
+ // If a record is present in the guest cart history table for the same email id, then delete the previous records
136
+ $query_guest = "SELECT id FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite`
137
+ WHERE email_id = %s";
138
+ $results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $_SESSION['billing_email'] ) );
139
+
140
+ if ( $results_guest ) {
141
+ foreach ( $results_guest as $key => $value ) {
142
+ $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
143
+ WHERE user_id = %d AND recovered_cart = '0'" ;
144
+ $result = $wpdb->get_results( $wpdb->prepare( $query, $value->id ) );
145
+
146
+ if ( $result ) {
147
+ $delete_sent_email = "DELETE FROM `".$wpdb->prefix."ac_sent_history_lite`
148
+ WHERE abandoned_order_id = '".$result[0]->id."'";
149
+ $wpdb->query( $delete_sent_email );
150
+ $delete_query = "DELETE FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
151
+ WHERE user_id = '".$value->id."'";
152
+ $wpdb->query( $delete_query );
153
+ }
154
+ $guest_delete = "DELETE FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite`
155
+ WHERE id = '".$value->id."'";
156
+ $wpdb->query( $guest_delete );
157
+ }
158
+ }
159
+ // Insert record in guest table
160
+ if ( isset( $_SESSION['billing_first_name'] ) ) {
161
+ $billing_first_name = $_SESSION['billing_first_name'];
162
+ } else {
163
+ $billing_first_name = '';
164
+ }
165
+ if ( isset( $_SESSION['billing_last_name'] ) ) {
166
+ $billing_last_name = $_SESSION['billing_last_name'];
167
+ } else {
168
+ $billing_last_name = '';
169
+ }
170
+ $shipping_zipcode = $billing_zipcode = '';
171
+
172
+ if ( isset( $_SESSION['shipping_postcode'] ) && $_SESSION['shipping_postcode'] != "" ) {
173
+ $shipping_zipcode = $_SESSION['shipping_postcode'];
174
+ } elseif( isset( $_SESSION['billing_postcode'] ) && $_SESSION['billing_postcode'] != "" ) {
175
+ $shipping_zipcode = $billing_zipcode = $_SESSION['billing_postcode'];
176
+ }
177
+ $shipping_charges = $woocommerce->cart->shipping_total;
178
+ $insert_guest = "INSERT INTO `".$wpdb->prefix . "ac_guest_abandoned_cart_history_lite`( billing_first_name, billing_last_name, email_id, billing_zipcode, shipping_zipcode, shipping_charges )
179
+ VALUES ( '".$billing_first_name."', '".$billing_last_name."', '".$_SESSION['billing_email']."', '".$billing_zipcode."', '".$shipping_zipcode."', '".$shipping_charges."' )";
180
+ $wpdb->query( $insert_guest );
181
+
182
+ //Insert record in abandoned cart table for the guest user
183
+ $user_id = $wpdb->insert_id;
184
+ $_SESSION['user_id'] = $user_id;
185
+ $current_time = current_time( 'timestamp' );
186
+ $cut_off_time = get_option( 'ac_cart_abandoned_time' );
187
+ $cart_cut_off_time = $cut_off_time * 60;
188
+ $compare_time = $current_time - $cart_cut_off_time;
189
+
190
+ $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
191
+ WHERE user_id = %d AND cart_ignored = '0' AND recovered_cart = '0' AND user_type = 'GUEST'";
192
+ $results = $wpdb->get_results( $wpdb->prepare( $query, $user_id ) );
193
+
194
+ $cart = array();
195
+
196
+ if ( function_exists('WC') ) {
197
+ $cart['cart'] = WC()->session->cart;
198
+ } else {
199
+ $cart['cart'] = $woocommerce->session->cart;
200
+ }
201
+
202
+ if ( count( $results ) == 0 ) {
203
+ $cart_info = addslashes( json_encode( $cart ) );
204
+ $insert_query = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`( user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, recovered_cart, user_type )
205
+ VALUES ( '".$user_id."', '".$cart_info."', '".$current_time."', '0', '0', 'GUEST' )";
206
+ $wpdb->query( $insert_query );
207
+
208
+ $abandoned_cart_id = $wpdb->insert_id;
209
+ $_SESSION['abandoned_cart_id_lite'] = $abandoned_cart_id;
210
+
211
+ $insert_persistent_cart = "INSERT INTO `".$wpdb->prefix."usermeta`( user_id, meta_key, meta_value )
212
+ VALUES ( '".$user_id."', '_woocommerce_persistent_cart', '".$cart_info."' )";
213
+ $wpdb->query( $insert_persistent_cart );
214
+ }
215
+ }
216
+ }
217
+
218
+ function guest_checkout_fields( $fields ) {
219
+ if ( isset( $_SESSION['guest_first_name'] ) && $_SESSION['guest_first_name'] != "" ) {
220
+ $_POST['billing_first_name'] = $_SESSION['guest_first_name'];
221
+ }
222
+ if ( isset( $_SESSION['guest_last_name'] ) && $_SESSION['guest_last_name'] != "" ) {
223
+ $_POST['billing_last_name'] = $_SESSION['guest_last_name'];
224
+ }
225
+ if ( isset( $_SESSION['guest_email']) && $_SESSION['guest_email'] != "" ) {
226
+ $_POST['billing_email'] = $_SESSION['guest_email'];
227
+ }
228
+ if ( isset( $_SESSION['guest_phone']) && $_SESSION['guest_phone'] != "" ) {
229
+ $_POST['billing_phone'] = $_SESSION['guest_phone'];
230
+ }
231
+ return $fields;
232
+ }
233
+ }
234
+ $woocommerce_guest_ac = new woocommerce_guest_ac();
235
+ ?>
default-settings.php → includes/wcal_default-settings.php RENAMED
@@ -1,56 +1,54 @@
1
- <?php
2
- class default_template_settings {
3
- /* This function will load default template while activating the plugin.
4
- *
5
- * @since: AFter 2.5 version
6
- */
7
- function create_default_templates() {
8
- global $wpdb;
9
-
10
- $template_name_array = 'Initial';
11
- $site_title = get_bloginfo( 'name' );
12
- $site_url = get_option( 'siteurl' );
13
- $template_subject_array = $site_title . ": Did you have checkout trouble?";
14
- $active_post_array = 0;
15
- $email_frequency_array = 1;
16
- $day_or_hour_array = 'Hours';
17
- $body_content_array = addslashes("<html>
18
- <body>
19
- <p> Hello {{customer.fullname}}, </p>
20
- <p> &nbsp; </p>
21
- <p> We\'re following up with you, because we noticed that on {{cart.abandoned_date}} you attempted to purchase the following products on $site_title. </p>
22
- <p> &nbsp; </p>
23
- <p> {{products.cart}} </p>
24
- <p> &nbsp; </p>
25
- <p> If you had any purchase troubles, could you please Contact to share them? </p>
26
- <p> &nbsp; </p>
27
- <p> Otherwise, how about giving us another chance? Shop <a href= $site_url >$site_title</a>. </p>
28
- <hr></hr>
29
- <p> <a href=$site_url>$site_title</a> appreciates your business. </p>
30
- </body>
31
- </html>");
32
-
33
- $ac_from_name = 'Admin';
34
- $is_wc_template = 1 ;
35
- $default_template = 1;
36
- $from_email = get_option( 'admin_email' );
37
- $ac_email_reply = get_option( 'admin_email' );
38
-
39
- $query = "INSERT INTO `" . $wpdb->prefix . "ac_email_templates_lite`
40
- ( subject, body, is_active, frequency, day_or_hour, template_name, from_name, is_wc_template, default_template, reply_email, from_email )
41
- VALUES ( '" . $template_subject_array . "',
42
- '" . $body_content_array . "',
43
- '" . $active_post_array . "',
44
- '" . $email_frequency_array . "',
45
- '" . $day_or_hour_array . "',
46
- '" . $template_name_array . "',
47
- '" . $ac_from_name . "',
48
- '" . $is_wc_template . "',
49
- '" . $default_template . "',
50
- '" . $ac_email_reply . "',
51
- '" . $from_email . "' )";
52
-
53
- $wpdb->query( $query );
54
-
55
- }
56
- }
1
+ <?php
2
+ class wcal_default_template_settings {
3
+ /* This function will load default template while activating the plugin.
4
+ *
5
+ * @since: AFter 2.5 version
6
+ */
7
+ function wcal_create_default_templates() {
8
+ global $wpdb;
9
+ $template_name_array = 'Initial';
10
+ $site_title = get_bloginfo( 'name' );
11
+ $site_url = get_option( 'siteurl' );
12
+ $template_subject_array = $site_title . ": Did you have checkout trouble?";
13
+ $active_post_array = 0;
14
+ $email_frequency_array = 1;
15
+ $day_or_hour_array = 'Hours';
16
+ $body_content_array = addslashes( "<html>
17
+ <body>
18
+ <p> Hello {{customer.fullname}}, </p>
19
+ <p> &nbsp; </p>
20
+ <p> We\'re following up with you, because we noticed that on {{cart.abandoned_date}} you attempted to purchase the following products on $site_title. </p>
21
+ <p> &nbsp; </p>
22
+ <p> {{products.cart}} </p>
23
+ <p> &nbsp; </p>
24
+ <p> If you had any purchase troubles, could you please Contact to share them? </p>
25
+ <p> &nbsp; </p>
26
+ <p> Otherwise, how about giving us another chance? Shop <a href= $site_url >$site_title</a>. </p>
27
+ <hr></hr>
28
+ <p> You may <a href='{{cart.unsubscribe}}'>unsubscribe</a> to stop receiving these emails. </p>
29
+ <p> &nbsp; </p>
30
+ <p> <a href=$site_url>$site_title</a> appreciates your business. </p>
31
+ </body>
32
+ </html>" );
33
+ $ac_from_name = 'Admin';
34
+ $is_wc_template = 1 ;
35
+ $default_template = 1;
36
+ $from_email = get_option( 'admin_email' );
37
+ $ac_email_reply = get_option( 'admin_email' );
38
+
39
+ $query = "INSERT INTO `" . $wpdb->prefix . "ac_email_templates_lite`
40
+ ( subject, body, is_active, frequency, day_or_hour, template_name, from_name, is_wc_template, default_template, reply_email, from_email )
41
+ VALUES ( '" . $template_subject_array . "',
42
+ '" . $body_content_array . "',
43
+ '" . $active_post_array . "',
44
+ '" . $email_frequency_array . "',
45
+ '" . $day_or_hour_array . "',
46
+ '" . $template_name_array . "',
47
+ '" . $ac_from_name . "',
48
+ '" . $is_wc_template . "',
49
+ '" . $default_template . "',
50
+ '" . $ac_email_reply . "',
51
+ '" . $from_email . "' )";
52
+ $wpdb->query( $query );
53
+ }
54
+ }
 
 
pagination.class.php DELETED
@@ -1,204 +0,0 @@
1
- <?php
2
- class pagination{
3
- /*
4
- Script Name: *Digg Style Paginator Class
5
- Script URI: http://www.mis-algoritmos.com/2007/05/27/digg-style-pagination-class/
6
- Description: Class in PHP that allows to use a pagination like a digg or sabrosus style.
7
- Script Version: 0.4
8
- Author: Victor De la Rocha
9
- Author URI: http://www.mis-algoritmos.com
10
- */
11
- /*Default values*/
12
- var $total_pages = -1;//items
13
- var $limit = null;
14
- var $target = "";
15
- var $page = 1;
16
- var $adjacents = 2;
17
- var $showCounter = false;
18
- var $className = "pagination";
19
- var $parameterName = "page";
20
- var $urlF = false;//urlFriendly
21
-
22
- /*Buttons next and previous*/
23
- var $nextT = "Next";
24
- var $nextI = "&#187;"; //&#9658;
25
- var $prevT = "Previous";
26
- var $prevI = "&#171;"; //&#9668;
27
-
28
- /*****/
29
- var $calculate = false;
30
-
31
- #Total items
32
- function items($value){$this->total_pages = (int) $value;}
33
-
34
- #how many items to show per page
35
- function limit($value){$this->limit = (int) $value;}
36
-
37
- #Page to sent the page value
38
- function target($value){$this->target = $value;}
39
-
40
- #Current page
41
- function currentPage($value){$this->page = (int) $value;}
42
-
43
- #How many adjacent pages should be shown on each side of the current page?
44
- function adjacents($value){$this->adjacents = (int) $value;}
45
-
46
- #show counter?
47
- function showCounter($value=""){$this->showCounter=($value===true)?true:false;}
48
-
49
- #to change the class name of the pagination div
50
- function changeClass($value=""){$this->className=$value;}
51
-
52
- function nextLabel($value){$this->nextT = $value;}
53
- function nextIcon($value){$this->nextI = $value;}
54
- function prevLabel($value){$this->prevT = $value;}
55
- function prevIcon($value){$this->prevI = $value;}
56
-
57
- #to change the class name of the pagination div
58
- function parameterName($value=""){$this->parameterName=$value;}
59
-
60
- #to change urlFriendly
61
- function urlFriendly($value="%"){
62
- if(eregi('^ *$',$value)){
63
- $this->urlF=false;
64
- return false;
65
- }
66
- $this->urlF=$value;
67
- }
68
-
69
- var $pagination;
70
-
71
- function pagination(){}
72
- function show(){
73
- if(!$this->calculate)
74
- if($this->calculate())
75
- echo "<div class=\"$this->className\">$this->pagination</div>\n";
76
- }
77
- function getOutput(){
78
- if(!$this->calculate)
79
- if($this->calculate())
80
- return "<div class=\"$this->className\">$this->pagination</div>\n";
81
- }
82
- function get_pagenum_link($id){
83
- if(strpos($this->target,'?')===false)
84
- if($this->urlF)
85
- return str_replace($this->urlF,$id,$this->target);
86
- else
87
- return "$this->target?$this->parameterName=$id";
88
- else
89
- return "$this->target&$this->parameterName=$id";
90
- }
91
-
92
- function calculate(){
93
- $this->pagination = "";
94
- $this->calculate == true;
95
- $error = false;
96
- if($this->urlF and $this->urlF != '%' and strpos($this->target,$this->urlF)===false){
97
- //Es necesario especificar el comodin para sustituir
98
- echo "Especificaste un wildcard para sustituir, pero no existe en el target<br />";
99
- $error = true;
100
- }elseif($this->urlF and $this->urlF == '%' and strpos($this->target,$this->urlF)===false){
101
- echo "Es necesario especificar en el target el comodin % para sustituir el n�mero de p�gina<br />";
102
- $error = true;
103
- }
104
-
105
- if($this->total_pages < 0){
106
- echo "It is necessary to specify the <strong>number of pages</strong> (\$class->items(1000))<br />";
107
- $error = true;
108
- }
109
- if($this->limit == null){
110
- echo "It is necessary to specify the <strong>limit of items</strong> to show per page (\$class->limit(10))<br />";
111
- $error = true;
112
- }
113
- if($error)return false;
114
-
115
- $n = trim($this->nextT.' '.$this->nextI);
116
- $p = trim($this->prevI.' '.$this->prevT);
117
-
118
- /* Setup vars for query. */
119
- if($this->page)
120
- $start = ($this->page - 1) * $this->limit; //first item to display on this page
121
- else
122
- $start = 0; //if no page var is given, set start to 0
123
-
124
- /* Setup page vars for display. */
125
- $prev = $this->page - 1; //previous page is page - 1
126
- $next = $this->page + 1; //next page is page + 1
127
- $lastpage = ceil($this->total_pages/$this->limit); //lastpage is = total pages / items per page, rounded up.
128
- $lpm1 = $lastpage - 1; //last page minus 1
129
-
130
- /*
131
- Now we apply our rules and draw the pagination object.
132
- We're actually saving the code to a variable in case we want to draw it more than once.
133
- */
134
-
135
- if($lastpage > 1){
136
- if($this->page){
137
- //anterior button
138
- if($this->page > 1)
139
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($prev)."\" class=\"prev\">$p</a>";
140
- else
141
- $this->pagination .= "<span class=\"disabled\">$p</span>";
142
- }
143
- //pages
144
- if ($lastpage < 7 + ($this->adjacents * 2)){//not enough pages to bother breaking it up
145
- for ($counter = 1; $counter <= $lastpage; $counter++){
146
- if ($counter == $this->page)
147
- $this->pagination .= "<span class=\"current\">$counter</span>";
148
- else
149
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
150
- }
151
- }
152
- elseif($lastpage > 5 + ($this->adjacents * 2)){//enough pages to hide some
153
- //close to beginning; only hide later pages
154
- if($this->page < 1 + ($this->adjacents * 2)){
155
- for ($counter = 1; $counter < 4 + ($this->adjacents * 2); $counter++){
156
- if ($counter == $this->page)
157
- $this->pagination .= "<span class=\"current\">$counter</span>";
158
- else
159
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
160
- }
161
- $this->pagination .= "...";
162
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\">$lpm1</a>";
163
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\">$lastpage</a>";
164
- }
165
- //in middle; hide some front and some back
166
- elseif($lastpage - ($this->adjacents * 2) > $this->page && $this->page > ($this->adjacents * 2)){
167
- $this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\">1</a>";
168
- $this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\">2</a>";
169
- $this->pagination .= "...";
170
- for ($counter = $this->page - $this->adjacents; $counter <= $this->page + $this->adjacents; $counter++)
171
- if ($counter == $this->page)
172
- $this->pagination .= "<span class=\"current\">$counter</span>";
173
- else
174
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
175
- $this->pagination .= "...";
176
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\">$lpm1</a>";
177
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\">$lastpage</a>";
178
- }
179
- //close to end; only hide early pages
180
- else{
181
- $this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\">1</a>";
182
- $this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\">2</a>";
183
- $this->pagination .= "...";
184
- for ($counter = $lastpage - (2 + ($this->adjacents * 2)); $counter <= $lastpage; $counter++)
185
- if ($counter == $this->page)
186
- $this->pagination .= "<span class=\"current\">$counter</span>";
187
- else
188
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\">$counter</a>";
189
- }
190
- }
191
- if($this->page){
192
- //siguiente button
193
- if ($this->page < $counter - 1)
194
- $this->pagination .= "<a href=\"".$this->get_pagenum_link($next)."\" class=\"next\">$n</a>";
195
- else
196
- $this->pagination .= "<span class=\"displaying-num\">$n</span>";
197
- if($this->showCounter)$this->pagination = "<span class=\"displaying-num\">($this->total_pages Items)</span>".$this->pagination;
198
- }
199
- }
200
-
201
- return true;
202
- }
203
- }
204
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,196 +1,249 @@
1
- === Woocommerce Abandoned Cart Lite ===
2
- Contributors: ashokrane, pinal.shah, mansishah, dharakothari, bhavik.kiri
3
- Tags: abandon cart, shopping cart abandonment
4
- Requires at least: 1.3
5
- Tested up to: 4.4
6
- Stable tag: trunk
7
- License: GPLv2 or later
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
- Donate link: http://www.tychesoftwares.com/
10
-
11
- This easy-to-use plugin gives store owners the ability to recover sales that are lost to abandoned shopping carts by logged-in customers.
12
-
13
- == Description ==
14
-
15
- Abandoned Cart plugin works in the background, sending email notifications to your customers, reminding them about their abandoned orders.
16
-
17
- The Abandoned Cart plugin allows you to recover orders that were just a step away from closing. It enables you to create automatic & well-timed email reminders to be sent to your customers who have added your products to their cart, but did not complete the order. As a result, with this plugin you will start recovering at least 30% or more of your lost sales. Why let this 30% revenue go unclaimed?
18
-
19
- Abandoned Cart Lite plugin enables to do the following things:
20
- <ol>
21
- <li>Recover their abandoned carts in a single click</li>
22
- <li>Identify the Abandoned Orders information, including the products that were abandoned</li>
23
- <li>The plugin now captures abandoned guest carts. A guest user's cart will be captured on the Checkout page, if it is abandoned after entering the email address.</li>
24
- <li>Track abandoned orders value v/s recovered orders value</li>
25
- <li>Admin is notified by email when an order is recovered</li>
26
- <li>Works off-the-shelf as it comes with 1 default email template</li>
27
- <li>Create unlimited email templates to be sent at intervals that you set - Intervals start from 1 hour after cart is abandoned</li>
28
- <li>Add custom variables like Customer First Name, Customer Last name, Customer full name, Cart Link & Product Cart Information in the email template</li>
29
- <li>Copy HTML from anywhere & create templates using the powerful Rich Text Editor</li>
30
- <li>Automatically stops email notifications when a customer makes a purchase or uses the cart recovery link</li>
31
- </ol>
32
-
33
- Abandoned Cart PRO plugin enables to do the following additional things:
34
- <ol>
35
- <li>Works off-the-shelf as it comes with 3 default email templates</li>
36
- <li>Offer incentives to customers to return and complete their checkout with discounts and coupons</li>
37
- <li>Add custom variables like Customer Name, Product Information, Coupons, etc. in the email template</li>
38
- <li>Embed Woocommerce coupons & also generate unique coupons in the emails being sent to customers</li>
39
- <li>Track whether expired coupons are causing cart abandonment</li>
40
- <li>Track emails sent, emails opened, links clicked for each template/email</li>
41
- <li>Product report allows you to see which products are being abandoned & which are being recovered the most</li>
42
- <li>Create unlimited email templates to be sent at intervals that you set - Intervals start from 1 minute after cart is abandoned</li>
43
- </ol>
44
-
45
- **Pro Version:**
46
-
47
- **[WooCommerce Abandoned Cart Pro 2.6](http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro "WooCommerce Abandoned Cart Pro")** - The PRO version allows you to track products in abandoned carts, create unlimited email templates, track coupons, keep a track of sent emails & much more.
48
-
49
-
50
- **Email Sending Setup:**
51
-
52
- From version 1.3, it is not mandatory to set a cron job via CPanel for the abandoned cart email notifications to be sent. We are now using WP-Cron that sends the emails automatically whenever a page is requested.
53
-
54
- Abandoned Cart Plugin relies on a function called WP-Cron, and this function only runs when there is a page requested. So, if there are no visits to your website, then the scheduled jobs are not run. Generally this method of sending the abandoned cart notification emails is reliable. However, if you are not very confident about the traffic volume of your website, then you can set a manual cron job via Cpanel or any other control panel that your host provides.
55
-
56
- == Installation ==
57
-
58
- 1. Ensure you have latest version of Woocommerce plugin installed
59
- 2. Unzip and upload contents of the plugin to your /wp-content/plugins/ directory
60
- 3. Activate the plugin through the 'Plugins' menu in WordPress
61
- 4. The plugin will start working as per the settings entered.
62
-
63
-
64
- == Frequently Asked Questions ==
65
-
66
- = Can the plugin track carts abandoned by guest users? =
67
-
68
- Currently there is no provision for tracking guest carts. This is planned in a future release.
69
-
70
- UPDATE: This feature has been released in version 2.2.
71
-
72
- = Why are abandoned cart notification emails not getting sent? =
73
-
74
- Please ensure you have followed the instructions in "Email Sending Setup" right above this FAQ. Additionally, if you have the PRO version, please verify that you have selected "Enable abandoned cart notifications" option in Settings. With this option turned off, the abandoned carts are recorded, but emails are not sent.
75
-
76
- = Where can I find the documentation on how to setup the plugin? =
77
-
78
- The documentation can be found **[here](https://www.tychesoftwares.com/woocommerce-abandon-cart-plugin-documentation/ "WooCommerce Abandoned Cart Pro")**. The Lite version is a subset of the Pro version, so the same documentation can be used to refer for the Lite version of the plugin.
79
-
80
- == Screenshots ==
81
-
82
- 1. Lists all Abandoned Orders.
83
-
84
- 2. Lists all email templates.
85
-
86
- 3. Abandoned Cart Settings.
87
-
88
- 4. Lists Recovered Orders.
89
-
90
- == Changelog ==
91
-
92
- = 2.6 =
93
-
94
- * The plugin is now using the TinyMCE editor available in WordPress core for the email body content. The external TinyMCE library is removed from the plugin.
95
-
96
- * The plugin is made compatible with Huge IT Image Gallery plugin. The test email was not sent to the user when Huge IT Image Gallery plugin was activated.
97
-
98
- * The Product Report tab has been redesigned to look consistent with the WordPress style.
99
-
100
- = 2.5.2 =
101
-
102
- * Abandoned Orders tab has been redesigned with the WordPress WP list tables. "Action" column has been removed. The "Delete" link has been added in the abandoned orders tab. It is capable of deleting the abandoned orders when hovering the abandoned order in the list. It is also capable of deleting abandoned orders in bulk from the "Abandoned orders" tab.
103
-
104
- * Email Templates tab has been re-designed to be consistent with the WordPress styling. It is now capable of deleting email templates in bulk. Action column in the Email templates tab has been removed. User can Edit & Delete template using hover affect on the template. This update allows you to activate / deactivate email template from the "Email Templates" page itself without having to edit the template & set it as "Active" by checking the checkbox.
105
-
106
- * Recover Orders tab has been re-designed to be consistent with the WordPress style tables. "View Details" column in the Recovered Orders tab has been removed. User can view Details of the recovered cart using the link 'View Details' on the hover affect on 'User name' column.
107
-
108
- * New setting named as "Send From This Email Address:" is added in Add / Edit template page. It will allow to change the From Email address of abandoned cart notification.
109
-
110
- * New setting named as "Send Reply Emails to:" is added in Add / Edit template page. It will allow the user to change the Reply to email address of the abandoned cart notification.
111
-
112
- * If the "Wp-Content" folder name is changed using iThemes Security (formerly Better WP Security) plugin then abandoned cart email notifications were not sent. This has been fixed.
113
-
114
- * If the cart has been empty and we have tried to recover the order via email then it was displaying wrong Cart Recovery date. It has been fixed.
115
-
116
- * In some cases, when cart or checkout link was clicked from the abandoned cart email notification, it was displaying "Link Expired" in the browser. This has been fixed.
117
-
118
- * If the user has emptied their cart before the abandoned cut-off time is reached, for such carts the record in the DB will become blank. Such cart records were displayed in the abandoned orders list. This has been fixed.
119
-
120
- = 2.5.1 =
121
- * Some warnings were displayed on Email Templates tab. These have been fixed.
122
-
123
- = 2.5 =
124
-
125
- * The Settings page for the plugin has been redone. We are now using the WordPress Settings API for all the options on that page.
126
- * When the plugin is installed & activated for the first time, 1 default email template will also be created. The template will be inactive when the plugin is activated.
127
- * A new setting is added on the Add/Edit Template page named as "Active". If this setting is checked, only then the abandoned cart reminder email will be sent to the customers. If this setting is unchecked, then the email template won't be sent to the customers, but still you can keep it in the plugin. By default, this is unchecked.
128
- * A new setting is added on the Add/Edit Template page named as "Use WooCommerce Template Style". If this setting is checked then abandoned cart reminder email will use the WooCommerce style (header, footer, background, etc.) for the notifications. If it is not checked then the regular email will be sent to the customer as per the formatting that is set in the template editor.
129
- For existing users, this setting will remain unchecked. For new users of the plugin, the setting will be enabled for the existing default email template that is provided with the plugin.
130
- * Abandoned cart email notification will be sent to the client's billing address entered on checkout instead of on the email address added by the user while registering to the website. This applies only for logged in users.
131
- * New shortcode "{{cart.abandoned_date}}" has been introduced in this version. It will display the date and time when the cart was abandoned in the abandoned cart email notification.
132
- * When a customer places an order within the abandoned cart cut off time, then the order received page was displaying a warning. This has been fixed.
133
- * Abandoned Orders tab was not sorting according to the "Date" column. Same way, Recovered Orders tab was not sorting according to "Created On" & "Recovered Date" column. This has been fixed.
134
- * Some warnings were displayed on the Abandoned Orders, Recovered Orders and Product Report tab. These have been fixed.
135
- * The 'mailto' link was not working on the Abandoned Order details page. This has been fixed.
136
- * Tweak - Removed the background white color for the add / edit template page.
137
- * Tweak - Abandoned Orders tab will display the user's billing address using which the cart was abandoned. This applies only for logged in users.
138
-
139
- = 2.4 =
140
- * Abandon Cart record was not being deleted for users, when they do not reach the order received page but the payment for the order is already done. Also user was receiving the abandoned cart notification for such orders. This has been fixed.
141
-
142
- = 2.3 =
143
- * A new setting has been added "Email admin on order recovery". It will send an email to the admin's email address when an abandoned cart is recovered by the customer. This will work only for registered users.
144
- * A new tab "Product Report" has been added. It will list the product name, number of times product has been abandoned and the number of times product has been recovered.
145
-
146
- = 2.2 =
147
- * The plugin now captures abandoned guest carts. A guest user's cart will be captured on the Checkout page, if it is abandoned after entering the email address.
148
- * A new shortcode "{{cart.link}}" is added, which will include the cart URL of your shop.
149
- * Fixed some warnings being displayed in the Settings tab.
150
-
151
- = 2.1 =
152
- * From this version, you can view the abandoned order details, which includes product details, billing & shipping address, under the Abandoned Orders tab.
153
-
154
- = 2.0.1 =
155
- * Applied fix for warning displayed on the abandoned orders page.
156
-
157
- = 2.0 =
158
- * The image link was coming broken while creating or editing the template if the image is present on the same server. This is fixed now.
159
- * Added translations file for Hebrew which was contributed by a user.
160
-
161
- = 1.9 =
162
- * Fixed security issues pointed out by Wordpress.org review team.
163
-
164
- = 1.8 =
165
- * The strings for the products table, added using the shortcode {{products.cart}} in email templates have been added to the .pot, .po and .mo files of the plugin. Now the cart data will be translated to the respective language in the reminder emails as well as the test emails.
166
-
167
- = 1.7 =
168
- * Merge fields like {{products.cart}}, {{customer.firstname}}, etc. will be replaced with dummy data in the test emails that are sent from the template add / edit page. This ensures that you get a very close approximation of the actual email that will be delivered to your customers.
169
- * Product image size in the abandon cart notification emails is set to a fixed height & width now.
170
- * On WordPress Multisite, incorrect table prefix was used due to which the plugin was not functioning correctly on multisite installs. This is fixed now.
171
-
172
- = 1.6 =
173
- * We have included .po, .pot and .mo files in the plugin. The plugin strings can now be translated to any language using these files.
174
-
175
- = 1.5 =
176
- * A shortcode {{products.cart}} can now be added in the abandoned cart notification emails. It will add the product information in the email like Product image, Product name, Quantity, Price & Total. The shortcode needs to be added from the AC menu from the template editor.
177
- * The default value of the field "Cart abandoned cut-off time" in Settings tab was blank when the plugin is installed. This is now set to 60 minutes upon plugin activation.
178
-
179
- = 1.4 =
180
- * The abandoned cart emails were being sent multiple times for a single email template due to a bug. This is fixed.
181
- * The plugin will now work on WordPress Multisite too.
182
-
183
- = 1.3 =
184
- * The abandoned cart email notifications are now sent out automatically without the necessity of having to set up a cron job manually.
185
-
186
- = 1.2 =
187
- * The test emails were not getting sent.
188
- * Warnings fixed for some of the plugin setting pages.
189
- * The image urls in the email were coming broken, this is fixed.
190
-
191
- = 1.1 =
192
- * Compatibility with WooCommerce 2.x versions
193
- * Fixed 404 errors with images & other files
194
-
195
- = 1.0 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  * Initial release.
1
+ === Abandoned Cart Lite for WooCommerce ===
2
+ Contributors: ashokrane, pinal.shah, bhavik.kiri, chetnapatel
3
+ Tags: abandon cart, shopping cart abandonment, sales recovery
4
+ Requires at least: 1.3
5
+ Tested up to: 4.5.3
6
+ Stable tag: trunk
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+ Donate link: http://www.tychesoftwares.com/
10
+
11
+ This easy-to-use plugin allows WooCommerce store owners to recover sales that are lost to abandoned shopping carts by customers.
12
+
13
+ == Description ==
14
+
15
+ Abandoned Cart plugin works in the background, sending email notifications to your guests customers & logged-in customers, reminding them about their abandoned orders.
16
+
17
+ The Abandoned Cart plugin allows you to recover orders that were just a step away from closing. It enables you to create automatic & well-timed email reminders to be sent to your customers who have added your products to their cart, but did not complete the order. As a result, with this plugin you will start recovering at least 30% or more of your lost sales. Why let this 30% revenue go unclaimed?
18
+
19
+ Abandoned Cart Lite plugin enables to do the following things:
20
+ <ol>
21
+ <li>Recover their abandoned carts in a single click</li>
22
+ <li>Identify the Abandoned Orders information, including the products that were abandoned</li>
23
+ <li>The plugin now captures abandoned guest carts. A guest user's cart will be captured on the Checkout page, if it is abandoned after entering the email address.</li>
24
+ <li>Track abandoned orders value v/s recovered orders value</li>
25
+ <li>Admin is notified by email when an order is recovered</li>
26
+ <li>Works off-the-shelf as it comes with 1 default email template</li>
27
+ <li>Create unlimited email templates to be sent at intervals that you set - Intervals start from 1 hour after cart is abandoned</li>
28
+ <li>Add custom variables like Customer First Name, Customer Last name, Customer full name, Cart Link & Product Cart Information in the email template</li>
29
+ <li>Copy HTML from anywhere & create templates using the powerful Rich Text Editor</li>
30
+ <li>Automatically stops email notifications when a customer makes a purchase or uses the cart recovery link</li>
31
+ </ol>
32
+
33
+ Abandoned Cart PRO plugin enables to do the following additional things:
34
+ <ol>
35
+ <li>Works off-the-shelf as it comes with 3 default email templates</li>
36
+ <li>Offer incentives to customers to return and complete their checkout with discounts and coupons</li>
37
+ <li>Add custom variables like Customer Name, Product Information, Coupons, etc. in the email template</li>
38
+ <li>Embed WooCommerce coupons & also generate unique coupons in the emails being sent to customers</li>
39
+ <li>Track whether expired coupons are causing cart abandonment</li>
40
+ <li>Track emails sent, emails opened, links clicked for each template/email</li>
41
+ <li>Product report allows you to see which products are being abandoned & which are being recovered the most</li>
42
+ <li>Create unlimited email templates to be sent at intervals that you set - Intervals start from 1 minute after cart is abandoned</li>
43
+ </ol>
44
+
45
+ **Pro Version:**
46
+
47
+ **[Abandoned Cart Pro for WooCommerce 3.4](http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro "Abandoned Cart Pro for WooCommerce")** - The PRO version allows you to track products in abandoned carts, create unlimited email templates, track coupons, keep a track of sent emails & much more.
48
+
49
+
50
+ **Email Sending Setup:**
51
+
52
+ From version 1.3, it is not mandatory to set a cron job via CPanel for the abandoned cart email notifications to be sent. We are now using WP-Cron that sends the emails automatically whenever a page is requested.
53
+
54
+ Abandoned Cart Plugin relies on a function called WP-Cron, and this function only runs when there is a page requested. So, if there are no visits to your website, then the scheduled jobs are not run. Generally this method of sending the abandoned cart notification emails is reliable. However, if you are not very confident about the traffic volume of your website, then you can set a manual cron job via Cpanel or any other control panel that your host provides.
55
+
56
+ == Installation ==
57
+
58
+ 1. Ensure you have latest version of WooCommerce plugin installed
59
+ 2. Unzip and upload contents of the plugin to your /wp-content/plugins/ directory
60
+ 3. Activate the plugin through the 'Plugins' menu in WordPress
61
+ 4. The plugin will start working as per the settings entered.
62
+
63
+
64
+ == Frequently Asked Questions ==
65
+
66
+ = Can the plugin track carts abandoned by guest users? =
67
+
68
+ Currently there is no provision for tracking guest carts. This is planned in a future release.
69
+
70
+ UPDATE: This feature has been released in version 2.2.
71
+
72
+ = Why are abandoned cart notification emails not getting sent? =
73
+
74
+ Please ensure you have followed the instructions in "Email Sending Setup" right above this FAQ. Additionally, if you have the PRO version, please verify that you have selected "Enable abandoned cart notifications" option in Settings. With this option turned off, the abandoned carts are recorded, but emails are not sent.
75
+
76
+ = Where can I find the documentation on how to setup the plugin? =
77
+
78
+ The documentation can be found **[here](https://www.tychesoftwares.com/woocommerce-abandon-cart-plugin-documentation/ "WooCommerce Abandoned Cart Pro")**. The Lite version is a subset of the Pro version, so the same documentation can be used to refer for the Lite version of the plugin.
79
+
80
+ == Screenshots ==
81
+
82
+ 1. Lists all Abandoned Orders.
83
+
84
+ 2. Lists all email templates.
85
+
86
+ 3. Abandoned Cart Settings.
87
+
88
+ 4. Lists Recovered Orders.
89
+
90
+ 5. Product Report Tab.
91
+
92
+ == Changelog ==
93
+
94
+ = 3.0 =
95
+
96
+ * Enhancements - In this version, the code has been refined throughout the plugin & the folder structure has also been modified.
97
+
98
+ * Enhancements - Earlier rounding off of the decimal values was hardcoded in the plugin. Now, it will round the decimal values based on the WooCommerce setting named �Number of Decimals� which is located at WooCommerce -> Settings menu.
99
+
100
+ * Bugs Fixed - When setting "Email admin On Order Recovery" is enabled & order is recovered from the abandoned cart reminder notifications using "Cash On Delivery" payment gateway. Then the order is not considered as recovered & the order was not displayed in the "Recovered Orders" tab. This has been fixed.
101
+
102
+ * Bugs Fixed - Earlier the abandoned cart reminder emails & abandoned orders details page was not displaying the selected attributes for the variable products. This has been fixed.
103
+
104
+ * Bugs Fixed - The "Abandoned Date" column of the abandoned orders tab was not considering the time for sorting. This has been fixed.
105
+
106
+ = 2.9 =
107
+
108
+ * New Feature - New merge tag {{cart.unsubscribe}} has been added for email templates. This merge tag allows user to stop receiving further abandoned cart reminder email notifications. This merge tag has been added to comply with email sending laws in different countries.
109
+
110
+ * Bugs Fixed - Earlier if any user came from abandoned cart reminder email and place the order using PayPal payment gateway and do not reach the order received page. Then plugin was not considering that order as a recovered order. From now onwards if the user came from the abandoned cart reminder email and place the order using PayPal and does not reach the order received the page. Then plugin will consider that cart as a recovered order.
111
+
112
+ * Bugs Fixed - When the cart is abandoned as a guest & product have the special character in the attributes name, then it was displaying a blank row with only a checkbox on the Abandoned Orders tab. This has been fixed.
113
+
114
+ * Tweak - If the order is recovered from the abandoned cart reminder email then it will add a note "This order was abandoned & subsequently recovered." for the order.
115
+
116
+ = 2.8 =
117
+
118
+ * We have changed the encryption for the links that are sent in the Abandoned cart email notifications. Earlier we were using the mcrypt library for encoding the data. If mcrypt library was not installed on the server, then abandoned cart email notifications were not sent. Now we have used different functions for encoding the string. We have used microtime function & a security key. Using this security key, and after applying an algorithm on it, we generate the encoded string.
119
+
120
+ * The session now starts only on required pages of the store. Earlier it was started globally. This will help to improve the site performance.
121
+
122
+ * If billing email address of the logged-in user is not set then it was showing blank space on the abandoned orders list. This has been fixed. Now it will show the email address which was used while registering to the store.
123
+
124
+ * Earlier if email body was blank and we send the test email then blank email was sent. This has been fixed. Now if email body is blank then test email will not be sent.
125
+
126
+ * Tweak - Earlier we were populating the guest cart information by looping into the global WooCommerce cart. Now we are not looping & instead using the WooCommerce session object itself.
127
+
128
+ * Tweak - Earlier if the 'wp-content' directory has been renamed, then wp-load.php file was not included and abandoned cart reminder email was not sent. Now, we have changed the way of including the wp-load.php file for sending the abandoned cart reminder notifications.
129
+
130
+ * Tweak - Earlier when {{products.cart}} merge tag is used in abandoned cart email template, then on click of the product name and product image, it was redirecting to the product page. Now it will redirect the user to the cart page.
131
+
132
+ * Tweak - We are now rounding off the prices with the 'round' function.
133
+
134
+ = 2.7 =
135
+
136
+ * New setting named as "Email Template Header Text" is added in Add / Edit template page. It will allow to change the header text of the email which have WooCommerce template style setting enabled for the template.
137
+
138
+ * From this version, the email sending process will run every 15 minutes instead of every 5 minutes. This will result in improved overall performance of the website.
139
+
140
+ * When Lite version of the plugin is activated on the site then it was not allowing to activate the PRO version of the plugin. This has been fixed.
141
+
142
+ * When templates are created / updated and if it has the same duration as one of the existing templates, then new template was not saved. This has been fixed.
143
+
144
+
145
+ = 2.6 =
146
+
147
+ * The plugin is now using the TinyMCE editor available in WordPress core for the email body content. The external TinyMCE library is removed from the plugin.
148
+
149
+ * The plugin is made compatible with Huge IT Image Gallery plugin. The test email was not sent to the user when Huge IT Image Gallery plugin was activated.
150
+
151
+ * The Product Report tab has been redesigned to look consistent with the WordPress style.
152
+
153
+ = 2.5.2 =
154
+
155
+ * Abandoned Orders tab has been redesigned with the WordPress WP list tables. "Action" column has been removed. The "Delete" link has been added in the abandoned orders tab. It is capable of deleting the abandoned orders when hovering the abandoned order in the list. It is also capable of deleting abandoned orders in bulk from the "Abandoned orders" tab.
156
+
157
+ * Email Templates tab has been re-designed to be consistent with the WordPress styling. It is now capable of deleting email templates in bulk. Action column in the Email templates tab has been removed. User can Edit & Delete template using hover affect on the template. This update allows you to activate / deactivate email template from the "Email Templates" page itself without having to edit the template & set it as "Active" by checking the checkbox.
158
+
159
+ * Recover Orders tab has been re-designed to be consistent with the WordPress style tables. "View Details" column in the Recovered Orders tab has been removed. User can view Details of the recovered cart using the link 'View Details' on the hover affect on 'User name' column.
160
+
161
+ * New setting named as "Send From This Email Address:" is added in Add / Edit template page. It will allow to change the From Email address of abandoned cart notification.
162
+
163
+ * New setting named as "Send Reply Emails to:" is added in Add / Edit template page. It will allow the user to change the Reply to email address of the abandoned cart notification.
164
+
165
+ * If the "Wp-Content" folder name is changed using iThemes Security (formerly Better WP Security) plugin then abandoned cart email notifications were not sent. This has been fixed.
166
+
167
+ * If the cart has been empty and we have tried to recover the order via email then it was displaying wrong Cart Recovery date. It has been fixed.
168
+
169
+ * In some cases, when cart or checkout link was clicked from the abandoned cart email notification, it was displaying "Link Expired" in the browser. This has been fixed.
170
+
171
+ * If the user has emptied their cart before the abandoned cut-off time is reached, for such carts the record in the DB will become blank. Such cart records were displayed in the abandoned orders list. This has been fixed.
172
+
173
+ = 2.5.1 =
174
+ * Some warnings were displayed on Email Templates tab. These have been fixed.
175
+
176
+ = 2.5 =
177
+
178
+ * The Settings page for the plugin has been redone. We are now using the WordPress Settings API for all the options on that page.
179
+ * When the plugin is installed & activated for the first time, 1 default email template will also be created. The template will be inactive when the plugin is activated.
180
+ * A new setting is added on the Add/Edit Template page named as "Active". If this setting is checked, only then the abandoned cart reminder email will be sent to the customers. If this setting is unchecked, then the email template won't be sent to the customers, but still you can keep it in the plugin. By default, this is unchecked.
181
+ * A new setting is added on the Add/Edit Template page named as "Use WooCommerce Template Style". If this setting is checked then abandoned cart reminder email will use the WooCommerce style (header, footer, background, etc.) for the notifications. If it is not checked then the regular email will be sent to the customer as per the formatting that is set in the template editor.
182
+ For existing users, this setting will remain unchecked. For new users of the plugin, the setting will be enabled for the existing default email template that is provided with the plugin.
183
+ * Abandoned cart email notification will be sent to the client's billing address entered on checkout instead of on the email address added by the user while registering to the website. This applies only for logged in users.
184
+ * New shortcode "{{cart.abandoned_date}}" has been introduced in this version. It will display the date and time when the cart was abandoned in the abandoned cart email notification.
185
+ * When a customer places an order within the abandoned cart cut off time, then the order received page was displaying a warning. This has been fixed.
186
+ * Abandoned Orders tab was not sorting according to the "Date" column. Same way, Recovered Orders tab was not sorting according to "Created On" & "Recovered Date" column. This has been fixed.
187
+ * Some warnings were displayed on the Abandoned Orders, Recovered Orders and Product Report tab. These have been fixed.
188
+ * The 'mailto' link was not working on the Abandoned Order details page. This has been fixed.
189
+ * Tweak - Removed the background white color for the add / edit template page.
190
+ * Tweak - Abandoned Orders tab will display the user's billing address using which the cart was abandoned. This applies only for logged in users.
191
+
192
+ = 2.4 =
193
+ * Abandon Cart record was not being deleted for users, when they do not reach the order received page but the payment for the order is already done. Also user was receiving the abandoned cart notification for such orders. This has been fixed.
194
+
195
+ = 2.3 =
196
+ * A new setting has been added "Email admin on order recovery". It will send an email to the admin's email address when an abandoned cart is recovered by the customer. This will work only for registered users.
197
+ * A new tab "Product Report" has been added. It will list the product name, number of times product has been abandoned and the number of times product has been recovered.
198
+
199
+ = 2.2 =
200
+ * The plugin now captures abandoned guest carts. A guest user's cart will be captured on the Checkout page, if it is abandoned after entering the email address.
201
+ * A new shortcode "{{cart.link}}" is added, which will include the cart URL of your shop.
202
+ * Fixed some warnings being displayed in the Settings tab.
203
+
204
+ = 2.1 =
205
+ * From this version, you can view the abandoned order details, which includes product details, billing & shipping address, under the Abandoned Orders tab.
206
+
207
+ = 2.0.1 =
208
+ * Applied fix for warning displayed on the abandoned orders page.
209
+
210
+ = 2.0 =
211
+ * The image link was coming broken while creating or editing the template if the image is present on the same server. This is fixed now.
212
+ * Added translations file for Hebrew which was contributed by a user.
213
+
214
+ = 1.9 =
215
+ * Fixed security issues pointed out by Wordpress.org review team.
216
+
217
+ = 1.8 =
218
+ * The strings for the products table, added using the shortcode {{products.cart}} in email templates have been added to the .pot, .po and .mo files of the plugin. Now the cart data will be translated to the respective language in the reminder emails as well as the test emails.
219
+
220
+ = 1.7 =
221
+ * Merge fields like {{products.cart}}, {{customer.firstname}}, etc. will be replaced with dummy data in the test emails that are sent from the template add / edit page. This ensures that you get a very close approximation of the actual email that will be delivered to your customers.
222
+ * Product image size in the abandon cart notification emails is set to a fixed height & width now.
223
+ * On WordPress Multisite, incorrect table prefix was used due to which the plugin was not functioning correctly on multisite installs. This is fixed now.
224
+
225
+ = 1.6 =
226
+ * We have included .po, .pot and .mo files in the plugin. The plugin strings can now be translated to any language using these files.
227
+
228
+ = 1.5 =
229
+ * A shortcode {{products.cart}} can now be added in the abandoned cart notification emails. It will add the product information in the email like Product image, Product name, Quantity, Price & Total. The shortcode needs to be added from the AC menu from the template editor.
230
+ * The default value of the field "Cart abandoned cut-off time" in Settings tab was blank when the plugin is installed. This is now set to 60 minutes upon plugin activation.
231
+
232
+ = 1.4 =
233
+ * The abandoned cart emails were being sent multiple times for a single email template due to a bug. This is fixed.
234
+ * The plugin will now work on WordPress Multisite too.
235
+
236
+ = 1.3 =
237
+ * The abandoned cart email notifications are now sent out automatically without the necessity of having to set up a cron job manually.
238
+
239
+ = 1.2 =
240
+ * The test emails were not getting sent.
241
+ * Warnings fixed for some of the plugin setting pages.
242
+ * The image urls in the email were coming broken, this is fixed.
243
+
244
+ = 1.1 =
245
+ * Compatibility with WooCommerce 2.x versions
246
+ * Fixed 404 errors with images & other files
247
+
248
+ = 1.0 =
249
  * Initial release.
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
screenshot-5.png ADDED
Binary file
views/wacp-email-template-preview.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
- /**
3
- * Admin View: Abadoned Cart reminder Email Template Preview
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit; // Exit if accessed directly
8
- }
9
-
10
- ?>
11
- <html>
12
- <head>
13
- <title>My document title</title>
14
- </head>
15
- <body>
16
-
17
- <p align="center"> Hello John Carter, </p>
18
- <p> &nbsp; </p>
19
- <p align="center"> We're following up with you, because we noticed that on 12-12-2015 you attempted to purchase the following products on <?php echo get_option( 'blogname' );?>. </p>
20
- <p> &nbsp; </p>
21
- <p>
22
-
23
- <table border="0" cellspacing="5" align="center"><caption><b>Cart Details</b></caption>
24
- <tbody>
25
- <tr>
26
- <th></th>
27
- <th>Product</th>
28
- <th>Price</th>
29
- <th>Quantity</th>
30
- <th>Total</th>
31
- </tr>
32
- <tr style="background-color:#f4f5f4;">
33
- <td><img src = "<?php echo plugins_url();?>/woocommerce-abandoned-cart/images/spectre.jpg" height="40px" width="40px"></td><td>Spectre</td><td>$150</td><td>2</td><td>$300</td>
34
- </tr>
35
- <tr>
36
- <td>&nbsp;</td>
37
- <td>&nbsp;</td>
38
- <td>&nbsp;</td>
39
- <th>Cart Total:</th>
40
- <td>$300</td>
41
- </tr></tbody></table> </p>
42
- <p> &nbsp; </p>
43
- <p align="center"> If you had any purchase troubles, could you please Contact to share them? </p>
44
- <p> &nbsp; </p>
45
- <p align="center"> Otherwise, how about giving us another chance? Shop <a href="<?php echo get_option( 'siteurl' );?>"><?php echo get_option( 'blogname' );?></a>. </p>
46
- <hr></hr>
47
- <p align="center"> You may <a href="<?php echo get_option( 'siteurl' );?>">unsubscribe</a> to stop receiving these emails. </p>
48
- <p> &nbsp; </p>
49
- <p align="center"> <a href="<?php echo get_option( 'siteurl' );?>"><?php echo get_option( 'blogname' );?></a> appreciates your business. </p>
50
-
51
- </body>
52
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
views/wacp-wc-email-template-preview.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
- /**
3
- * Admin View: Abadoned Cart reminder Email Template Preview
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit; // Exit if accessed directly
8
- }
9
-
10
- ?>
11
- <body>
12
-
13
- <p > Hello John Carter, </p>
14
- <p> &nbsp; </p>
15
- <p > We're following up with you, because we noticed that on 12-12-2015 you attempted to purchase the following products on <?php echo get_option( 'blogname' );?>. </p>
16
- <p> &nbsp; </p>
17
- <p>
18
-
19
- <table border="0" cellspacing="5" align="center"><caption><b>Cart Details</b></caption>
20
- <tbody>
21
- <tr>
22
- <th></th>
23
- <th>Product</th>
24
- <th>Price</th>
25
- <th>Quantity</th>
26
- <th>Total</th>
27
- </tr>
28
- <tr style="background-color:#f4f5f4;">
29
- <td><img src = "<?php echo plugins_url();?>/woocommerce-abandoned-cart/images/spectre.jpg" height="40px" width="40px"></td><td>Spectre</td><td>$150</td><td>2</td><td>$300</td>
30
- </tr>
31
- <tr>
32
- <td>&nbsp;</td>
33
- <td>&nbsp;</td>
34
- <td>&nbsp;</td>
35
- <th>Cart Total:</th>
36
- <td>$300</td>
37
- </tr></tbody></table> </p>
38
- <p> &nbsp; </p>
39
- <p > If you had any purchase troubles, could you please Contact to share them? </p>
40
- <p> &nbsp; </p>
41
- <p > Otherwise, how about giving us another chance? Shop <a href="<?php echo get_option( 'siteurl' );?>"><?php echo get_option( 'blogname' );?></a>. </p>
42
- <hr></hr>
43
- <p > You may <a href="<?php echo get_option( 'siteurl' );?>">unsubscribe</a> to stop receiving these emails. </p>
44
- <p> &nbsp; </p>
45
- <p > <a href="<?php echo get_option( 'siteurl' );?>"><?php echo get_option( 'blogname' );?></a> appreciates your business. </p>
46
-
47
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
views/wcal-email-template-preview.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Abandoned Cart reminder Email Template Preview
4
+ */
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit; // Exit if accessed directly
7
+ }
8
+ ?>
9
+ <html>
10
+ <head>
11
+ <title>My document title</title>
12
+ </head>
13
+ <body>
14
+ <p align="center"> Hello John Carter, </p>
15
+ <p> &nbsp; </p>
16
+ <p align="center"> We're following up with you, because we noticed that on 12-12-2015 you attempted to purchase the following products on <?php echo get_option( 'blogname' );?>. </p>
17
+ <p> &nbsp; </p>
18
+ <p>
19
+ <table border="0" cellspacing="5" align="center"><caption><b>Cart Details</b></caption>
20
+ <tbody>
21
+ <tr>
22
+ <th></th>
23
+ <th>Product</th>
24
+ <th>Price</th>
25
+ <th>Quantity</th>
26
+ <th>Total</th>
27
+ </tr>
28
+ <tr style="background-color:#f4f5f4;">
29
+ <td><img src = "<?php echo plugins_url();?>/woocommerce-abandoned-cart/assets/images/spectre.jpg" height="40px" width="40px"></td><td>Spectre</td><td>$150</td><td>2</td><td>$300</td>
30
+ </tr>
31
+ <tr>
32
+ <td>&nbsp;</td>
33
+ <td>&nbsp;</td>
34
+ <td>&nbsp;</td>
35
+ <th>Cart Total:</th>
36
+ <td>$300</td>
37
+ </tr>
38
+ </tbody>
39
+ </table>
40
+ </p>
41
+ <p> &nbsp; </p>
42
+ <p align="center"> If you had any purchase troubles, could you please Contact to share them? </p>
43
+ <p> &nbsp; </p>
44
+ <p align="center"> Otherwise, how about giving us another chance? Shop <a href="<?php echo get_option( 'siteurl' );?>"><?php echo get_option( 'blogname' );?></a>. </p>
45
+ <hr></hr>
46
+ <p align="center"> You may <a href="<?php echo get_option( 'siteurl' );?>">unsubscribe</a> to stop receiving these emails. </p>
47
+ <p> &nbsp; </p>
48
+ <p align="center"> <a href="<?php echo get_option( 'siteurl' );?>"><?php echo get_option( 'blogname' );?></a> appreciates your business. </p>
49
+ </body>
50
+ </html>
views/wcal-wc-email-template-preview.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin View: Abandoned Cart reminder Email Template Preview
4
+ */
5
+ if( ! defined( 'ABSPATH' ) ) {
6
+ exit; // Exit if accessed directly
7
+ }
8
+ ?>
9
+ <body>
10
+ <p> Hello John Carter, </p>
11
+ <p> &nbsp; </p>
12
+ <p> We're following up with you, because we noticed that on 12-12-2015 you attempted to purchase the following products on <?php echo get_option( 'blogname' );?>. </p>
13
+ <p> &nbsp; </p>
14
+ <p>
15
+ <table border="0" cellspacing="5" align="center"><caption><b>Cart Details</b></caption>
16
+ <tbody>
17
+ <tr>
18
+ <th></th>
19
+ <th>Product</th>
20
+ <th>Price</th>
21
+ <th>Quantity</th>
22
+ <th>Total</th>
23
+ </tr>
24
+ <tr style="background-color:#f4f5f4;">
25
+ <td><img src = "<?php echo plugins_url();?>/woocommerce-abandoned-cart/assets/images/spectre.jpg" height="40px" width="40px"></td><td>Spectre</td><td>$150</td><td>2</td><td>$300</td>
26
+ </tr>
27
+ <tr>
28
+ <td>&nbsp;</td>
29
+ <td>&nbsp;</td>
30
+ <td>&nbsp;</td>
31
+ <th>Cart Total:</th>
32
+ <td>$300</td>
33
+ </tr>
34
+ </tbody>
35
+ </table>
36
+ </p>
37
+ <p> &nbsp; </p>
38
+ <p> If you had any purchase troubles, could you please Contact to share them? </p>
39
+ <p> &nbsp; </p>
40
+ <p> Otherwise, how about giving us another chance? Shop <a href="<?php echo get_option( 'siteurl' );?>"><?php echo get_option( 'blogname' );?></a>. </p>
41
+ <hr></hr>
42
+ <p> You may <a href="<?php echo get_option( 'siteurl' );?>">unsubscribe</a> to stop receiving these emails. </p>
43
+ <p> &nbsp; </p>
44
+ <p> <a href="<?php echo get_option( 'siteurl' );?>"><?php echo get_option( 'blogname' );?></a> appreciates your business. </p>
45
+ </body>
woo-includes/class-wc-dependencies.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- /**
3
- * WC Dependency Checker
4
- *
5
- * Checks if WooCommerce is enabled
6
- */
7
- class WC_Dependencies {
8
-
9
- private static $active_plugins;
10
-
11
- function init() {
12
-
13
- self::$active_plugins = (array) get_option( 'active_plugins', array() );
14
-
15
- if ( is_multisite() )
16
- self::$active_plugins = array_merge( self::$active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
17
- }
18
-
19
- function woocommerce_active_check() {
20
-
21
- if ( ! self::$active_plugins ) self::init();
22
-
23
- return in_array( 'woocommerce/woocommerce.php', self::$active_plugins ) || array_key_exists( 'woocommerce/woocommerce.php', self::$active_plugins );
24
-
25
- }
26
-
27
- }
28
-
29
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
woo-includes/woo-functions.php DELETED
@@ -1,97 +0,0 @@
1
- <?php
2
- /**
3
- * Functions used by plugins
4
- */
5
- if ( ! class_exists( 'WC_Dependencies' ) )
6
- require_once 'class-wc-dependencies.php';
7
-
8
- /**
9
- * WC Detection
10
- */
11
- if ( ! function_exists( 'is_woocommerce_active' ) ) {
12
- function is_woocommerce_active() {
13
- return WC_Dependencies::woocommerce_active_check();
14
- }
15
- }
16
-
17
- /**
18
- * Queue updates for the WooUpdater
19
- */
20
- if ( ! function_exists( 'woothemes_queue_update' ) ) {
21
- function woothemes_queue_update( $file, $file_id, $product_id ) {
22
- global $woothemes_queued_updates;
23
-
24
- if ( ! isset( $woothemes_queued_updates ) )
25
- $woothemes_queued_updates = array();
26
-
27
- $plugin = new stdClass();
28
- $plugin->file = $file;
29
- $plugin->file_id = $file_id;
30
- $plugin->product_id = $product_id;
31
-
32
- $woothemes_queued_updates[] = $plugin;
33
- }
34
- }
35
-
36
- /**
37
- * Load installer for the WooThemes Updater.
38
- * @return $api Object
39
- */
40
- if ( ! class_exists( 'WooThemes_Updater' ) && ! function_exists( 'woothemes_updater_install' ) ) {
41
- function woothemes_updater_install( $api, $action, $args ) {
42
- $download_url = 'http://woodojo.s3.amazonaws.com/downloads/woothemes-updater/woothemes-updater.zip';
43
-
44
- if ( 'plugin_information' != $action ||
45
- false !== $api ||
46
- ! isset( $args->slug ) ||
47
- 'woothemes-updater' != $args->slug
48
- ) return $api;
49
-
50
- $api = new stdClass();
51
- $api->name = 'WooThemes Updater';
52
- $api->version = '1.0.0';
53
- $api->download_link = esc_url( $download_url );
54
- return $api;
55
- }
56
-
57
- add_filter( 'plugins_api', 'woothemes_updater_install', 10, 3 );
58
- }
59
-
60
- /**
61
- * WooUpdater Installation Prompts
62
- */
63
- if ( ! class_exists( 'WooThemes_Updater' ) && ! function_exists( 'woothemes_updater_notice' ) ) {
64
-
65
- /**
66
- * Display a notice if the "WooThemes Updater" plugin hasn't been installed.
67
- * @return void
68
- */
69
- function woothemes_updater_notice() {
70
- $active_plugins = apply_filters( 'active_plugins', get_option('active_plugins' ) );
71
- if ( in_array( 'woothemes-updater/woothemes-updater.php', $active_plugins ) ) return;
72
-
73
- $slug = 'woothemes-updater';
74
- $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug );
75
- $activate_url = 'plugins.php?action=activate&plugin=' . urlencode( 'woothemes-updater/woothemes-updater.php' ) . '&plugin_status=all&paged=1&s&_wpnonce=' . urlencode( wp_create_nonce( 'activate-plugin_woothemes-updater/woothemes-updater.php' ) );
76
-
77
- $message = '<a href="' . esc_url( $install_url ) . '">Install the WooThemes Updater plugin</a> to get updates for your WooThemes plugins.';
78
- $is_downloaded = false;
79
- $plugins = array_keys( get_plugins() );
80
- foreach ( $plugins as $plugin ) {
81
- if ( strpos( $plugin, 'woothemes-updater.php' ) !== false ) {
82
- $is_downloaded = true;
83
- $message = '<a href="' . esc_url( admin_url( $activate_url ) ) . '">Activate the WooThemes Updater plugin</a> to get updates for your WooThemes plugins.';
84
- }
85
- }
86
- echo '<div class="updated fade"><p>' . $message . '</p></div>' . "\n";
87
- }
88
-
89
- add_action( 'admin_notices', 'woothemes_updater_notice' );
90
- }
91
-
92
- /**
93
- * Prevent conflicts with older versions
94
- */
95
- if ( ! class_exists( 'WooThemes_Plugin_Updater' ) ) {
96
- class WooThemes_Plugin_Updater { function init() {} }
97
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
woocommerce-ac.php CHANGED
@@ -1,2713 +1,2977 @@
1
- <?php
2
- /*
3
- Plugin Name: WooCommerce Abandon Cart Lite Plugin
4
- Plugin URI: http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro
5
- Description: This plugin captures abandoned carts by logged-in users & emails them about it. <strong><a href="http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro">Click here to get the PRO Version.</a></strong>
6
- Version: 2.6
7
- Author: Tyche Softwares
8
- Author URI: http://www.tychesoftwares.com/
9
- */
10
-
11
- if( session_id() === '' ){
12
- //session has not started
13
- session_start();
14
- }
15
- // Deletion Settings
16
- register_uninstall_hook( __FILE__, 'woocommerce_ac_delete' );
17
-
18
- include_once( "woocommerce_guest_ac.class.php" );
19
- include_once( "default-settings.php" );
20
- require_once( "actions.php" );
21
- // Add a new interval of 5 minutes
22
- add_filter( 'cron_schedules', 'woocommerce_ac_add_cron_schedule' );
23
-
24
- function woocommerce_ac_add_cron_schedule( $schedules ) {
25
-
26
- $schedules['5_minutes'] = array(
27
- 'interval' => 300 , // 5 minutes in seconds
28
- 'display' => __( 'Once Every Five Minutes' ),
29
- );
30
- return $schedules;
31
- }
32
-
33
- // Schedule an action if it's not already scheduled
34
- if ( ! wp_next_scheduled( 'woocommerce_ac_send_email_action' ) ) {
35
- wp_schedule_event( time(), '5_minutes', 'woocommerce_ac_send_email_action' );
36
- }
37
-
38
- // Hook into that action that'll fire every 5 minutes
39
- add_action( 'woocommerce_ac_send_email_action', 'woocommerce_ac_send_email_cron' );
40
- function woocommerce_ac_send_email_cron() {
41
- //require_once( ABSPATH.'wp-content/plugins/woocommerce-abandoned-cart/cron/send_email.php' );
42
- $plugin_dir_path = plugin_dir_path( __FILE__ );
43
- require_once( $plugin_dir_path . 'cron/send_email.php' );
44
- }
45
-
46
- function woocommerce_ac_delete(){
47
-
48
- global $wpdb;
49
- $table_name_ac_abandoned_cart_history = $wpdb->prefix . "ac_abandoned_cart_history_lite";
50
- $sql_ac_abandoned_cart_history = "DROP TABLE " . $table_name_ac_abandoned_cart_history ;
51
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
52
- $wpdb->get_results( $sql_ac_abandoned_cart_history );
53
-
54
- $table_name_ac_email_templates = $wpdb->prefix . "ac_email_templates_lite";
55
- $sql_ac_email_templates = "DROP TABLE " . $table_name_ac_email_templates ;
56
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
57
- $wpdb->get_results( $sql_ac_email_templates );
58
-
59
- $table_name_ac_sent_history = $wpdb->prefix . "ac_sent_history_lite";
60
- $sql_ac_sent_history = "DROP TABLE " . $table_name_ac_sent_history ;
61
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
62
- $wpdb->get_results( $sql_ac_sent_history );
63
-
64
- $table_name_ac_guest_abandoned_cart_history = $wpdb->prefix . "ac_guest_abandoned_cart_history_lite";
65
- $sql_ac_abandoned_cart_history = "DROP TABLE " . $table_name_ac_guest_abandoned_cart_history ;
66
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
67
- $wpdb->get_results( $sql_ac_abandoned_cart_history );
68
-
69
- $sql_table_user_meta_cart = "DELETE FROM `" . $wpdb->prefix . "usermeta` WHERE meta_key = '_woocommerce_persistent_cart'";
70
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
71
- $wpdb->get_results( $sql_table_user_meta_cart );
72
-
73
- $sql_table_user_meta_cart_modified = "DELETE FROM `" . $wpdb->prefix . "usermeta` WHERE meta_key = '_woocommerce_ac_modified_cart'";
74
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
75
- $wpdb->get_results( $sql_table_user_meta_cart_modified );
76
-
77
- $query = "SELECT blog_id FROM `".$wpdb->prefix."blogs`";
78
- $results = $wpdb->get_results( $query );
79
-
80
-
81
-
82
- foreach( $results as $key => $value ) {
83
-
84
- $table_name_ac_abandoned_cart_history = $wpdb->prefix .$value->blog_id."_"."ac_abandoned_cart_history_lite";
85
- $sql_ac_abandoned_cart_history = "DROP TABLE " . $table_name_ac_abandoned_cart_history ;
86
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
87
- $wpdb->get_results( $sql_ac_abandoned_cart_history );
88
-
89
- $table_name_ac_email_templates = $wpdb->prefix .$value->blog_id."_"."ac_email_templates_lite";
90
- $sql_ac_email_templates = "DROP TABLE " . $table_name_ac_email_templates ;
91
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
92
- $wpdb->get_results( $sql_ac_email_templates );
93
-
94
- $table_name_ac_sent_history = $wpdb->prefix .$value->blog_id."_"."ac_sent_history_lite";
95
- $sql_ac_sent_history = "DROP TABLE " . $table_name_ac_sent_history ;
96
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
97
- $wpdb->get_results( $sql_ac_sent_history );
98
-
99
- $table_name_ac_guest_abandoned_cart_history = $wpdb->prefix . "ac_guest_abandoned_cart_history_lite";
100
- $sql_ac_abandoned_cart_history = "DROP TABLE " . $table_name_ac_guest_abandoned_cart_history ;
101
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
102
- $wpdb->get_results( $sql_ac_abandoned_cart_history );
103
-
104
- $sql_table_user_meta_cart = "DELETE FROM `" . $wpdb->prefix.$value->blog_id."_"."usermeta` WHERE meta_key = '_woocommerce_persistent_cart'";
105
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
106
- $wpdb->get_results( $sql_table_user_meta_cart );
107
-
108
- $sql_table_user_meta_cart_modified = "DELETE FROM `" . $wpdb->prefix.$value->blog_id."_"."usermeta` WHERE meta_key = '_woocommerce_ac_modified_cart'";
109
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
110
- $wpdb->get_results( $sql_table_user_meta_cart_modified );
111
-
112
- }
113
-
114
- delete_option ( 'woocommerce_ac_email_body' );
115
- delete_option( 'ac_lite_cart_abandoned_time' );
116
- delete_option( 'ac_lite_email_admin_on_recovery' );
117
- delete_option( 'ac_lite_settings_status' );
118
- delete_option( 'woocommerce_ac_default_templates_installed' );
119
-
120
-
121
- }
122
- /**
123
- * woocommerce_abandon_cart class
124
- **/
125
- if ( !class_exists( 'woocommerce_abandon_cart' ) ) {
126
-
127
- class woocommerce_abandon_cart {
128
-
129
- var $one_hour;
130
- var $three_hours;
131
- var $six_hours;
132
- var $twelve_hours;
133
- var $one_day;
134
- var $one_week;
135
-
136
- var $duration_range_select = array();
137
- var $start_end_dates = array();
138
-
139
- public function __construct() {
140
-
141
- $this->one_hour = 60 * 60;
142
- $this->three_hours = 3 * $this->one_hour;
143
- $this->six_hours = 6 * $this->one_hour;
144
- $this->twelve_hours = 12 * $this->one_hour;
145
- $this->one_day = 24 * $this->one_hour;
146
- $this->one_week = 7 * $this->one_day;
147
-
148
- $this->duration_range_select = array( 'yesterday' => 'Yesterday',
149
- 'today' => 'Today',
150
- 'last_seven' => 'Last 7 days',
151
- 'last_fifteen' => 'Last 15 days',
152
- 'last_thirty' => 'Last 30 days',
153
- 'last_ninety' => 'Last 90 days',
154
- 'last_year_days' => 'Last 365'
155
- );
156
-
157
- $this->start_end_dates = array( 'yesterday' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 24*60*60 ) ),
158
- 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) - 7*24*60*60 ) ) ),
159
- 'today' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ),
160
- 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
161
- 'last_seven' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 7*24*60*60 ) ),
162
- 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
163
- 'last_fifteen' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 15*24*60*60 ) ),
164
- 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
165
- 'last_thirty' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 30*24*60*60 ) ),
166
- 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
167
- 'last_ninety' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 90*24*60*60 ) ),
168
- 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
169
- 'last_year_days' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 365*24*60*60 ) ),
170
- 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) )
171
- );
172
-
173
-
174
- // Initialize settings
175
- register_activation_hook ( __FILE__, array( &$this, 'woocommerce_ac_activate' ) );
176
-
177
- // WordPress Administration Menu
178
- add_action ( 'admin_menu', array( &$this, 'woocommerce_ac_admin_menu' ) );
179
-
180
- // Actions to be done on cart update
181
- add_action ( 'woocommerce_cart_updated', array( &$this, 'woocommerce_ac_store_cart_timestamp' ) );
182
-
183
- // delete added temp fields after order is placed
184
- add_filter ( 'woocommerce_order_details_after_order_table', array( &$this, 'action_after_delivery_session' ) );
185
-
186
- add_action ( 'admin_init', array( &$this, 'action_admin_init' ) );
187
-
188
- // Update the options as per settings API
189
- add_action ( 'admin_init', array( &$this, 'ac_lite_update_db_check' ) );
190
-
191
- // Wordpress settings API
192
- add_action( 'admin_init', array( &$this, 'ac_lite_initialize_plugin_options' ) );
193
-
194
- // Language Translation
195
- add_action ( 'init', array( &$this, 'update_po_file' ) );
196
-
197
- // track links
198
- add_filter( 'template_include', array( &$this, 'email_track_links_lite' ), 99, 1 );
199
-
200
- //Discount Coupon Notice
201
- add_action ( 'admin_notices', array( &$this, 'ac_lite_coupon_notice' ) );
202
-
203
- add_action ( 'admin_enqueue_scripts', array( &$this, 'my_enqueue_scripts_js' ) );
204
- add_action ( 'admin_enqueue_scripts', array( &$this, 'my_enqueue_scripts_css' ) );
205
-
206
- if ( is_admin() ) {
207
- // Load "admin-only" scripts here
208
- add_action ( 'admin_head', array( &$this, 'my_action_javascript' ) );
209
- add_action ( 'wp_ajax_remove_cart_data', array( &$this, 'remove_cart_data' ) );
210
-
211
- add_action ( 'admin_head', array( &$this, 'my_action_send_preview' ) );
212
- add_action ( 'wp_ajax_preview_email_sent', array( &$this, 'preview_email_sent' ) );
213
-
214
- }
215
-
216
- // Send Email on order recovery
217
- add_action('woocommerce_order_status_pending_to_processing_notification', array(&$this, 'ac_email_admin_recovery'));
218
- add_action('woocommerce_order_status_pending_to_completed_notification', array(&$this, 'ac_email_admin_recovery'));
219
- add_action('woocommerce_order_status_pending_to_on-hold_notification', array(&$this, 'ac_email_admin_recovery'));
220
- add_action('woocommerce_order_status_failed_to_processing_notification', array(&$this, 'ac_email_admin_recovery'));
221
- add_action('woocommerce_order_status_failed_to_completed_notification', array(&$this, 'ac_email_admin_recovery'));
222
- add_action( 'admin_init', array( $this, 'wcap_preview_emails' ) );
223
- add_action('init', array( $this, 'app_output_buffer') );
224
- }
225
-
226
- /*-----------------------------------------------------------------------------------*/
227
- /* Class Functions */
228
- /*-----------------------------------------------------------------------------------*/
229
- /**
230
- * Preview email template
231
- *
232
- * @return string
233
- */
234
- public function wcap_preview_emails() {
235
-
236
- global $woocommerce;
237
-
238
- if ( isset( $_GET['wacp_preview_woocommerce_mail'] ) ) {
239
- if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-ac') ) {
240
- die( 'Security check' );
241
- }
242
-
243
- $message = '';
244
- // create a new email
245
-
246
- if ( $woocommerce->version < '2.3' ) {
247
- global $email_heading;
248
-
249
- ob_start();
250
-
251
- include( 'views/wacp-wc-email-template-preview.php' );
252
-
253
- $mailer = WC()->mailer();
254
- $message = ob_get_clean();
255
- $email_heading = __( 'HTML Email Template', 'woocommerce' );
256
-
257
- $message = $mailer->wrap_message( $email_heading, $message );
258
- }else{
259
-
260
- // load the mailer class
261
- $mailer = WC()->mailer();
262
-
263
- // get the preview email subject
264
- $email_heading = __( 'Abandoned cart Email Template', 'woocommerce-ac' );
265
-
266
- // get the preview email content
267
- ob_start();
268
- include( 'views/wacp-wc-email-template-preview.php' );
269
- $message = ob_get_clean();
270
-
271
- // create a new email
272
- $email = new WC_Email();
273
-
274
- // wrap the content with the email template and then add styles
275
- $message = $email->style_inline( $mailer->wrap_message( $email_heading, $message ) );
276
- }
277
-
278
- echo $message;
279
- exit;
280
- }
281
-
282
- if ( isset( $_GET['wacp_preview_mail'] ) ) {
283
- if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-ac') ) {
284
- die( 'Security check' );
285
- }
286
-
287
- // get the preview email content
288
- ob_start();
289
- include( 'views/wacp-email-template-preview.php' );
290
- $message = ob_get_clean();
291
-
292
- // print the preview email
293
- echo $message;
294
- exit;
295
- }
296
- }
297
- // Language Translation
298
- function update_po_file() {
299
- $domain = 'woocommerce-ac';
300
- $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
301
- if ( $loaded = load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '-' . $locale . '.mo' ) ) {
302
- return $loaded;
303
- } else {
304
- load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
305
- }
306
- }
307
-
308
- function ac_lite_coupon_notice() {
309
-
310
- if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == "woocommerce_ac_page" ) {
311
- ?>
312
- <div class = "updated">
313
- <p><?php _e( 'You can upgrade to the <a href = "https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/">PRO version of WooCommerce Abandoned Cart plugin</a> at a <b>20% discount</b>. Use the coupon code: <b>ACPRO20</b>.<a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/"> Purchase now </a> & save $24!', 'woocommerce-ac' ); ?></p>
314
- </div>
315
- <?php
316
- }
317
- }
318
- /*-----------------------------------------------------------------------------------*/
319
- /* Class Functions */
320
- /*-----------------------------------------------------------------------------------*/
321
-
322
- function woocommerce_ac_activate() {
323
-
324
- global $wpdb;
325
-
326
- $table_name = $wpdb->prefix . "ac_email_templates_lite";
327
-
328
- $sql = "CREATE TABLE IF NOT EXISTS $table_name (
329
- `id` int(11) NOT NULL AUTO_INCREMENT,
330
- `subject` text COLLATE utf8_unicode_ci NOT NULL,
331
- `body` mediumtext COLLATE utf8_unicode_ci NOT NULL,
332
- `is_active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL,
333
- `frequency` int(11) NOT NULL,
334
- `day_or_hour` enum('Days','Hours') COLLATE utf8_unicode_ci NOT NULL,
335
- `template_name` text COLLATE utf8_unicode_ci NOT NULL,
336
- `from_name` text COLLATE utf8_unicode_ci NOT NULL,
337
- PRIMARY KEY (`id`)
338
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ";
339
-
340
- require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
341
- dbDelta( $sql );
342
-
343
-
344
- $table_name = $wpdb->prefix . "ac_email_templates_lite";
345
- $check_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'is_wc_template' ";
346
- $results = $wpdb->get_results( $check_template_table_query );
347
-
348
- if ( count( $results ) == 0 ) {
349
- $alter_template_table_query = "ALTER TABLE $table_name
350
- ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8_unicode_ci NOT NULL AFTER `from_name`,
351
- ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
352
-
353
- $wpdb->get_results( $alter_template_table_query );
354
- }
355
- $table_name = $wpdb->prefix . "ac_email_templates_lite";
356
- $check_email_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'reply_email' ";
357
- $results_email = $wpdb->get_results( $check_email_template_table_query );
358
-
359
- if ( count( $results_email ) == 0 ) {
360
- $alter_email_template_table_query = "ALTER TABLE $table_name
361
- ADD COLUMN `reply_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `default_template`,
362
- ADD COLUMN `from_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `reply_email`";
363
- $wpdb->get_results( $alter_email_template_table_query );
364
- }
365
-
366
- $sent_table_name = $wpdb->prefix . "ac_sent_history_lite";
367
-
368
- $sql_query = "CREATE TABLE IF NOT EXISTS $sent_table_name (
369
- `id` int(11) NOT NULL auto_increment,
370
- `template_id` varchar(40) collate utf8_unicode_ci NOT NULL,
371
- `abandoned_order_id` int(11) NOT NULL,
372
- `sent_time` datetime NOT NULL,
373
- `sent_email_id` text COLLATE utf8_unicode_ci NOT NULL,
374
- PRIMARY KEY (`id`)
375
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ";
376
-
377
- require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
378
- dbDelta ( $sql_query );
379
-
380
- $ac_history_table_name = $wpdb->prefix . "ac_abandoned_cart_history_lite";
381
-
382
- $history_query = "CREATE TABLE IF NOT EXISTS $ac_history_table_name (
383
- `id` int(11) NOT NULL AUTO_INCREMENT,
384
- `user_id` int(11) NOT NULL,
385
- `abandoned_cart_info` text COLLATE utf8_unicode_ci NOT NULL,
386
- `abandoned_cart_time` int(11) NOT NULL,
387
- `cart_ignored` enum('0','1') COLLATE utf8_unicode_ci NOT NULL,
388
- `recovered_cart` int(11) NOT NULL,
389
- PRIMARY KEY (`id`)
390
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
391
-
392
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
393
- dbDelta( $history_query );
394
-
395
- // Default templates: function call to create default templates.
396
- $check_table_empty = $wpdb->get_var( "SELECT COUNT(*) FROM `" . $wpdb->prefix . "ac_email_templates_lite`" );
397
-
398
- if( !get_option( 'woocommerce_ac_default_templates_installed' ) ) {
399
-
400
- if( 0 == $check_table_empty ) {
401
- $default_template = new default_template_settings;
402
- $default_template->create_default_templates();
403
- update_option( 'woocommerce_ac_default_templates_installed', "yes" );
404
- }
405
- }
406
- }
407
-
408
-
409
- /***************************************************************
410
- * WP Settings API
411
- **************************************************************/
412
- function ac_lite_initialize_plugin_options() {
413
- // First, we register a section. This is necessary since all future options must belong to a
414
- add_settings_section(
415
- 'ac_lite_general_settings_section', // ID used to identify this section and with which to register options
416
- __( 'Settings', 'woocommerce-ac' ), // Title to be displayed on the administration page
417
- array($this, 'ac_lite_general_options_callback' ), // Callback used to render the description of the section
418
- 'woocommerce_ac_page' // Page on which to add this section of options
419
- );
420
-
421
- add_settings_field(
422
- 'ac_lite_cart_abandoned_time',
423
- __( 'Cart abandoned cut-off time', 'woocommerce-ac' ),
424
- array( $this, 'ac_lite_cart_abandoned_time_callback' ),
425
- 'woocommerce_ac_page',
426
- 'ac_lite_general_settings_section',
427
- array( __( 'Consider cart abandoned after X minutes of item being added to cart & order not placed.', 'woocommerce-ac' ) )
428
- );
429
-
430
- add_settings_field(
431
- 'ac_lite_email_admin_on_recovery',
432
- __( 'Email admin On Order Recovery', 'woocommerce-ac' ),
433
- array( $this, 'ac_lite_email_admin_on_recovery' ),
434
- 'woocommerce_ac_page',
435
- 'ac_lite_general_settings_section',
436
- array( __( 'Sends email to Admin if an Abandoned Cart Order is recovered.', 'woocommerce-ac' ) )
437
- );
438
-
439
- // Finally, we register the fields with WordPress
440
- register_setting(
441
- 'woocommerce_ac_settings',
442
- 'ac_lite_cart_abandoned_time',
443
- array ( $this, 'ac_lite_cart_time_validation' )
444
- );
445
-
446
- register_setting(
447
- 'woocommerce_ac_settings',
448
- 'ac_lite_email_admin_on_recovery'
449
- );
450
-
451
- }
452
-
453
- /***************************************************************
454
- * WP Settings API callback for section
455
- **************************************************************/
456
- function ac_lite_general_options_callback() {
457
-
458
- }
459
-
460
- /***************************************************************
461
- * WP Settings API callback for cart time field
462
- **************************************************************/
463
- function ac_lite_cart_abandoned_time_callback($args) {
464
-
465
- // First, we read the option
466
- $cart_abandoned_time = get_option( 'ac_lite_cart_abandoned_time' );
467
-
468
- // Next, we update the name attribute to access this element's ID in the context of the display options array
469
- // We also access the show_header element of the options collection in the call to the checked() helper function
470
- printf(
471
- '<input type="text" id="ac_lite_cart_abandoned_time" name="ac_lite_cart_abandoned_time" value="%s" />',
472
- isset( $cart_abandoned_time ) ? esc_attr( $cart_abandoned_time ) : ''
473
- );
474
-
475
- // Here, we'll take the first argument of the array and add it to a label next to the checkbox
476
- $html = '<label for="ac_lite_cart_abandoned_time"> ' . $args[0] . '</label>';
477
- echo $html;
478
- }
479
-
480
- /***************************************************************
481
- * WP Settings API cart time field validation
482
- **************************************************************/
483
- function ac_lite_cart_time_validation( $input ) {
484
- $output = '';
485
- if ( $input == '' || is_numeric( $input) ) {
486
- $output = stripslashes( $input) ;
487
- } else {
488
- add_settings_error( 'ac_lite_cart_abandoned_time', 'error found', __( 'Abandoned cart cut off time should be numeric.', 'woocommerce-ac' ) );
489
- }
490
- return $output;
491
- }
492
-
493
- /***************************************************************
494
- * WP Settings API callback for email admin on cart recovery field
495
- **************************************************************/
496
- function ac_lite_email_admin_on_recovery( $args ) {
497
-
498
- // First, we read the option
499
- $email_admin_on_recovery = get_option( 'ac_lite_email_admin_on_recovery' );
500
-
501
- // This condition added to avoid the notie displyed while Check box is unchecked.
502
- if ( isset( $email_admin_on_recovery ) && $email_admin_on_recovery == '' ) {
503
- $email_admin_on_recovery = 'off';
504
- }
505
-
506
- // Next, we update the name attribute to access this element's ID in the context of the display options array
507
- // We also access the show_header element of the options collection in the call to the checked() helper function
508
- $html='';
509
- printf(
510
- '<input type="checkbox" id="ac_lite_email_admin_on_recovery" name="ac_lite_email_admin_on_recovery" value="on"
511
- ' . checked('on', $email_admin_on_recovery, false).' />'
512
- );
513
-
514
- // Here, we'll take the first argument of the array and add it to a label next to the checkbox
515
- $html .= '<label for="ac_lite_email_admin_on_recovery"> ' . $args[0] . '</label>';
516
- echo $html;
517
- }
518
-
519
- /**************************************************
520
- * This function is run when the plugin is upgraded
521
- *************************************************/
522
-
523
- function ac_lite_update_db_check() {
524
- global $wpdb;
525
-
526
- if( get_option( 'ac_lite_delete_alter_table_queries' ) != 'yes' ) {
527
- update_option( 'ac_lite_alter_table_queries', '' );
528
- update_option( 'ac_lite_delete_alter_table_queries', 'yes' );
529
- }
530
- if( get_option( 'ac_lite_alter_table_queries' ) != 'yes' ) {
531
- if( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "ac_email_templates'" ) === $wpdb->prefix . 'ac_email_templates' ) {
532
- $old_table_name = $wpdb->prefix . "ac_email_templates";
533
- $table_name = $wpdb->prefix . "ac_email_templates_lite";
534
-
535
- $alter_ac_email_table_query = "ALTER TABLE $old_table_name
536
- RENAME TO $table_name";
537
- $wpdb->get_results ( $alter_ac_email_table_query );
538
-
539
- }
540
-
541
- if( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "ac_sent_history'" ) === $wpdb->prefix . 'ac_sent_history' ) {
542
- $old_sent_table_name = $wpdb->prefix . "ac_sent_history";
543
- $sent_table_name = $wpdb->prefix . "ac_sent_history_lite";
544
- $alter_ac_sent_history_table_query = "ALTER TABLE $old_sent_table_name
545
- RENAME TO $sent_table_name";
546
- $wpdb->get_results ( $alter_ac_sent_history_table_query );
547
- }
548
-
549
- if( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "ac_abandoned_cart_history'" ) === $wpdb->prefix . 'ac_abandoned_cart_history' ) {
550
- $old_ac_history_table_name = $wpdb->prefix . "ac_abandoned_cart_history";
551
- $ac_history_table_name = $wpdb->prefix . "ac_abandoned_cart_history_lite";
552
-
553
- $alter_ac_abandoned_cart_history_table_query = "ALTER TABLE $old_ac_history_table_name
554
- RENAME TO $ac_history_table_name";
555
- $wpdb->get_results ( $alter_ac_abandoned_cart_history_table_query );
556
- }
557
-
558
- update_option( 'ac_lite_alter_table_queries', 'yes' );
559
- }
560
-
561
- $ac_history_table_name = $wpdb->prefix."ac_abandoned_cart_history_lite";
562
- $check_table_query = "SHOW COLUMNS FROM $ac_history_table_name LIKE 'user_type'";
563
- $results = $wpdb->get_results( $check_table_query );
564
-
565
- if ( count( $results ) == 0 ) {
566
- $alter_table_query = "ALTER TABLE $ac_history_table_name ADD `user_type` text AFTER `recovered_cart`";
567
- $wpdb->get_results( $alter_table_query );
568
- }
569
-
570
- $table_name = $wpdb->prefix . "ac_email_templates_lite";
571
- $check_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'is_wc_template' ";
572
- $results = $wpdb->get_results( $check_template_table_query );
573
-
574
- if ( count( $results ) == 0 ) {
575
- $alter_template_table_query = "ALTER TABLE $table_name
576
- ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8_unicode_ci NOT NULL AFTER `from_name`,
577
- ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
578
- $wpdb->get_results( $alter_template_table_query );
579
- }
580
- $table_name = $wpdb->prefix . "ac_email_templates_lite";
581
- $check_email_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'reply_email' ";
582
- $results_email = $wpdb->get_results( $check_email_template_table_query );
583
-
584
- if ( count( $results_email ) == 0 ) {
585
- $alter_email_template_table_query = "ALTER TABLE $table_name
586
- ADD COLUMN `reply_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `default_template`,
587
- ADD COLUMN `from_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `reply_email`";
588
- $wpdb->get_results( $alter_email_template_table_query );
589
- }
590
- $guest_table = $wpdb->prefix."ac_guest_abandoned_cart_history_lite" ;
591
- $query_guest_table = "SHOW TABLES LIKE '$guest_table' ";
592
- $result_guest_table = $wpdb->get_results( $query_guest_table );
593
-
594
- if ( count( $result_guest_table ) == 0 ) {
595
-
596
- $ac_guest_history_table_name = $wpdb->prefix . "ac_guest_abandoned_cart_history_lite";
597
- $ac_guest_history_query = "CREATE TABLE IF NOT EXISTS $ac_guest_history_table_name (
598
- `id` int(15) NOT NULL AUTO_INCREMENT,
599
- `billing_first_name` text,
600
- `billing_last_name` text,
601
- `billing_company_name` text,
602
- `billing_address_1` text,
603
- `billing_address_2` text,
604
- `billing_city` text,
605
- `billing_county` text,
606
- `billing_zipcode` text,
607
- `email_id` text,
608
- `phone` text,
609
- `ship_to_billing` text,
610
- `order_notes` text,
611
- `shipping_first_name` text,
612
- `shipping_last_name` text,
613
- `shipping_company_name` text,
614
- `shipping_address_1` text,
615
- `shipping_address_2` text,
616
- `shipping_city` text,
617
- `shipping_county` text,
618
- `shipping_zipcode` double,
619
- `shipping_charges` double,
620
- PRIMARY KEY (`id`)
621
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=63000000";
622
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
623
- $wpdb->query( $ac_guest_history_query );
624
- }
625
-
626
- //get the option, if it is not set to individual then convert to individual records and delete the base record
627
- $ac_settings = get_option( 'ac_lite_settings_status' );
628
- if ( $ac_settings != 'INDIVIDUAL' ) {
629
- //fetch the existing settings and save them as inidividual to be used for the settings API
630
- $woocommerce_ac_settings = json_decode( get_option( 'woocommerce_ac_settings' ) );
631
- if( isset($woocommerce_ac_settings[0]->cart_time) ){
632
- add_option( 'ac_lite_cart_abandoned_time', $woocommerce_ac_settings[0]->cart_time );
633
- }else{
634
- add_option( 'ac_lite_cart_abandoned_time', '60' );
635
- }
636
-
637
- if( isset($woocommerce_ac_settings[0]->email_admin) ){
638
- add_option( 'ac_lite_email_admin_on_recovery', $woocommerce_ac_settings[0]->email_admin );
639
- }else{
640
- add_option( 'ac_lite_email_admin_on_recovery', "" );
641
- }
642
-
643
- update_option( 'ac_lite_settings_status', 'INDIVIDUAL' );
644
- //Delete the main settings record
645
- delete_option( 'woocommerce_ac_settings' );
646
- }
647
-
648
- }
649
-
650
- /******
651
- * Send email to admin when cart is recover.
652
- * @since 2.3 version
653
- */
654
-
655
- function ac_email_admin_recovery ($order_id) {
656
-
657
- $user_id = get_current_user_id();
658
-
659
- $ac_email_admin_recovery = get_option( 'ac_lite_email_admin_on_recovery' );
660
-
661
- if( $ac_email_admin_recovery == 'on' ){
662
- if ( get_user_meta($user_id, '_woocommerce_ac_modified_cart', true) == md5("yes") || get_user_meta($user_id, '_woocommerce_ac_modified_cart', true) == md5("no") ){ // indicates cart is abandoned
663
- $order = new WC_Order( $order_id );
664
-
665
- $email_heading = __('New Customer Order - Recovered', 'woocommerce-ac');
666
-
667
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
668
-
669
- $email_subject = "New Customer Order - Recovered";
670
-
671
- $user_email = get_option('admin_email');
672
- $headers[] = "From: Admin <".$user_email.">";
673
- $headers[] = "Content-Type: text/html";
674
-
675
- // Buffer
676
- ob_start();
677
-
678
- // Get mail template
679
- woocommerce_get_template('emails/admin-new-order.php', array(
680
- 'order' => $order,
681
- 'email_heading' => $email_heading,
682
- 'sent_to_admin' => false,
683
- 'plain_text' => false
684
- ));
685
-
686
- // Get contents
687
- $email_body = ob_get_clean();
688
-
689
- //$email_body .= "Recovered Order";
690
- woocommerce_mail( $user_email, $email_subject, $email_body, $headers );
691
- }
692
- }
693
-
694
- }
695
-
696
- function woocommerce_ac_admin_menu() {
697
-
698
- $page = add_submenu_page ( 'woocommerce', __( 'Abandoned Carts', 'woocommerce-ac' ), __( 'Abandoned Carts', 'woocommerce-ac' ), 'manage_woocommerce', 'woocommerce_ac_page', array( &$this, 'woocommerce_ac_page' ) );
699
-
700
- }
701
-
702
- function woocommerce_ac_store_cart_timestamp() {
703
-
704
- global $wpdb,$woocommerce;
705
-
706
- $current_time = current_time( 'timestamp' );
707
- $cut_off_time = get_option( 'ac_lite_cart_abandoned_time' );
708
-
709
- $cart_ignored = 0;
710
- $recovered_cart = 0;
711
-
712
- if( isset( $cut_off_time ) ) {
713
- $cart_cut_off_time = $cut_off_time * 60;
714
- } else {
715
- $cart_cut_off_time = 60 * 60;
716
- }
717
-
718
- $compare_time = $current_time - $cart_cut_off_time;
719
-
720
- if ( is_user_logged_in() ) {
721
-
722
- $user_id = get_current_user_id();
723
- $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
724
- WHERE user_id = %d
725
- AND cart_ignored = %s
726
- AND recovered_cart = %d ";
727
- $results = $wpdb->get_results($wpdb->prepare( $query, $user_id, $cart_ignored, $recovered_cart ) );
728
-
729
- if ( count($results) == 0 ) {
730
-
731
- $cart_info = json_encode( get_user_meta( $user_id, '_woocommerce_persistent_cart', true ) );
732
- $user_type = "REGISTERED";
733
- $insert_query = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
734
- ( user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type )
735
- VALUES ( %d, %s, %d, %s, %s )";
736
- $wpdb->query( $wpdb->prepare( $insert_query, $user_id, $cart_info,$current_time, $cart_ignored, $user_type ) );
737
- }
738
- elseif ( isset( $results[0]->abandoned_cart_time ) && $compare_time > $results[0]->abandoned_cart_time ) {
739
-
740
- $updated_cart_info = json_encode( get_user_meta( $user_id, '_woocommerce_persistent_cart', true ) );
741
-
742
- if ( ! $this->compare_carts( $user_id, $results[0]->abandoned_cart_info ) ) {
743
-
744
- $updated_cart_ignored = 1;
745
- $query_ignored = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
746
- SET cart_ignored = %s
747
- WHERE user_id = %d ";
748
- $wpdb->query( $wpdb->prepare( $query_ignored, $updated_cart_ignored, $user_id ) );
749
-
750
- $user_type = "REGISTERED";
751
-
752
- $query_update = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
753
- (user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type)
754
- VALUES (%d, %s, %d, %s, %s)";
755
- $wpdb->query( $wpdb->prepare( $query_update, $user_id, $updated_cart_info, $current_time, $cart_ignored, $user_type ) );
756
-
757
- update_user_meta ( $user_id, '_woocommerce_ac_modified_cart', md5( "yes" ) );
758
- } else {
759
- update_user_meta ( $user_id, '_woocommerce_ac_modified_cart', md5( "no" ) );
760
- }
761
- } else {
762
- $updated_cart_info = json_encode( get_user_meta( $user_id, '_woocommerce_persistent_cart', true ) );
763
-
764
- $query_update = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
765
- SET abandoned_cart_info = %s,
766
- abandoned_cart_time = %d
767
- WHERE user_id = %d
768
- AND cart_ignored = %s ";
769
- $wpdb->query( $wpdb->prepare( $query_update, $updated_cart_info, $current_time, $user_id, $cart_ignored ) );
770
- }
771
- } else{ //start here guest user
772
-
773
- if ( isset( $_SESSION['user_id'] ) ) $user_id = $_SESSION['user_id'];
774
- else $user_id = "";
775
-
776
- $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id = %d AND cart_ignored = '0' AND recovered_cart = '0'";
777
- $results = $wpdb->get_results( $wpdb->prepare( $query, $user_id ) );
778
- $cart = array();
779
-
780
- foreach ( $woocommerce->cart->cart_contents as $cart_id => $value ) {
781
- $cart['cart'][$cart_id] = array();
782
-
783
- foreach ( $value as $k=>$v ) {
784
- $cart['cart'][$cart_id][$k] = $v;
785
-
786
- if ( $k == "quantity" ) {
787
- $price = get_post_meta( $cart['cart'][$cart_id]['product_id'], '_price', true );
788
- $cart['cart'][$cart_id]['line_total'] = $cart['cart'][$cart_id]['quantity'] * $price;
789
- $cart['cart'][$cart_id]['line_tax'] = '0';
790
- $cart['cart'][$cart_id]['line_subtotal'] = $cart['cart'][$cart_id]['line_total'];
791
- $cart['cart'][$cart_id]['line_subtotal_tax'] = $cart['cart'][$cart_id]['line_tax'];
792
- break;
793
- }
794
- }
795
- }
796
- $updated_cart_info = json_encode($cart);
797
-
798
- if ( $results ) {
799
-
800
- if ( $compare_time > $results[0]->abandoned_cart_time ) {
801
-
802
- if ( $updated_cart_info != $results[0]->abandoned_cart_info ) {
803
- $query_ignored = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite` SET cart_ignored = '1' WHERE user_id ='".$user_id."'";
804
-
805
- $wpdb->query( $query_ignored );
806
- $user_type = 'GUEST';
807
-
808
- $query_update = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
809
- (user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type)
810
- VALUES (%d, %s, %d, %s, %s)";
811
- $wpdb->query( $wpdb->prepare( $query_update, $user_id, $updated_cart_info, $current_time, $cart_ignored, $user_type ) );
812
-
813
-
814
- $wpdb->query( $query_update );
815
- update_user_meta( $user_id, '_woocommerce_ac_modified_cart', md5("yes") );
816
- } else {
817
- update_user_meta( $user_id, '_woocommerce_ac_modified_cart', md5("no") );
818
- }
819
- } else {
820
- $query_update = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite` SET abandoned_cart_info = '".$updated_cart_info."', abandoned_cart_time = '".$current_time."' WHERE user_id='".$user_id."' AND cart_ignored='0' ";
821
- $wpdb->query( $query_update );
822
- }
823
- }
824
- }
825
-
826
-
827
- }
828
-
829
- function decrypt_validate( $validate ) {
830
- $cryptKey = 'qJB0rGtIn5UB1xG03efyCp';
831
- $validate_decoded = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), base64_decode( $validate ), MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ), "\0");
832
- return( $validate_decoded );
833
- }
834
-
835
- function email_track_links_lite( $template ) {
836
- global $woocommerce;
837
- $track_link = '';
838
-
839
- if ( isset( $_GET['wacp_action'] ) ) $track_link = $_GET['wacp_action'];
840
-
841
- if ( $track_link == 'track_links' ) {
842
- global $wpdb;
843
-
844
- $validate_server_string = rawurldecode ( $_SERVER["QUERY_STRING"] );
845
- $validate_server_string = str_replace ( " " , "+", $validate_server_string);
846
-
847
- $validate_server_arr = explode("validate=", $validate_server_string);
848
- $validate_encoded_string = end($validate_server_arr);
849
-
850
- $link_decode_test = base64_decode( $validate_encoded_string );
851
-
852
- if ( preg_match( '/&url=/', $link_decode_test ) ){ // it will check if any old email have open the link
853
- $link_decode = $link_decode_test;
854
- }else{
855
- $link_decode = $this->decrypt_validate( $validate_encoded_string );
856
- }
857
- $sent_email_id_pos = strpos( $link_decode, '&' );
858
- $email_sent_id = substr( $link_decode , 0, $sent_email_id_pos );
859
- $_SESSION[ 'email_sent_id' ] = $email_sent_id;
860
- $url_pos = strpos( $link_decode, '=' );
861
- $url_pos = $url_pos + 1;
862
- $url = substr( $link_decode, $url_pos );
863
- $get_ac_id_query = "SELECT abandoned_order_id FROM `".$wpdb->prefix."ac_sent_history_lite` WHERE id = %d";
864
- $get_ac_id_results = $wpdb->get_results( $wpdb->prepare( $get_ac_id_query, $email_sent_id ) );
865
- $get_user_id_query = "SELECT user_id FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE id = %d";
866
- $get_user_results = $wpdb->get_results( $wpdb->prepare( $get_user_id_query, $get_ac_id_results[0]->abandoned_order_id ) );
867
- $user_id = 0;
868
-
869
- if ( isset( $get_user_results ) && count( $get_user_results ) > 0 ) {
870
- $user_id = $get_user_results[0]->user_id;
871
- }
872
-
873
- if ( $user_id == 0 ) {
874
- echo "Link expired";
875
- exit;
876
- }
877
- $user = wp_set_current_user( $user_id );
878
-
879
-
880
-
881
- if ( $user_id >= "63000000" ) {
882
- $query_guest = "SELECT * from `". $wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = %d";
883
- $results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $user_id ) );
884
- $query_cart = "SELECT recovered_cart FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id = %d";
885
- $results = $wpdb->get_results( $wpdb->prepare( $query_cart, $user_id ) );
886
-
887
- if ( $results_guest && $results[0]->recovered_cart == '0' ) {
888
- $_SESSION[ 'guest_first_name' ] = $results_guest[0]->billing_first_name;
889
- $_SESSION[ 'guest_last_name' ] = $results_guest[0]->billing_last_name;
890
- $_SESSION[ 'guest_email' ] = $results_guest[0]->email_id;
891
- $_SESSION[ 'user_id' ] = $user_id;
892
- } else {
893
- wp_redirect( get_permalink( woocommerce_get_page_id( 'shop' ) ) );
894
- }
895
- }
896
-
897
- if ( $user_id < "63000000" ) {
898
- $user_login = $user->data->user_login;
899
- wp_set_auth_cookie( $user_id );
900
- $my_temp = woocommerce_load_persistent_cart( $user_login, $user );
901
- do_action( 'wp_login', $user_login, $user );
902
-
903
- if ( isset( $sign_in ) && is_wp_error( $sign_in ) ) {
904
- echo $sign_in->get_error_message();
905
- exit;
906
- }
907
- } else
908
- $my_temp = $this->woocommerce_load_guest_persistent_cart( $user_id );
909
-
910
- if ( $email_sent_id > 0 && is_numeric( $email_sent_id ) ) {
911
-
912
- header( "Location: $url" );
913
- }
914
- } else
915
- return $template;
916
- }
917
-
918
- function woocommerce_load_guest_persistent_cart() {
919
- global $woocommerce;
920
-
921
-
922
- $saved_cart = json_decode( get_user_meta( $_SESSION['user_id'], '_woocommerce_persistent_cart',true ), true );
923
-
924
- $c = array();
925
- $cart_contents_total = $cart_contents_weight = $cart_contents_count = $cart_contents_tax = $total = $subtotal = $subtotal_ex_tax = $tax_total = 0;
926
-
927
- foreach ( $saved_cart as $key => $value ) {
928
-
929
- foreach ( $value as $a => $b ) {
930
- $c['product_id'] = $b['product_id'];
931
- $c['variation_id'] = $b['variation_id'];
932
- $c['variation'] = $b['variation'];
933
- $c['quantity'] = $b['quantity'];
934
- $product_id = $b['product_id'];
935
- $c['data'] = get_product($product_id);
936
- $c['line_total'] = $b['line_total'];
937
- $c['line_tax'] = $cart_contents_tax;
938
- $c['line_subtotal'] = $b['line_subtotal'];
939
- $c['line_subtotal_tax'] = $cart_contents_tax;
940
- $value_new[$a] = $c;
941
- $cart_contents_total = $b['line_subtotal'] + $cart_contents_total;
942
- $cart_contents_count = $cart_contents_count + $b['quantity'];
943
- $total = $total + $b['line_total'];
944
- $subtotal = $subtotal + $b['line_subtotal'];
945
- $subtotal_ex_tax = $subtotal_ex_tax + $b['line_subtotal'];
946
- }
947
- $saved_cart_data[$key] = $value_new;
948
- $woocommerce_cart_hash = $a;
949
- }
950
-
951
- if ( $saved_cart ) {
952
-
953
- if ( empty( $woocommerce->session->cart ) || ! is_array( $woocommerce->session->cart ) || sizeof( $woocommerce->session->cart ) == 0 ) {
954
- $woocommerce->session->cart = $saved_cart['cart'];
955
- $woocommerce->session->cart_contents_total = $cart_contents_total;
956
- $woocommerce->session->cart_contents_weight = $cart_contents_weight;
957
- $woocommerce->session->cart_contents_count = $cart_contents_count;
958
- $woocommerce->session->cart_contents_tax = $cart_contents_tax;
959
- $woocommerce->session->total = $total;
960
- $woocommerce->session->subtotal = $subtotal;
961
- $woocommerce->session->subtotal_ex_tax = $subtotal_ex_tax;
962
- $woocommerce->session->tax_total = $tax_total;
963
- $woocommerce->session->shipping_taxes = array();
964
- $woocommerce->session->taxes = array();
965
- $woocommerce->session->ac_customer = array();
966
- $woocommerce->cart->cart_contents = $saved_cart_data['cart'];
967
- $woocommerce->cart->cart_contents_total = $cart_contents_total;
968
- $woocommerce->cart->cart_contents_weight = $cart_contents_weight;
969
- $woocommerce->cart->cart_contents_count = $cart_contents_count;
970
- $woocommerce->cart->cart_contents_tax = $cart_contents_tax;
971
- $woocommerce->cart->total = $total;
972
- $woocommerce->cart->subtotal = $subtotal;
973
- $woocommerce->cart->subtotal_ex_tax = $subtotal_ex_tax;
974
- $woocommerce->cart->tax_total = $tax_total;
975
- }
976
- }
977
- }
978
-
979
-
980
- function compare_carts( $user_id, $last_abandoned_cart )
981
- {
982
- $current_woo_cart = get_user_meta( $user_id, '_woocommerce_persistent_cart', true );
983
- $abandoned_cart_arr = json_decode( $last_abandoned_cart, true );
984
-
985
- $temp_variable = "";
986
- if ( count( $current_woo_cart['cart'] ) >= count( $abandoned_cart_arr['cart'] ) ) {
987
- //do nothing
988
- } else {
989
- $temp_variable = $current_woo_cart;
990
- $current_woo_cart = $abandoned_cart_arr;
991
- $abandoned_cart_arr = $temp_variable;
992
- }
993
- foreach ( $current_woo_cart as $key => $value )
994
- {
995
- foreach ( $value as $item_key => $item_value )
996
- {
997
- $current_cart_product_id = $item_value['product_id'];
998
- $current_cart_variation_id = $item_value['variation_id'];
999
- $current_cart_quantity = $item_value['quantity'];
1000
-
1001
- if ( isset( $abandoned_cart_arr[ $key ][ $item_key ][ 'product_id' ] ) ) {
1002
- $abandoned_cart_product_id = $abandoned_cart_arr[$key][$item_key]['product_id'];
1003
- } else {
1004
- $abandoned_cart_product_id = "";
1005
- }
1006
- if ( isset( $abandoned_cart_arr[$key][$item_key]['variation_id'] ) ) {
1007
- $abandoned_cart_variation_id = $abandoned_cart_arr[$key][$item_key]['variation_id'];
1008
- } else {
1009
- $abandoned_cart_variation_id = "";
1010
- }
1011
- if ( isset( $abandoned_cart_arr[$key][$item_key]['quantity'] ) ) {
1012
- $abandoned_cart_quantity = $abandoned_cart_arr[$key][$item_key]['quantity'];
1013
- } else {
1014
- $abandoned_cart_quantity = "";
1015
- }
1016
- if ( ( $current_cart_product_id != $abandoned_cart_product_id ) ||
1017
- ( $current_cart_variation_id != $abandoned_cart_variation_id ) ||
1018
- ( $current_cart_quantity != $abandoned_cart_quantity ) )
1019
- {
1020
- return false;
1021
- }
1022
- }
1023
- }
1024
- return true;
1025
- }
1026
-
1027
- function action_after_delivery_session( $order ) {
1028
-
1029
- global $wpdb;
1030
- $user_id = get_current_user_id();
1031
- $sent_email = '';
1032
- if ( isset( $_SESSION[ 'email_sent_id' ] ) ){
1033
- $sent_email = $_SESSION[ 'email_sent_id' ];
1034
- }
1035
- if ( $user_id == "" ) {
1036
- $user_id = $_SESSION['user_id'];
1037
- // Set the session variables to blanks
1038
- $_SESSION['guest_first_name'] = $_SESSION['guest_last_name'] = $_SESSION['guest_email'] = $_SESSION['user_id'] = "";
1039
- }
1040
-
1041
- delete_user_meta( $user_id, '_woocommerce_ac_persistent_cart_time' );
1042
- delete_user_meta( $user_id, '_woocommerce_ac_persistent_cart_temp_time' );
1043
-
1044
- // get all latest abandoned carts that were modified
1045
-
1046
- $cart_ignored = 0;
1047
- $recovered_cart = 0;
1048
- $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1049
- WHERE user_id = %d
1050
- AND cart_ignored = %s
1051
- AND recovered_cart = %d
1052
- ORDER BY id DESC
1053
- LIMIT 1";
1054
- $results = $wpdb->get_results( $wpdb->prepare( $query, $user_id, $cart_ignored, $recovered_cart ) );
1055
- if ( count( $results ) > 0 ) {
1056
- if ( get_user_meta( $user_id, '_woocommerce_ac_modified_cart', true ) == md5( "yes" ) ||
1057
- get_user_meta( $user_id, '_woocommerce_ac_modified_cart', true ) == md5( "no" ) )
1058
- {
1059
- $order_id = $order->id;
1060
-
1061
- $updated_cart_ignored = 1;
1062
- $query_order = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1063
- SET recovered_cart = %d,
1064
- cart_ignored = %s
1065
- WHERE id = %d ";
1066
- $wpdb->query( $wpdb->prepare( $query_order, $order_id, $updated_cart_ignored, $results[0]->id ) );
1067
- delete_user_meta( $user_id, '_woocommerce_ac_modified_cart' );
1068
- } else {
1069
- $delete_query = "DELETE FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1070
- WHERE
1071
- id= %d ";
1072
- $wpdb->query( $wpdb->prepare( $delete_query, $results[0]->id ) );
1073
- }
1074
- }else {
1075
- $email_id = $order->billing_email;
1076
- $query = "SELECT * FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE email_id = %s";
1077
- $results_id = $wpdb->get_results( $wpdb->prepare( $query, $email_id ) );
1078
-
1079
- if ( $results_id ) {
1080
- $record_status = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id = %d AND recovered_cart = '0'";
1081
- $results_status = $wpdb->get_results( $wpdb->prepare( $record_status, $results_id[0]->id ) );
1082
-
1083
- if ( $results_status ) {
1084
-
1085
- if ( get_user_meta( $results_id[0]->id, '_woocommerce_ac_modified_cart', true ) == md5("yes") ||
1086
- get_user_meta( $results_id[0]->id, '_woocommerce_ac_modified_cart', true ) == md5("no") ) {
1087
-
1088
- $order_id = $order->id;
1089
- $query_order = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite` SET recovered_cart= '".$order_id."', cart_ignored = '1' WHERE id='".$results_status[0]->id."' ";
1090
- $wpdb->query( $query_order );
1091
- delete_user_meta( $results_id[0]->id, '_woocommerce_ac_modified_cart' );
1092
-
1093
- $sent_email = $_SESSION[ 'email_sent_id' ];
1094
- $recover_order = "UPDATE `".$wpdb->prefix."ac_sent_history` SET recovered_order = '1'
1095
- WHERE id ='".$sent_email."' ";
1096
- $wpdb->query( $recover_order );
1097
- } else {
1098
- $delete_guest = "DELETE FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = '".$results_id[0]->id."'";
1099
- $wpdb->query( $delete_guest );
1100
-
1101
- $delete_query = "DELETE FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id='".$results_id[0]->id."' ";
1102
- $wpdb->query( $delete_query );
1103
- }
1104
- }
1105
- }
1106
- }
1107
- }
1108
-
1109
- function action_admin_init() {
1110
- global $typenow;
1111
- // only hook up these filters if we're in the admin panel, and the current user has permission
1112
- // to edit posts and pages
1113
- if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) {
1114
- return;
1115
- }
1116
-
1117
- if ( !isset( $_GET['page'] ) || $_GET['page'] != "woocommerce_ac_page" ) {
1118
- return;
1119
- }
1120
-
1121
- if ( get_user_option( 'rich_editing' ) == 'true' ) {
1122
- remove_filter( 'the_excerpt', 'wpautop' );
1123
- add_filter('tiny_mce_before_init', array( &$this, 'myformatTinyMCE_ac'));
1124
- add_filter( 'mce_buttons', array( &$this, 'filter_mce_button' ) );
1125
- add_filter( 'mce_external_plugins', array( &$this, 'filter_mce_plugin' ) );
1126
- }
1127
- }
1128
-
1129
- function filter_mce_button( $buttons ) {
1130
- // add a separation before our button, here our button's id is &quot;mygallery_button&quot;
1131
- array_push( $buttons, 'abandoncart', '|' );
1132
- return $buttons;
1133
- }
1134
-
1135
- function filter_mce_plugin( $plugins ) {
1136
- // this plugin file will work the magic of our button
1137
- $plugins['abandoncart'] = plugin_dir_url( __FILE__ ) . 'js/abandoncart_plugin_button.js';
1138
- return $plugins;
1139
- }
1140
-
1141
- function display_tabs() {
1142
-
1143
- if ( isset( $_GET[ 'action' ] ) ) {
1144
- $action = $_GET[ 'action' ];
1145
- } else {
1146
- $action = "";
1147
- $active_listcart = "";
1148
- $active_emailtemplates = "";
1149
- $active_settings = "";
1150
- $active_stats = "";
1151
- }
1152
- if ( ( $action == 'listcart' || $action == 'orderdetails' ) || $action == '' ) {
1153
- $active_listcart = "nav-tab-active";
1154
- }
1155
- if ( $action == 'emailtemplates' ) {
1156
- $active_emailtemplates = "nav-tab-active";
1157
- }
1158
- if ( $action == 'emailsettings' ) {
1159
- $active_settings = "nav-tab-active";
1160
- }
1161
- if ( $action == 'stats' ) {
1162
- $active_stats = "nav-tab-active";
1163
- }
1164
- if ( $action == 'report' ) {
1165
- $active_report = "nav-tab-active";
1166
- }
1167
-
1168
- ?>
1169
-
1170
- <div style="background-image: url('<?php echo plugins_url(); ?>/woocommerce-abandoned-cart/images/ac_tab_icon.png') !important;" class="icon32"><br></div>
1171
-
1172
- <h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
1173
- <a href="admin.php?page=woocommerce_ac_page&action=listcart" class="nav-tab <?php if (isset($active_listcart)) echo $active_listcart; ?>"> <?php _e( 'Abandoned Orders', 'woocommerce-ac' );?> </a>
1174
- <a href="admin.php?page=woocommerce_ac_page&action=emailtemplates" class="nav-tab <?php if (isset($active_emailtemplates)) echo $active_emailtemplates; ?>"> <?php _e( 'Email Templates', 'woocommerce-ac' );?> </a>
1175
- <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-ac' );?> </a>
1176
- <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-ac' );?> </a>
1177
- <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-ac' );?> </a>
1178
- </h2>
1179
-
1180
- <?php
1181
- }
1182
-
1183
- function my_enqueue_scripts_js( $hook ) {
1184
-
1185
- if ( $hook != 'woocommerce_page_woocommerce_ac_page' ) {
1186
- return;
1187
- } else {
1188
- wp_enqueue_script( 'jquery' );
1189
- wp_enqueue_script(
1190
- 'jquery-ui-min',
1191
- '//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js',
1192
- '',
1193
- '',
1194
- false
1195
- );
1196
- wp_enqueue_script( 'jquery-ui-datepicker' );
1197
-
1198
- wp_enqueue_script(
1199
- 'jquery-tip',
1200
- plugins_url( '/js/jquery.tipTip.minified.js', __FILE__ ),
1201
- '',
1202
- '',
1203
- false
1204
- );
1205
- wp_register_script( 'woocommerce_admin', plugins_url() . '/woocommerce/assets/js/admin/woocommerce_admin.js', array( 'jquery', 'jquery-ui-widget', 'jquery-ui-core' ) );
1206
- wp_enqueue_script( 'woocommerce_admin' );
1207
-
1208
- ?>
1209
- <script type="text/javascript" >
1210
- function delete_email_template( id )
1211
- {
1212
- var y=confirm( 'Are you sure you want to delete this Email Template' );
1213
- if( y==true ) {
1214
- location.href='admin.php?page=woocommerce_ac_page&action=emailtemplates&mode=removetemplate&id='+id;
1215
- }
1216
- }
1217
-
1218
- function activate_email_template( template_id, active_state ) {
1219
-
1220
- location.href = 'admin.php?page=woocommerce_ac_page&action=emailtemplates&mode=activate_template&id='+template_id+'&active_state='+active_state ;
1221
- }
1222
- </script>
1223
-
1224
- <?php
1225
- $js_src = includes_url('js/tinymce/') . 'tinymce.min.js';
1226
-
1227
- wp_enqueue_script( 'tinyMce_ac',$js_src );
1228
- wp_enqueue_script( 'ac_email_variables', plugins_url() . '/woocommerce-abandoned-cart/js/abandoncart_plugin_button.js' );
1229
-
1230
- }
1231
-
1232
- }
1233
-
1234
- function myformatTinyMCE_ac( $in ) {
1235
-
1236
- $in['force_root_block'] = false;
1237
- $in['valid_children'] = '+body[style]';
1238
- $in['remove_linebreaks'] = false;
1239
- $in['gecko_spellcheck'] = false;
1240
- $in['keep_styles'] = true;
1241
- $in['accessibility_focus'] = true;
1242
- $in['tabfocus_elements'] = 'major-publishing-actions';
1243
- $in['media_strict'] = false;
1244
- $in['paste_remove_styles'] = false;
1245
- $in['paste_remove_spans'] = false;
1246
- $in['paste_strip_class_attributes'] = 'none';
1247
- $in['paste_text_use_dialog'] = true;
1248
- $in['wpeditimage_disable_captions'] = true;
1249
- $in['wpautop'] = false;
1250
- $in['apply_source_formatting'] = true;
1251
- $in['cleanup'] = true;
1252
- $in['convert_newlines_to_brs'] = FALSE;
1253
- $in['fullpage_default_xml_pi'] = false;
1254
- $in['convert_urls'] = false;
1255
- // Do not remove redundant BR tags
1256
- $in['remove_redundant_brs'] = false;
1257
-
1258
- return $in;
1259
- }
1260
-
1261
- function my_enqueue_scripts_css( $hook ) {
1262
-
1263
- if ( $hook != 'woocommerce_page_woocommerce_ac_page' ) {
1264
- return;
1265
- } else {
1266
- wp_enqueue_style( 'jquery-ui', "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" , '', '', false );
1267
- wp_enqueue_style( 'woocommerce_admin_styles', plugins_url() . '/woocommerce/assets/css/admin.css' );
1268
- wp_enqueue_style( 'jquery-ui-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' );
1269
- wp_enqueue_style( 'abandoned-orders-list', plugins_url() . '/woocommerce-abandoned-cart/css/view.abadoned.orders.style.css' );
1270
-
1271
- }
1272
- }
1273
-
1274
- //bulk action
1275
- // to over come the wp redirect warning while deleting
1276
- function app_output_buffer() {
1277
- ob_start();
1278
- }
1279
-
1280
- /**
1281
- * Abandon Cart Settings Page
1282
- */
1283
- function woocommerce_ac_page()
1284
- {
1285
- if ( is_user_logged_in() ) {
1286
- global $wpdb;
1287
-
1288
- // Check the user capabilities
1289
- if ( !current_user_can( 'manage_woocommerce' ) ) {
1290
- wp_die( __( 'You do not have sufficient permissions to access this page.', 'woocommerce-ac' ) );
1291
- }
1292
- ?>
1293
-
1294
- <div class="wrap">
1295
- <div class="icon32" style="background-image: url('<?php echo plugins_url(); ?>/woocommerce-abandoned-cart/images/abandoned_cart_small.png') !important;">
1296
- <br />
1297
- </div>
1298
- <h2><?php _e( 'WooCommerce - Abandon Cart Lite', 'woocommerce-ac' ); ?></h2>
1299
- <?php
1300
-
1301
- if ( isset( $_GET[ 'action' ] ) ) {
1302
- $action = $_GET[ 'action' ];
1303
- } else {
1304
- $action = "";
1305
- }
1306
- if ( isset( $_GET[ 'mode' ] ) ) {
1307
- $mode = $_GET[ 'mode' ];
1308
- } else {
1309
- $mode = "";
1310
- }
1311
-
1312
- $this->display_tabs();
1313
- /**
1314
- * When we delete the item from the below drop down it is registred in action 2
1315
- */
1316
- if ( isset( $_GET['action2'] ) ) $action_two = $_GET['action2'];
1317
- else $action_two = "";
1318
-
1319
- // Detect when a bulk action is being triggered on abadoned orders page.
1320
- if( 'wcap_delete' === $action || 'wcap_delete' === $action_two ){
1321
-
1322
- $ids = isset( $_GET['abandoned_order_id'] ) ? $_GET['abandoned_order_id'] : false;
1323
- if ( ! is_array( $ids ) ){
1324
- $ids = array( $ids );
1325
- }
1326
-
1327
- foreach ( $ids as $id ) {
1328
- $class = new wcap_delete_bulk_action_handler();
1329
- $class->wcap_delete_bulk_action_handler_function_lite( $id );
1330
- }
1331
- }
1332
-
1333
- //Detect when a bulk action is being triggered on temnplates page.
1334
- if( 'wcap_delete_template' === $action || 'wcap_delete_template' === $action_two ){
1335
-
1336
- $ids = isset( $_GET['template_id'] ) ? $_GET['template_id'] : false;
1337
-
1338
- if ( ! is_array( $ids ) ){
1339
- $ids = array( $ids );
1340
- }
1341
-
1342
- foreach ( $ids as $id ) {
1343
- $class = new wcap_delete_bulk_action_handler();
1344
- $class->wcap_delete_template_bulk_action_handler_function_lite( $id );
1345
- }
1346
- }
1347
-
1348
- if ( isset($_GET ['wcap_deleted']) && 'YES' == $_GET['wcap_deleted'] ) { ?>
1349
- <div id="message" class="updated fade"><p><strong><?php _e( 'The Abadoned cart has been successfully deleted.', 'woocommerce-ac' ); ?></strong></p></div>
1350
- <?php }
1351
-
1352
- if ( isset($_GET ['wcap_template_deleted']) && 'YES' == $_GET['wcap_template_deleted'] ) { ?>
1353
- <div id="message" class="updated fade"><p><strong><?php _e( 'The Template has been successfully deleted.', 'woocommerce-ac' ); ?></strong></p></div>
1354
- <?php }
1355
-
1356
- if ( $action == 'emailsettings' ) {
1357
- // Save the field values
1358
- ?>
1359
- <p><?php _e( 'Change settings for sending email notifications to Customers after X minute.', 'woocommerce-ac' ); ?></p>
1360
- <div id="content">
1361
-
1362
- <form method="post" action="options.php">
1363
- <?php settings_fields( 'woocommerce_ac_settings' ); ?>
1364
- <?php do_settings_sections( 'woocommerce_ac_page' ); ?>
1365
- <?php settings_errors(); ?>
1366
- <?php submit_button(); ?>
1367
-
1368
- </form>
1369
- </div>
1370
- <?php
1371
- } elseif ( $action == 'listcart' || $action == '' ) {
1372
- ?>
1373
-
1374
- <p> <?php _e( 'The list below shows all Abandoned Carts which have remained in cart for a time higher than the "Cart abandoned cut-off time" setting.', 'woocommerce-ac' );?> </p>
1375
-
1376
- <?php
1377
- global $wpdb;
1378
-
1379
- include_once('class-abandoned-orders-table.php');
1380
- $wcap_abandoned_order_list = new WACP_Abandoned_Orders_Table();
1381
- $wcap_abandoned_order_list->wcap_abadoned_order_prepare_items();
1382
- ?>
1383
- <div class="wrap">
1384
- <form id="wacp-abandoned-orders" method="get" >
1385
- <input type="hidden" name="page" value="woocommerce_ac_page" />
1386
- <?php $wcap_abandoned_order_list->display(); ?>
1387
- </form>
1388
- </div>
1389
-
1390
- <?php
1391
- } elseif ( $action == 'emailtemplates' && ( $mode != 'edittemplate' && $mode != 'addnewtemplate' ) ) {
1392
- ?>
1393
- <p> <?php _e( 'Add email templates at different intervals to maximize the possibility of recovering your abandoned carts.', 'woocommerce-ac' );?> </p>
1394
- <?php
1395
-
1396
- // Save the field values
1397
- $insert_template_successfuly = $update_template_successfuly = '';
1398
- if ( isset( $_POST[ 'ac_settings_frm' ] ) && $_POST[ 'ac_settings_frm' ] == 'save' ) {
1399
-
1400
-
1401
- $active_post = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1402
- $is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
1403
-
1404
- if ( $active_post == 1 ) {
1405
-
1406
- $is_active = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1407
- $email_frequency = trim( $_POST[ 'email_frequency' ] );
1408
- $day_or_hour = trim( $_POST[ 'day_or_hour' ] );
1409
-
1410
- $check_query = "SELECT * FROM `".$wpdb->prefix."ac_email_templates_lite`
1411
- WHERE is_active = %s
1412
- AND frequency = %d
1413
- AND day_or_hour = %s ";
1414
- $check_results = $wpdb->get_results( $wpdb->prepare( $check_query, $is_active, $email_frequency, $day_or_hour ) );
1415
-
1416
- $default_value = 0 ;
1417
-
1418
-
1419
- if ( count( $check_results ) == 0 ) {
1420
-
1421
-
1422
- $active_post = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1423
- $woocommerce_ac_email_subject = trim( $_POST[ 'woocommerce_ac_email_subject' ] );
1424
- $woocommerce_ac_email_body = trim( $_POST[ 'woocommerce_ac_email_body' ] );
1425
- $woocommerce_ac_template_name = trim( $_POST[ 'woocommerce_ac_template_name' ] );
1426
- $woocommerce_ac_from_name = trim( $_POST[ 'woocommerce_ac_from_name' ] );
1427
- $woocommerce_ac_email_reply = trim( $_POST['woocommerce_ac_email_reply'] );
1428
- $woocommerce_ac_email_from = trim( $_POST[ 'woocommerce_ac_email_from' ] );
1429
-
1430
- $query = "INSERT INTO `".$wpdb->prefix."ac_email_templates_lite`
1431
- (subject, body, is_active, frequency, day_or_hour, template_name, from_name, is_wc_template, default_template, reply_email, from_email )
1432
- VALUES ( %s, %s, %s, %d, %s, %s, %s, %s, %d, %s, %s )"; //It is fix
1433
-
1434
- $insert_template_successfuly = $wpdb->query( $wpdb->prepare( $query,
1435
- $woocommerce_ac_email_subject,
1436
- $woocommerce_ac_email_body,
1437
- $active_post,
1438
- $email_frequency,
1439
- $day_or_hour,
1440
- $woocommerce_ac_template_name,
1441
- $woocommerce_ac_from_name,
1442
- $is_wc_template,
1443
- $default_value,
1444
- $woocommerce_ac_email_reply,
1445
- $woocommerce_ac_email_from)
1446
- );
1447
-
1448
- }
1449
- else {
1450
-
1451
- $update_is_active = 0;
1452
- $query_update = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1453
- SET
1454
- is_active = %s
1455
- WHERE frequency = %d
1456
- AND day_or_hour = %s ";
1457
- $update_template_successfuly = $wpdb->query($wpdb->prepare( $query_update, $update_is_active, $email_frequency, $day_or_hour ) );
1458
-
1459
-
1460
- $woocommerce_ac_email_subject = trim( $_POST[ 'woocommerce_ac_email_subject' ] );
1461
- $woocommerce_ac_email_body = trim( $_POST[ 'woocommerce_ac_email_body' ] );
1462
- $woocommerce_ac_template_name = trim( $_POST[ 'woocommerce_ac_template_name' ] );
1463
- $woocommerce_ac_from_name = trim( $_POST[ 'woocommerce_ac_from_name' ] );
1464
- $woocommerce_ac_email_from = trim( $_POST['woocommerce_ac_email_from'] );
1465
- $woocommerce_ac_email_reply = trim( $_POST[ 'woocommerce_ac_email_reply' ] );
1466
-
1467
- $query_insert_new = "INSERT INTO `".$wpdb->prefix."ac_email_templates_lite`
1468
- (subject, body, is_active, frequency, day_or_hour, template_name, from_name, is_wc_template, default_template, reply_email, from_email )
1469
- VALUES ( %s, %s, %s, %d, %s, %s, %s, %s, %d, %s, %s )";
1470
-
1471
- $insert_template_successfuly = $wpdb->query( $wpdb->prepare( $query_insert_new,
1472
- $woocommerce_ac_email_subject,
1473
- $woocommerce_ac_email_body,
1474
- $active_post,
1475
- $email_frequency,
1476
- $day_or_hour,
1477
- $woocommerce_ac_template_name,
1478
- $woocommerce_ac_from_name,
1479
- $is_wc_template,
1480
- $woocommerce_ac_email_reply,
1481
- $woocommerce_ac_email_from )
1482
- );
1483
- }
1484
- }else{
1485
-
1486
-
1487
- $woocommerce_ac_email_subject = trim( $_POST[ 'woocommerce_ac_email_subject' ] );
1488
- $woocommerce_ac_email_body = trim( $_POST[ 'woocommerce_ac_email_body' ] );
1489
- $woocommerce_ac_template_name = trim( $_POST[ 'woocommerce_ac_template_name' ] );
1490
- $woocommerce_ac_from_name = trim( $_POST[ 'woocommerce_ac_from_name' ] );
1491
- $woocommerce_ac_email_reply = trim( $_POST[ 'woocommerce_ac_email_reply' ] );
1492
- $woocommerce_ac_email_from = trim( $_POST['woocommerce_ac_email_from'] );
1493
-
1494
- $active_post = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1495
- $email_frequency = trim( $_POST[ 'email_frequency' ] );
1496
- $day_or_hour = trim( $_POST[ 'day_or_hour' ] );
1497
- $is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
1498
- $default_value = 0 ;
1499
-
1500
-
1501
- $query = "INSERT INTO `".$wpdb->prefix."ac_email_templates_lite`
1502
- (subject, body, is_active, frequency, day_or_hour, template_name, from_name, is_wc_template, default_template, reply_email, from_email )
1503
- VALUES ( %s, %s, %s, %d, %s, %s, %s, %s, %d, %s, %s )";
1504
-
1505
- $insert_template_successfuly = $wpdb->query( $wpdb->prepare( $query,
1506
- $woocommerce_ac_email_subject,
1507
- $woocommerce_ac_email_body,
1508
- $active_post,
1509
- $email_frequency,
1510
- $day_or_hour,
1511
- $woocommerce_ac_template_name,
1512
- $woocommerce_ac_from_name,
1513
- $is_wc_template,
1514
- $default_value,
1515
- $woocommerce_ac_email_reply,
1516
- $woocommerce_ac_email_from )
1517
- );
1518
-
1519
- }
1520
- }
1521
-
1522
- if ( isset( $_POST[ 'ac_settings_frm' ] ) && $_POST[ 'ac_settings_frm' ] == 'update' )
1523
- {
1524
-
1525
- $active = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1526
- $is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
1527
- if ( $active == 1 )
1528
- {
1529
- $is_active = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1530
- $email_frequency = trim( $_POST[ 'email_frequency' ] );
1531
- $day_or_hour = trim( $_POST[ 'day_or_hour' ] );
1532
- $check_query = "SELECT * FROM `".$wpdb->prefix."ac_email_templates_lite`
1533
- WHERE is_active= %s
1534
- AND frequency = %d
1535
- AND day_or_hour= %s ";
1536
- $check_results = $wpdb->get_results( $wpdb->prepare( $check_query, $is_active, $email_frequency, $day_or_hour ) );
1537
-
1538
- $default_value = '';
1539
- foreach($check_results as $result_key => $result_value) {
1540
- $default_value = ( empty( $result_value->default_template ) ) ? 0 : $result_value->default_template;
1541
-
1542
- }
1543
-
1544
- if (count($check_results) == 0 )
1545
- {
1546
-
1547
- $woocommerce_ac_email_subject = trim( $_POST[ 'woocommerce_ac_email_subject' ] );
1548
- $woocommerce_ac_email_body = trim( $_POST[ 'woocommerce_ac_email_body' ] );
1549
- $woocommerce_ac_template_name = trim( $_POST[ 'woocommerce_ac_template_name' ] );
1550
- $woocommerce_ac_from_name = trim( $_POST[ 'woocommerce_ac_from_name' ] );
1551
- $woocommerce_ac_email_from = trim( $_POST['woocommerce_ac_email_from'] );
1552
- $woocommerce_ac_email_reply = trim( $_POST[ 'woocommerce_ac_email_reply' ] );
1553
- $id = trim( $_POST[ 'id' ] );
1554
-
1555
- $query_update = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1556
- SET
1557
- subject = %s,
1558
- body = %s,
1559
- is_active = %s,
1560
- frequency = %d,
1561
- day_or_hour = %s,
1562
- template_name = %s,
1563
- from_name = %s,
1564
- is_wc_template = %s,
1565
- default_template = %d,
1566
- reply_email = %s,
1567
- from_email = %s
1568
- WHERE id = %d ";
1569
- $update_template_successfuly = $wpdb->query($wpdb->prepare( $query_update,
1570
- $woocommerce_ac_email_subject,
1571
- $woocommerce_ac_email_body,
1572
- $active,
1573
- $email_frequency,
1574
- $day_or_hour,
1575
- $woocommerce_ac_template_name,
1576
- $woocommerce_ac_from_name,
1577
- $is_wc_template,
1578
- $default_value,
1579
- $woocommerce_ac_email_from,
1580
- $woocommerce_ac_email_reply,
1581
- $id )
1582
-
1583
- );
1584
- }
1585
- else {
1586
-
1587
- $updated_is_active = 0;
1588
- $query_update_new = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1589
- SET is_active = %s
1590
- WHERE frequency = %d
1591
- AND day_or_hour = %s ";
1592
- $update_template_successfuly = $wpdb->query( $wpdb->prepare( $query_update_new, $updated_is_active, $email_frequency, $day_or_hour ) );
1593
-
1594
- $woocommerce_ac_email_subject = trim( $_POST[ 'woocommerce_ac_email_subject' ] );
1595
- $woocommerce_ac_email_body = trim( $_POST[ 'woocommerce_ac_email_body' ] );
1596
- $woocommerce_ac_template_name = trim( $_POST[ 'woocommerce_ac_template_name' ] );
1597
- $woocommerce_ac_from_name = trim( $_POST[ 'woocommerce_ac_from_name' ] );
1598
- $woocommerce_ac_email_from = trim( $_POST['woocommerce_ac_email_from'] );
1599
- $woocommerce_ac_email_reply = trim( $_POST[ 'woocommerce_ac_email_reply' ] );
1600
- $id = trim( $_POST[ 'id' ] );
1601
-
1602
- $query_update_latest = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1603
- SET
1604
- subject = %s,
1605
- body = %s,
1606
- is_active = %s,
1607
- frequency = %d,
1608
- day_or_hour = %s,
1609
- template_name = %s,
1610
- from_name = %s,
1611
- is_wc_template = %s,
1612
- default_template = %d,
1613
- reply_email = %s,
1614
- from_email = %s
1615
- WHERE id = %d ";
1616
- $update_template_successfuly = $wpdb->query($wpdb->prepare( $query_update_latest,
1617
- $woocommerce_ac_email_subject,
1618
- $woocommerce_ac_email_body,
1619
- $active,
1620
- $email_frequency,
1621
- $day_or_hour,
1622
- $woocommerce_ac_template_name,
1623
- $woocommerce_ac_from_name,
1624
- $is_wc_template,
1625
- $default_value,
1626
- $woocommerce_ac_email_reply,
1627
- $woocommerce_ac_email_from,
1628
- $id )
1629
-
1630
- );
1631
-
1632
- }
1633
- }else{
1634
-
1635
- $updated_is_active = '0';
1636
- $is_active = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1637
- $email_frequency = trim( $_POST[ 'email_frequency' ] );
1638
- $day_or_hour = trim( $_POST[ 'day_or_hour' ] );
1639
- $is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
1640
-
1641
- $query_update_new = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1642
- SET is_active = %s
1643
- WHERE frequency = %d
1644
- AND day_or_hour = %s ";
1645
- $wpdb->query( $wpdb->prepare( $query_update_new, $updated_is_active, $email_frequency, $day_or_hour ) );
1646
-
1647
- $woocommerce_ac_email_subject = trim( $_POST[ 'woocommerce_ac_email_subject' ] );
1648
- $woocommerce_ac_email_body = trim( $_POST[ 'woocommerce_ac_email_body' ] );
1649
- $woocommerce_ac_template_name = trim( $_POST[ 'woocommerce_ac_template_name' ] );
1650
- $woocommerce_ac_from_name = trim( $_POST[ 'woocommerce_ac_from_name' ] );
1651
- $woocommerce_ac_email_from = trim( $_POST['woocommerce_ac_email_from'] );
1652
- $woocommerce_ac_email_reply = trim( $_POST[ 'woocommerce_ac_email_reply' ] );
1653
- $id = trim( $_POST[ 'id' ] );
1654
-
1655
-
1656
- $check_query = "SELECT * FROM `".$wpdb->prefix."ac_email_templates_lite`
1657
- WHERE is_active= %s
1658
- AND frequency = %d
1659
- AND day_or_hour= %s ";
1660
- $check_results = $wpdb->get_results( $wpdb->prepare( $check_query, $is_active, $email_frequency, $day_or_hour ) );
1661
-
1662
- $default_value = '';
1663
- foreach($check_results as $result_key => $result_value) {
1664
- $default_value = ( empty( $result_value->default_template ) ) ? 0 : $result_value->default_template;
1665
-
1666
- }
1667
-
1668
- $query_update_latest = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1669
- SET
1670
- subject = %s,
1671
- body = %s,
1672
- is_active = %s,
1673
- frequency = %d,
1674
- day_or_hour = %s,
1675
- template_name = %s,
1676
- from_name = %s,
1677
- is_wc_template = %s,
1678
- default_template = %d,
1679
- reply_email = %s,
1680
- from_email = %s
1681
- WHERE id = %d ";
1682
-
1683
- $update_template_successfuly = $wpdb->query($wpdb->prepare( $query_update_latest,
1684
- $woocommerce_ac_email_subject,
1685
- $woocommerce_ac_email_body,
1686
- $is_active,
1687
- $email_frequency,
1688
- $day_or_hour,
1689
- $woocommerce_ac_template_name,
1690
- $woocommerce_ac_from_name,
1691
- $is_wc_template,
1692
- $default_value,
1693
- $woocommerce_ac_email_reply,
1694
- $woocommerce_ac_email_from,
1695
- $id )
1696
-
1697
- );
1698
-
1699
- }
1700
- }
1701
-
1702
- if ( $action == 'emailtemplates' && $mode == 'removetemplate' ){
1703
- $id_remove = $_GET[ 'id' ];
1704
-
1705
- $query_remove = "DELETE FROM `".$wpdb->prefix."ac_email_templates_lite` WHERE id= %d ";
1706
- $wpdb->query( $wpdb->prepare( $query_remove, $id_remove ) );
1707
- }
1708
-
1709
- if ( $action == 'emailtemplates' && $mode == 'activate_template' ) {
1710
- $template_id = $_GET['id'];
1711
- $current_template_status = $_GET['active_state'];
1712
-
1713
- if( "1" == $current_template_status ) {
1714
- $active = "0";
1715
- } else {
1716
- $active = "1";
1717
- }
1718
- $query_update = "UPDATE `" . $wpdb->prefix . "ac_email_templates_lite`
1719
- SET
1720
- is_active = '" . $active . "'
1721
- WHERE id = '" . $template_id . "' ";
1722
- $wpdb->query( $query_update );
1723
-
1724
- wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&action=emailtemplates' ) );
1725
- }
1726
-
1727
- if ( isset( $_POST[ 'ac_settings_frm' ] ) && $_POST[ 'ac_settings_frm' ] == 'save' && (isset($insert_template_successfuly) && $insert_template_successfuly != '')) { ?>
1728
- <div id="message" class="updated fade"><p><strong><?php _e( 'The Email Template has been successfully added.', 'woocommerce-ac' ); ?></strong></p></div>
1729
- <?php } else if ( isset( $_POST[ 'ac_settings_frm' ] ) && $_POST[ 'ac_settings_frm' ] == 'save' && (isset($insert_template_successfuly) && $insert_template_successfuly == '')){
1730
- ?>
1731
- <div id="message" class="error fade"><p><strong><?php _e( ' There was a problem adding the email template. Please contact the plugin author via <a href= "https://wordpress.org/support/plugin/woocommerce-abandoned-cart">support forum</a>.', 'woocommerce-ac' ); ?></strong></p></div>
1732
- <?php
1733
- }
1734
-
1735
-
1736
- if ( isset( $_POST[ 'ac_settings_frm' ] ) && $_POST[ 'ac_settings_frm' ] == 'update' && isset($update_template_successfuly) && $update_template_successfuly >= 0 ) { ?>
1737
- <div id="message" class="updated fade"><p><strong><?php _e( 'The Email Template has been successfully updated.', 'woocommerce-ac' ); ?></strong></p></div>
1738
- <?php } else if ( isset( $_POST[ 'ac_settings_frm' ] ) && $_POST[ 'ac_settings_frm' ] == 'update' && isset($update_template_successfuly) && $update_template_successfuly === false ){
1739
- ?>
1740
- <div id="message" class="error fade"><p><strong><?php _e( ' There was a problem updating the email template. Please contact the plugin author via <a href= "https://wordpress.org/support/plugin/woocommerce-abandoned-cart">support forum</a>.', 'woocommerce-ac' ); ?></strong></p></div>
1741
- <?php
1742
- }
1743
- ?>
1744
- <div class="tablenav">
1745
- <p style="float:left;">
1746
- <a cursor: pointer; href="<?php echo "admin.php?page=woocommerce_ac_page&action=emailtemplates&mode=addnewtemplate"; ?>" class="button-secondary"><?php _e( 'Add New Template', 'woocommerce-ac' ); ?></a>
1747
- </p>
1748
-
1749
- <?php
1750
- /* From here you can do whatever you want with the data from the $result link. */
1751
- include_once('class-templates-table.php');
1752
- $wcap_template_list = new WACP_Templates_Table();
1753
- $wcap_template_list->wcap_templates_prepare_items();
1754
- ?>
1755
- <div class="wrap">
1756
- <form id="wacp-abandoned-templates" method="get" >
1757
- <input type="hidden" name="page" value="woocommerce_ac_page" />
1758
- <?php $wcap_template_list->display(); ?>
1759
- </form>
1760
- </div>
1761
- <?php
1762
-
1763
- }
1764
- elseif ($action == 'stats' || $action == '')
1765
- {
1766
- ?>
1767
- <p>
1768
- <script language='javascript'>
1769
- jQuery( document ).ready( function()
1770
- {
1771
- jQuery( '#duration_select' ).change( function()
1772
- {
1773
- var group_name = jQuery( '#duration_select' ).val();
1774
- var today = new Date();
1775
- var start_date = "";
1776
- var end_date = "";
1777
- if ( group_name == "yesterday" )
1778
- {
1779
- start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 1 );
1780
- end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 1 );
1781
- }
1782
- else if ( group_name == "today")
1783
- {
1784
- start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
1785
- end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
1786
- }
1787
- else if ( group_name == "last_seven" )
1788
- {
1789
- start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 7 );
1790
- end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
1791
- }
1792
- else if ( group_name == "last_fifteen" )
1793
- {
1794
- start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 15 );
1795
- end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
1796
- }
1797
- else if ( group_name == "last_thirty" )
1798
- {
1799
- start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 30 );
1800
- end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
1801
- }
1802
- else if ( group_name == "last_ninety" )
1803
- {
1804
- start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 90 );
1805
- end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
1806
- }
1807
- else if ( group_name == "last_year_days" )
1808
- {
1809
- start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 365 );
1810
- end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
1811
- }
1812
-
1813
- var monthNames = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
1814
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
1815
-
1816
- var start_date_value = start_date.getDate() + " " + monthNames[start_date.getMonth()] + " " + start_date.getFullYear();
1817
- var end_date_value = end_date.getDate() + " " + monthNames[end_date.getMonth()] + " " + end_date.getFullYear();
1818
-
1819
- jQuery( '#start_date' ).val( start_date_value );
1820
- jQuery( '#end_date' ).val( end_date_value );
1821
-
1822
- });
1823
- });
1824
- </script>
1825
- <?php
1826
-
1827
- if ( isset( $_POST[ 'duration_select' ] ) ){
1828
- $duration_range = $_POST['duration_select'];
1829
- } else {
1830
- $duration_range = "";
1831
- }
1832
- if ( $duration_range == "" ) {
1833
- if ( isset( $_GET[ 'duration_select' ] ) ){
1834
- $duration_range = $_GET[ 'duration_select' ];
1835
- }
1836
- }
1837
- if ($duration_range == "") $duration_range = "last_seven";
1838
-
1839
-
1840
- _e( 'The Report below shows how many Abandoned Carts we were able to recover for you by sending automatic emails to encourage shoppers.', 'woocommerce-ac');
1841
- ?>
1842
- <div id="recovered_stats" class="postbox" style="display:block">
1843
-
1844
- <div class="inside">
1845
- <form method="post" action="admin.php?page=woocommerce_ac_page&action=stats" id="ac_stats">
1846
- <select id="duration_select" name="duration_select" >
1847
- <?php
1848
- foreach ( $this->duration_range_select as $key => $value )
1849
- {
1850
- $sel = "";
1851
- if ($key == $duration_range) {
1852
- $sel = " selected ";
1853
- }
1854
- echo"<option value='$key' $sel> $value </option>";
1855
- }
1856
-
1857
- $date_sett = $this->start_end_dates[ $duration_range ];
1858
-
1859
- ?>
1860
- </select>
1861
-
1862
- <script type="text/javascript">
1863
- jQuery( document ).ready( function()
1864
- {
1865
- var formats = [ "d.m.y", "d M yy","MM d, yy" ];
1866
- jQuery( "#start_date" ).datepicker( { dateFormat: formats[ 1 ] } );
1867
- });
1868
-
1869
- jQuery( document ).ready( function()
1870
- {
1871
- var formats = [ "d.m.y", "d M yy","MM d, yy" ];
1872
- jQuery( "#end_date" ).datepicker( { dateFormat: formats[ 1 ] } );
1873
- });
1874
- </script>
1875
-
1876
-
1877
- <?php
1878
-
1879
- include_once('class-recover-orders-table.php');
1880
-
1881
- $wcap_recover_orders_list = new WACP_Recover_Orders_Table();
1882
- $wcap_recover_orders_list->wcap_recovered_orders_prepare_items_lite();
1883
-
1884
- if ( isset( $_POST['start_date'] ) ) $start_date_range = $_POST['start_date'];
1885
- else $start_date_range = "";
1886
-
1887
- if ( $start_date_range == "" ) {
1888
- $start_date_range = $date_sett['start_date'];
1889
- }
1890
-
1891
- if ( isset( $_POST['end_date'] ) ) $end_date_range = $_POST['end_date'];
1892
- else $end_date_range = "";
1893
-
1894
- if ( $end_date_range == "" ) {
1895
- $end_date_range = $date_sett['end_date'];
1896
- }
1897
- ?>
1898
- <label class="start_label" for="start_day"> <?php _e( 'Start Date:', 'woocommerce-ac' ); ?> </label>
1899
- <input type="text" id="start_date" name="start_date" readonly="readonly" value="<?php echo $start_date_range; ?>"/>
1900
- <label class="end_label" for="end_day"> <?php _e( 'End Date:', 'woocommerce-ac' ); ?> </label>
1901
- <input type="text" id="end_date" name="end_date" readonly="readonly" value="<?php echo $end_date_range; ?>"/>
1902
- <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e( 'Go', 'woocommerce-ac' ); ?>" />
1903
- </form>
1904
- </div>
1905
- </div>
1906
- <div id="recovered_stats" class="postbox" style="display:block">
1907
- <div class="inside" >
1908
- <p style="font-size: 15px"><?php _e( 'During the selected range ', 'woocommerce-ac' ); ?>
1909
- <strong>
1910
- <?php $count = $wcap_recover_orders_list->total_abandoned_cart_count;
1911
- echo $count; ?>
1912
- </strong>
1913
- <?php _e( 'carts totaling', 'woocommerce-ac' ); ?>
1914
- <strong>
1915
- <?php $total_of_all_order = $wcap_recover_orders_list->total_order_amount;
1916
-
1917
- echo get_woocommerce_currency_symbol().$total_of_all_order; ?>
1918
- </strong>
1919
- <?php _e( ' were abandoned. We were able to recover', 'woocommerce-ac' ); ?>
1920
- <strong>
1921
- <?php
1922
- $recovered_item = $wcap_recover_orders_list->recovered_item;
1923
-
1924
- echo $recovered_item; ?>
1925
- </strong>
1926
- <?php _e( ' of them, which led to an extra', 'woocommerce-ac' ); ?>
1927
- <strong>
1928
- <?php
1929
- $recovered_total = $wcap_recover_orders_list->total_recover_amount;
1930
- echo get_woocommerce_currency_symbol().$recovered_total; ?>
1931
- </strong>
1932
- <?php //_e( ' in sales', 'woocommerce-ac' ); ?>
1933
- </p>
1934
- </div>
1935
- </div>
1936
-
1937
- <div class="wrap">
1938
- <form id="wacp-recover-orders" method="get" >
1939
- <input type="hidden" name="page" value="woocommerce_ac_page" />
1940
- <?php $wcap_recover_orders_list->display(); ?>
1941
- </form>
1942
- </div>
1943
- <?php
1944
- }elseif ( $action == 'orderdetails' ) {
1945
- $ac_order_id = $_GET['id'];
1946
- ?>
1947
- <p> </p>
1948
- <div id="ac_order_details" class="postbox" style="display:block">
1949
- <h3> <p> <?php _e( "Abandoned Order #$ac_order_id Details", "woocommerce-ac" ); ?> </p> </h3>
1950
- <div class="inside">
1951
- <table cellpadding="0" cellspacing="0" class="wp-list-table widefat fixed posts">
1952
- <tr>
1953
- <th> <?php _e( 'Item', 'woocommerce-ac' ); ?> </th>
1954
- <th> <?php _e( 'Id', 'woocommerce-ac' ); ?> </th>
1955
- <th> <?php _e( 'Name', 'woocommerce-ac' ); ?> </th>
1956
- <th> <?php _e( 'Quantity', 'woocommerce-ac' ); ?> </th>
1957
- <th> <?php _e( 'Line Subtotal', 'woocommerce-ac' ); ?> </th>
1958
- <th> <?php _e( 'Line Total', 'woocommerce-ac' ); ?> </th>
1959
- </tr>
1960
- <?php
1961
- $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE id = %d ";
1962
- $results = $wpdb->get_results( $wpdb->prepare( $query,$_GET['id'] ) );
1963
- $shipping_charges = 0;
1964
- $currency_symbol = get_woocommerce_currency_symbol();
1965
-
1966
- if ( $results[0]->user_type == "GUEST" ) {
1967
- $query_guest = "SELECT * FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = %d";
1968
- $results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $results[0]->user_id ) );
1969
- $user_email = $results_guest[0]->email_id;
1970
- $user_first_name = $results_guest[0]->billing_first_name;
1971
- $user_last_name = $results_guest[0]->billing_last_name;
1972
- $user_billing_postcode = $results_guest[0]->billing_zipcode;
1973
- $user_shipping_postcode = $results_guest[0]->shipping_zipcode;
1974
- $shipping_charges = $results_guest[0]->shipping_charges;
1975
- $user_billing_company = $user_billing_address_1 = $user_billing_address_2 = $user_billing_city = $user_billing_state = $user_billing_country = $user_billing_phone = "";
1976
- $user_shipping_company = $user_shipping_address_1 = $user_shipping_address_2 = $user_shipping_city = $user_shipping_state = $user_shipping_country = "";
1977
- } else {
1978
- $user_id = $results[0]->user_id;
1979
- if ( isset( $results[0]->user_login ) ) $user_login = $results[0]->user_login;
1980
-
1981
- $user_email = get_user_meta( $results[0]->user_id, 'billing_email', true );
1982
-
1983
- if($user_email == ""){
1984
- $user_data = get_userdata( $results[0]->user_id );
1985
- $user_email = $user_data->user_email;
1986
- }
1987
-
1988
- $user_first_name_temp = get_user_meta( $results[0]->user_id, 'first_name');
1989
- if ( isset( $user_first_name_temp[0] ) ) $user_first_name = $user_first_name_temp[0];
1990
- else $user_first_name = "";
1991
-
1992
- $user_last_name_temp = get_user_meta($results[0]->user_id, 'last_name');
1993
- if ( isset( $user_last_name_temp[0] ) ) $user_last_name = $user_last_name_temp[0];
1994
- else $user_last_name = "";
1995
-
1996
- $user_billing_first_name = get_user_meta( $results[0]->user_id, 'billing_first_name' );
1997
- $user_billing_last_name = get_user_meta( $results[0]->user_id, 'billing_last_name' );
1998
-
1999
- $user_billing_company_temp = get_user_meta( $results[0]->user_id, 'billing_company' );
2000
- if ( isset( $user_billing_company_temp[0] ) ) $user_billing_company = $user_billing_company_temp[0];
2001
- else $user_billing_company = "";
2002
-
2003
- $user_billing_address_1_temp = get_user_meta( $results[0]->user_id, 'billing_address_1' );
2004
- if ( isset( $user_billing_address_1_temp[0] ) ) $user_billing_address_1 = $user_billing_address_1_temp[0];
2005
- else $user_billing_address_1 = "";
2006
-
2007
- $user_billing_address_2_temp = get_user_meta( $results[0]->user_id, 'billing_address_2' );
2008
- if ( isset( $user_billing_address_2_temp[0] ) ) $user_billing_address_2 = $user_billing_address_2_temp[0];
2009
- else $user_billing_address_2 = "";
2010
-
2011
- $user_billing_city_temp = get_user_meta( $results[0]->user_id, 'billing_city' );
2012
- if ( isset( $user_billing_city_temp[0] ) ) $user_billing_city = $user_billing_city_temp[0];
2013
- else $user_billing_city = "";
2014
-
2015
- $user_billing_postcode_temp = get_user_meta( $results[0]->user_id, 'billing_postcode' );
2016
- if ( isset( $user_billing_postcode_temp[0] ) ) $user_billing_postcode = $user_billing_postcode_temp[0];
2017
- else $user_billing_postcode = "";
2018
-
2019
- $user_billing_state_temp = get_user_meta( $results[0]->user_id, 'billing_state' );
2020
- if ( isset( $user_billing_state_temp[0] ) ) $user_billing_state = $user_billing_state_temp[0];
2021
- else $user_billing_state = "";
2022
-
2023
- $user_billing_country_temp = get_user_meta( $results[0]->user_id, 'billing_country' );
2024
- if ( isset( $user_billing_country_temp[0] ) ) $user_billing_country = $user_billing_country_temp[0];
2025
- else $user_billing_country = "";
2026
-
2027
- $user_billing_phone_temp = get_user_meta( $results[0]->user_id, 'billing_phone' );
2028
- if ( isset( $user_billing_phone_temp[0] ) ) $user_billing_phone = $user_billing_phone_temp[0];
2029
- else $user_billing_phone = "";
2030
-
2031
- $user_shipping_first_name = get_user_meta( $results[0]->user_id, 'shipping_first_name' );
2032
- $user_shipping_last_name = get_user_meta( $results[0]->user_id, 'shipping_last_name' );
2033
-
2034
- $user_shipping_company_temp = get_user_meta( $results[0]->user_id, 'shipping_company' );
2035
- if ( isset( $user_shipping_company_temp[0] ) ) $user_shipping_company = $user_shipping_company_temp[0];
2036
- else $user_shipping_company = "";
2037
-
2038
- $user_shipping_address_1_temp = get_user_meta( $results[0]->user_id, 'shipping_address_1' );
2039
- if ( isset( $user_shipping_address_1_temp[0] ) ) $user_shipping_address_1 = $user_shipping_address_1_temp[0];
2040
- else $user_shipping_address_1 = "";
2041
-
2042
- $user_shipping_address_2_temp = get_user_meta( $results[0]->user_id, 'shipping_address_2' );
2043
- if ( isset( $user_shipping_address_2_temp[0] ) ) $user_shipping_address_2 = $user_shipping_address_2_temp[0];
2044
- else $user_shipping_address_2 = "";
2045
-
2046
- $user_shipping_city_temp = get_user_meta( $results[0]->user_id, 'shipping_city' );
2047
- if ( isset( $user_shipping_city_temp[0] ) ) $user_shipping_city = $user_shipping_city_temp[0];
2048
- else $user_shipping_city = "";
2049
-
2050
- $user_shipping_postcode_temp = get_user_meta( $results[0]->user_id, 'shipping_postcode' );
2051
- if ( isset( $user_shipping_postcode_temp[0] ) ) $user_shipping_postcode = $user_shipping_postcode_temp[0];
2052
- else $user_shipping_postcode = "";
2053
-
2054
- $user_shipping_state_temp = get_user_meta( $results[0]->user_id, 'shipping_state' );
2055
- if ( isset( $user_shipping_state_temp[0] ) ) $user_shipping_state = $user_shipping_state_temp[0];
2056
- else $user_shipping_state = "";
2057
-
2058
- $user_shipping_country_temp = get_user_meta( $results[0]->user_id, 'shipping_country' );
2059
- if ( isset( $user_shipping_country_temp[0] ) ) $user_shipping_country = $user_shipping_country_temp[0];
2060
- else $user_shipping_country = "";
2061
- }
2062
- $cart_details = array();
2063
- $cart_info = json_decode( $results[0]->abandoned_cart_info );
2064
- $cart_details = (array) $cart_info->cart;
2065
- $item_subtotal = $item_total = 0;
2066
-
2067
- if ( is_array ( $cart_details ) && count($cart_details) > 0 ) {
2068
- foreach ( $cart_details as $k => $v ) {
2069
- $quantity_total = $v->quantity;
2070
- $product_id = $v->product_id;
2071
- $prod_name = get_post($product_id);
2072
- $product_name = $prod_name->post_title;
2073
-
2074
- // Item subtotal is calculated as product total including taxes
2075
- if ( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
2076
- $item_subtotal = $item_subtotal + $v->line_total + $v->line_subtotal_tax;
2077
- } else {
2078
- $item_subtotal = $item_subtotal + $v->line_total;
2079
- }
2080
-
2081
- // Line total
2082
- $item_total = $item_subtotal;
2083
- $item_subtotal = $item_subtotal / $quantity_total;
2084
- $item_total = number_format( $item_total, 2 );
2085
- $item_subtotal = number_format( $item_subtotal, 2 );
2086
- $product = get_product( $product_id );
2087
- $prod_image = $product->get_image();
2088
- ?>
2089
- <tr>
2090
- <td> <?php echo $prod_image; ?></td>
2091
- <td> <?php echo $product->id; ?> </td>
2092
- <td> <?php echo $product_name; ?></td>
2093
- <td> <?php echo $quantity_total; ?></td>
2094
- <td> <?php echo get_woocommerce_currency_symbol()." ".$item_subtotal; ?></td>
2095
- <td> <?php echo get_woocommerce_currency_symbol()." ".$item_total; ?></td>
2096
- </tr>
2097
-
2098
- <?php
2099
- $item_subtotal = $item_total = 0;
2100
- }
2101
- }
2102
- ?>
2103
- </table>
2104
- </div>
2105
- </div>
2106
- <div id="ac_order_customer_details" class="postbox" style="display:block">
2107
- <h3> <p> <?php _e( 'Customer Details' , 'woocommerce-ac' ); ?> </p> </h3>
2108
- <div class="inside" style="height: 300px;" >
2109
- <div id="order_data" class="panel">
2110
- <div style="width:500px;float:left">
2111
- <h3> <p> <?php _e( 'Billing Details' , 'woocommerce-ac' ); ?> </p> </h3>
2112
- <p> <strong> <?php _e( 'Name:' , 'woocommerce-ac' ); ?> </strong>
2113
- <?php echo $user_first_name." ".$user_last_name;?>
2114
- </p>
2115
- <p> <strong> <?php _e( 'Address:' , 'woocommerce-ac' ); ?> </strong>
2116
- <?php echo $user_billing_company."</br>".
2117
- $user_billing_address_1."</br>".
2118
- $user_billing_address_2."</br>".
2119
- $user_billing_city."</br>".
2120
- $user_billing_postcode."</br>".
2121
- $user_billing_state."</br>".
2122
- $user_billing_country."</br>";
2123
- ?>
2124
- </p>
2125
- <p> <strong> <?php _e( 'Email:', 'woocommerce-ac' ); ?> </strong>
2126
- <?php $user_mail_to = "mailto:".$user_email; ?>
2127
- <a href=<?php echo $user_mail_to;?>><?php echo $user_email;?> </a>
2128
- </p>
2129
- <p> <strong> <?php _e( 'Phone:', 'woocommerce-ac' ); ?> </strong>
2130
- <?php echo $user_billing_phone;?>
2131
- </p>
2132
- </div>
2133
- <div style="width:500px;float:right">
2134
- <h3> <p> <?php _e( 'Shipping Details', 'woocommerce-ac' ); ?> </p> </h3>
2135
- <p> <strong> <?php _e( 'Address:', 'woocommerce-ac' ); ?> </strong>
2136
-
2137
- <?php
2138
- if ( $user_shipping_company == '' &&
2139
- $user_shipping_address_1 == '' &&
2140
- $user_shipping_address_2 == '' &&
2141
- $user_shipping_city == '' &&
2142
- $user_shipping_postcode == '' &&
2143
- $user_shipping_state == '' &&
2144
- $user_shipping_country == '') {
2145
- echo "Shipping Address same as Billing Address";
2146
- } else { ?>
2147
- <?php echo $user_shipping_company."</br>".
2148
- $user_shipping_address_1."</br>".
2149
- $user_shipping_address_2."</br>".
2150
- $user_shipping_city."</br>".
2151
- $user_shipping_postcode."</br>".
2152
- $user_shipping_state."</br>".
2153
- $user_shipping_country."</br>";
2154
- ?>
2155
- <br><br>
2156
- <strong> Shipping Charges: </strong>
2157
- <?php if ( $shipping_charges != 0 ) echo $currency_symbol . $shipping_charges;?>
2158
- </p>
2159
- <?php }?>
2160
- </div>
2161
- </div>
2162
- </div>
2163
- </div>
2164
- <?php } elseif ( $action == 'report' ) {
2165
- include_once('class-product-report-table.php');
2166
-
2167
- $wcap_product_report_list = new WACP_Product_Report_Table();
2168
- $wcap_product_report_list->wcap_product_report_prepare_items_lite();
2169
-
2170
- ?>
2171
- <div class="wrap">
2172
- <form id="wacp-sent-emails" method="get" >
2173
- <input type="hidden" name="page" value="woocommerce_ac_page" />
2174
- <?php $wcap_product_report_list->display(); ?>
2175
- </form>
2176
- </div>
2177
-
2178
- <?php }
2179
- }
2180
- echo( "</table>" );
2181
-
2182
- if ( isset( $_GET[ 'action' ] ) ){
2183
- $action = $_GET[ 'action' ];
2184
- }
2185
- if ( isset( $_GET[ 'mode' ] ) ){
2186
- $mode = $_GET[ 'mode' ];
2187
- }
2188
- if ( $action == 'emailtemplates' && ( $mode == 'addnewtemplate' || $mode == 'edittemplate' ) )
2189
- {
2190
- if( $mode=='edittemplate' )
2191
- {
2192
- $edit_id = $_GET[ 'id' ];
2193
-
2194
- $query="SELECT wpet . * FROM `".$wpdb->prefix."ac_email_templates_lite` AS wpet WHERE id = %d ";
2195
- $results = $wpdb->get_results( $wpdb->prepare( $query, $edit_id ) );
2196
- }
2197
-
2198
- $active_post = ( empty( $_POST[ 'is_active' ] ) ) ? '0' : '1';
2199
-
2200
- ?>
2201
-
2202
- <div id="content">
2203
- <form method="post" action="admin.php?page=woocommerce_ac_page&action=emailtemplates" id="ac_settings">
2204
- <input type="hidden" name="mode" value="<?php echo $mode;?>" />
2205
- <?php
2206
- $id_by = "";
2207
- if ( isset( $_GET[ 'id' ] ) ){
2208
- $id_by = $_GET[ 'id' ];
2209
- }
2210
- ?>
2211
- <input type="hidden" name="id" value="<?php echo $id_by ;?>" />
2212
-
2213
- <?php
2214
- $button_mode = "save";
2215
- $display_message = "Add Email Template";
2216
- if ( $mode == 'edittemplate' )
2217
- {
2218
- $button_mode = "update";
2219
- $display_message = "Edit Email Template";
2220
- }
2221
- print'<input type="hidden" name="ac_settings_frm" value="'.$button_mode.'">';?>
2222
- <div id="poststuff">
2223
- <div> <!-- <div class="postbox" > -->
2224
- <h3 class="hndle"><?php _e( $display_message, 'woocommerce-ac' ); ?></h3>
2225
- <div>
2226
- <table class="form-table" id="addedit_template">
2227
-
2228
- <tr>
2229
- <th>
2230
- <label for="woocommerce_ac_template_name"><b><?php _e( 'Template Name:', 'woocommerce-ac');?></b></label>
2231
- </th>
2232
- <td>
2233
- <?php
2234
- $template_name = "";
2235
- if( $mode == 'edittemplate' )
2236
- {
2237
- $template_name = $results[0]->template_name;
2238
- }
2239
-
2240
- print'<input type="text" name="woocommerce_ac_template_name" id="woocommerce_ac_template_name" class="regular-text" value="'.$template_name.'">';?>
2241
- <img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter a template name for reference', 'woocommerce-ac') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" /></p>
2242
- </tr>
2243
-
2244
- <tr>
2245
- <th>
2246
- <label for="woocommerce_ac_from_name"><b><?php _e( 'Send From This Name:', 'woocommerce-ac' ); ?></b></label>
2247
- </th>
2248
- <td>
2249
- <?php
2250
- $from_name = "Admin";
2251
- if ( $mode == 'edittemplate' )
2252
- {
2253
- $from_name=$results[0]->from_name;
2254
- }
2255
-
2256
- print'<input type="text" name="woocommerce_ac_from_name" id="woocommerce_ac_from_name" class="regular-text" value="'.$from_name.'">';?>
2257
- <img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter the name that should appear in the email sent', 'woocommerce-ac') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" /></p>
2258
-
2259
- </tr>
2260
- <tr>
2261
- <th>
2262
- <label for="woocommerce_ac_email_from"><b><?php _e( 'Send From This Email Address:', 'woocommerce-ac' ); ?></b></label>
2263
- </th>
2264
- <td>
2265
-
2266
- <?php
2267
- $from_edit = get_option( 'admin_email' );
2268
-
2269
- if ( $mode == 'edittemplate' && $results[0]->from_email != '') { // this is the fix
2270
- $from_edit = $results[0]->from_email;
2271
- }
2272
- print'<input type="text" name="woocommerce_ac_email_from" id="woocommerce_ac_email_from" class="regular-text" value="' . $from_edit . '">'; ?>
2273
- <img class="help_tip" width="16" height="16" data-tip='<?php _e( 'Which email address should be shown in the "From Email" field for this email?', 'woocommerce' ) ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" /></p>
2274
- <?php ?></textarea>
2275
- </td>
2276
- </tr>
2277
- <tr>
2278
- <th>
2279
- <label for="woocommerce_ac_email_reply"><b><?php _e( 'Send Reply Emails to:', 'woocommerce-ac' ); ?></b></label>
2280
- </th>
2281
- <td>
2282
-
2283
- <?php
2284
- $reply_edit = get_option( 'admin_email' );
2285
-
2286
- if ( $mode == 'edittemplate' && $results[0]->reply_email != '' ) { // this is the fix
2287
- $reply_edit = $results[0]->reply_email;
2288
- }
2289
-
2290
- print'<input type="text" name="woocommerce_ac_email_reply" id="woocommerce_ac_email_reply" class="regular-text" value="' . $reply_edit . '">'; ?>
2291
- <img class="help_tip" width="16" height="16" data-tip='<?php _e( 'When a contact receives your email and clicks reply, which email address should that reply be sent to?', 'woocommerce' ) ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" /></p>
2292
- <?php ?></textarea>
2293
- </td>
2294
- </tr>
2295
-
2296
- <tr>
2297
- <th>
2298
- <label for="woocommerce_ac_email_subject"><b><?php _e( 'Subject:', 'woocommerce-ac' ); ?></b></label>
2299
- </th>
2300
- <td>
2301
- <?php
2302
- $subject_edit = "";
2303
- if ( $mode == 'edittemplate' )
2304
- {
2305
- $subject_edit=$results[0]->subject;
2306
- }
2307
-
2308
- print'<input type="text" name="woocommerce_ac_email_subject" id="woocommerce_ac_email_subject" class="regular-text" value="'.$subject_edit.'">';?>
2309
- <img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter the subject that should appear in the email sent', 'woocommerce-ac') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" /></p>
2310
-
2311
- </tr>
2312
-
2313
- <tr>
2314
- <th>
2315
- <label for="woocommerce_ac_email_body"><b><?php _e( 'Email Body:', 'woocommerce-ac' ); ?></b></label>
2316
- </th>
2317
- <td>
2318
-
2319
- <?php
2320
- $initial_data = "";
2321
- if ( $mode == 'edittemplate' )
2322
- {
2323
- $initial_data = stripslashes( $results[0]->body );
2324
- }
2325
-
2326
- $initial_data = str_replace ( "My document title", "", $initial_data );
2327
-
2328
- wp_editor(
2329
- $initial_data,
2330
- 'woocommerce_ac_email_body',
2331
- array(
2332
- 'media_buttons' => true,
2333
- 'textarea_rows' => 15,
2334
- 'tabindex' => 4,
2335
- 'tinymce' => array(
2336
- 'theme_advanced_buttons1' => 'bold,italic,underline,|,bullist,numlist,blockquote,|,link,unlink,|,spellchecker,fullscreen,|,formatselect,styleselect'
2337
-
2338
- ),
2339
- )
2340
- );
2341
-
2342
- ?>
2343
- <?php echo stripslashes(get_option( 'woocommerce_ac_email_body' )); ?>
2344
- <span class="description"><?php
2345
- echo __( 'Message to be sent in the reminder email.', 'woocommerce-ac' );
2346
- ?></span>
2347
- </td>
2348
- </tr>
2349
-
2350
- <tr>
2351
- <th>
2352
- <label for="is_wc_template"><b><?php _e( 'Use WooCommerce Template Style:', 'woocommerce-ac' ); ?></b></label>
2353
- </th>
2354
- <td>
2355
-
2356
- <?php
2357
- $is_wc_template="";
2358
-
2359
- if ( $mode == 'edittemplate' ) {
2360
- $use_wc_template = $results[0]->is_wc_template;
2361
-
2362
- if ( $use_wc_template == '1' ) {
2363
- $is_wc_template = "checked";
2364
- } else {
2365
- $is_wc_template = "";
2366
- }
2367
- }
2368
- print'<input type="checkbox" name="is_wc_template" id="is_wc_template" ' . $is_wc_template . '> </input>'; ?>
2369
- <img class="help_tip" width="16" height="16" data-tip='<?php _e( 'Use WooCommerce default style template for abandoned cart reminder emails.', 'woocommerce' ) ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" /> <a target = '_blank' href= <?php echo wp_nonce_url( admin_url( '?wacp_preview_woocommerce_mail=true' ), 'woocommerce-ac' ) ; ?> >
2370
- Click here to preview </a>how the email template will look with WooCommerce Template Style enabled. Alternatively, if this is unchecked, the template will appear as <a target = '_blank' href=<?php echo wp_nonce_url( admin_url( '?wacp_preview_mail=true' ), 'woocommerce-ac' ) ; ?>>shown here</a>. <br> <strong>Note: </strong>When this setting is enabled, then "Send From This Name:" & "Send From This Email Address:" will be overwritten with WooCommerce -> Settings -> Email -> Email Sender Options.
2371
- </p>
2372
- </td>
2373
-
2374
- </tr>
2375
-
2376
- <tr>
2377
- <th>
2378
- <label for="is_active"><b><?php _e( 'Active:', 'woocommerce-ac' ); ?></b></label>
2379
- </th>
2380
- <td>
2381
-
2382
- <?php
2383
- $is_active_edit="";
2384
-
2385
- if ( $mode == 'edittemplate' ) {
2386
- $active_edit = $results[0]->is_active;
2387
-
2388
- if ( $active_edit == '1' ) {
2389
- $is_active_edit = "checked";
2390
- } else {
2391
- $is_active_edit = "";
2392
- }
2393
- }
2394
-
2395
- if ( $mode == 'copytemplate' ) {
2396
- $active_edit = $results_copy[0]->is_active;
2397
-
2398
- if($active_edit == '1') {
2399
- $is_active_edit = "checked";
2400
- } else {
2401
- $is_active_edit = "";
2402
- }
2403
- }
2404
- print'<input type="checkbox" name="is_active" id="is_active" ' . $is_active_edit . '> </input>'; ?>
2405
- <img class="help_tip" width="16" height="16" data-tip='<?php _e( 'Yes, This email should be sent to shoppers with abandoned carts', 'woocommerce' ) ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" /></p>
2406
- </td>
2407
- </tr>
2408
- <tr>
2409
- <th>
2410
- <label for="woocommerce_ac_email_frequency"><b><?php _e( 'Send this email:', 'woocommerce-ac' ); ?></b></label>
2411
- </th>
2412
- <td>
2413
-
2414
- <select name="email_frequency" id="email_frequency">
2415
-
2416
- <?php
2417
- $frequency_edit = "";
2418
- if( $mode == 'edittemplate')
2419
- {
2420
- $frequency_edit = $results[0]->frequency;
2421
- }
2422
-
2423
- for ( $i = 1; $i < 4; $i++ )
2424
- {
2425
- printf( "<option %s value='%s'>%s</option>\n",
2426
- selected( $i, $frequency_edit, false ),
2427
- esc_attr( $i ),
2428
- $i
2429
- );
2430
- }
2431
-
2432
- ?>
2433
-
2434
- </select>
2435
-
2436
- <select name="day_or_hour" id="day_or_hour">
2437
-
2438
- <?php
2439
- $days_or_hours_edit = "";
2440
- if ( $mode == 'edittemplate')
2441
- {
2442
- $days_or_hours_edit = $results[0]->day_or_hour;
2443
- }
2444
-
2445
- $days_or_hours = array(
2446
- 'Days' => 'Day(s)',
2447
- 'Hours' => 'Hour(s)'
2448
- );
2449
- foreach( $days_or_hours as $k => $v )
2450
- {
2451
- printf( "<option %s value='%s'>%s</option>\n",
2452
- selected( $k, $days_or_hours_edit, false ),
2453
- esc_attr( $k ),
2454
- $v
2455
- );
2456
- }
2457
- ?>
2458
-
2459
- </select>
2460
-
2461
- <span class="description"><?php
2462
- echo __( 'after cart is abandoned.', 'woocommerce-ac' );
2463
- ?></span>
2464
- </td>
2465
- </tr>
2466
-
2467
- <tr>
2468
- <th>
2469
- <label for="woocommerce_ac_email_preview"><b><?php _e( 'Send a test email to:', 'woocommerce-ac' ); ?></b></label>
2470
- </th>
2471
- <td>
2472
-
2473
- <input type="text" id="send_test_email" name="send_test_email" class="regular-text" >
2474
- <input type="button" value="Send a test email" id="preview_email" onclick="javascript:void(0);">
2475
- <img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter the email id to which the test email needs to be sent.', 'woocommerce-ac') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
2476
- <div id="preview_email_sent_msg" style="display:none;"></div>
2477
- </p>
2478
-
2479
- </td>
2480
- </tr>
2481
- </table>
2482
- </div>
2483
- </div>
2484
- </div>
2485
- <p class="submit">
2486
- <?php
2487
- $button_value = "Save Changes";
2488
- if ( $mode == 'edittemplate' )
2489
- {
2490
- $button_value = "Update Changes";
2491
- }?>
2492
- <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e( $button_value, 'woocommerce-ac' ); ?>" />
2493
- </p>
2494
- </form>
2495
- </div>
2496
- <?php
2497
-
2498
- }
2499
-
2500
- }
2501
-
2502
- function bubble_sort_function( $unsort_array, $order ) {
2503
-
2504
- $temp = array();
2505
- foreach ( $unsort_array as $key => $value )
2506
- $temp[$key] = $value; //concatenate something unique to make sure two equal weights don't overwrite each other
2507
-
2508
- asort( $temp, SORT_NUMERIC ); // or ksort($temp, SORT_NATURAL); see paragraph above to understand why
2509
-
2510
- if( $order == 'desc' ) {
2511
- $array = array_reverse( $temp, true );
2512
- }
2513
- else if($order == 'asc') {
2514
- $array = $temp;
2515
- }
2516
- unset( $temp );
2517
-
2518
- return $array;
2519
- }
2520
-
2521
- function my_action_javascript()
2522
- {
2523
- ?>
2524
- <script type="text/javascript" >
2525
- jQuery( document ).ready( function($)
2526
- {
2527
- $( "table#cart_data a.remove_cart" ).click( function()
2528
- {
2529
- var y = confirm( 'Are you sure you want to delete this Abandoned Order' );
2530
- if( y == true )
2531
- {
2532
- var passed_id = this.id;
2533
- var arr = passed_id.split('-');
2534
- var abandoned_order_id = arr[0];
2535
- var user_id = arr[1];
2536
- var data = {
2537
- abandoned_order_id: abandoned_order_id,
2538
- user_id : user_id,
2539
- action : 'remove_cart_data'
2540
- };
2541
-
2542
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
2543
- $.post( ajaxurl, data, function( response )
2544
- {
2545
- //alert('Got this from the server: ' + response);
2546
- $( "#row_" + abandoned_order_id ).hide();
2547
- });
2548
- }
2549
- });
2550
- });
2551
- </script>
2552
- <?php
2553
-
2554
- }
2555
-
2556
- function remove_cart_data() {
2557
-
2558
- global $wpdb; // this is how you get access to the database
2559
-
2560
- $abandoned_order_id = $_POST[ 'abandoned_order_id' ];
2561
- $user_id = $_POST[ 'user_id' ];
2562
- $action = $_POST[ 'action' ];
2563
-
2564
- $query = "DELETE FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
2565
- WHERE
2566
- id = '%d' ";
2567
-
2568
- $results = $wpdb->get_results( $wpdb->prepare( $query, $abandoned_order_id ) );
2569
-
2570
- if ( $user_id >= '63000000' ) {
2571
- $guest_query = "DELETE FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = '".$user_id."'";
2572
- $results_guest = $wpdb->get_results( $guest_query );
2573
- }
2574
-
2575
- die();
2576
- }
2577
-
2578
- function my_action_send_preview()
2579
- {
2580
- ?>
2581
- <script type="text/javascript" >
2582
-
2583
- jQuery( document ).ready( function( $ )
2584
- {
2585
- $( "table#addedit_template input#preview_email" ).click( function()
2586
- {
2587
-
2588
- var from_name_preview = $( '#woocommerce_ac_from_name' ).val();
2589
- var reply_name_preview = $( '#woocommerce_ac_email_reply' ).val();
2590
- var from_email_preview = $( '#woocommerce_ac_email_from' ).val();
2591
- var subject_email_preview = $( '#woocommerce_ac_email_subject' ).val();
2592
- var body_email_preview = tinyMCE.activeEditor.getContent();
2593
- var send_email_id = $( '#send_test_email' ).val();
2594
- var is_wc_template = document.getElementById("is_wc_template").checked;
2595
- var data = {
2596
- from_name_preview : from_name_preview,
2597
- reply_name_preview : reply_name_preview,
2598
- from_email_preview : from_email_preview,
2599
- subject_email_preview: subject_email_preview,
2600
- body_email_preview : body_email_preview,
2601
- send_email_id : send_email_id,
2602
- is_wc_template : is_wc_template,
2603
- action : 'preview_email_sent'
2604
- };
2605
-
2606
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
2607
- $.post( ajaxurl, data, function( response )
2608
- {
2609
- $( "#preview_email_sent_msg" ).html( "<img src='<?php echo plugins_url(); ?>/woocommerce-abandoned-cart/images/check.jpg'>&nbsp;Email has been sent successfully." );
2610
- $( "#preview_email_sent_msg" ).fadeIn();
2611
- setTimeout( function(){$( "#preview_email_sent_msg" ).fadeOut();}, 3000 );
2612
- //alert('Got this from the server: ' + response);
2613
- });
2614
- });
2615
- });
2616
- </script>
2617
- <?php
2618
- }
2619
-
2620
- function preview_email_sent() {
2621
-
2622
- $from_email_name = $_POST[ 'from_name_preview' ];
2623
- $reply_name_preview = $_POST['reply_name_preview'];
2624
- $from_email_preview = $_POST['from_email_preview'];
2625
- $subject_email_preview = $_POST[ 'subject_email_preview' ];
2626
- $body_email_preview = $_POST[ 'body_email_preview' ];
2627
- $is_wc_template = $_POST['is_wc_template'];
2628
-
2629
- $headers = "From: " . $from_email_name . " <" . $from_email_preview . ">" . "\r\n";
2630
- $headers .= "Content-Type: text/html" . "\r\n";
2631
- $headers .= "Reply-To: " . $reply_name_preview . " " . "\r\n";
2632
-
2633
- $body_email_preview = str_replace( '{{customer.firstname}}', 'John', $body_email_preview );
2634
- $body_email_preview = str_replace( '{{customer.lastname}}', 'Doe', $body_email_preview );
2635
- $body_email_preview = str_replace( '{{customer.fullname}}', 'John'." ".'Doe', $body_email_preview );
2636
- $current_time_stamp = current_time( 'timestamp' );
2637
- $test_date = date( 'd M, Y h:i A', $current_time_stamp );
2638
- $body_email_preview = str_replace( '{{cart.abandoned_date}}', $test_date, $body_email_preview );
2639
-
2640
- $var = '<h3>'.__( "Your Shopping Cart", "woocommerce-ac" ).'</h3>
2641
- <table border="0" cellpadding="10" cellspacing="0" class="templateDataTable">
2642
- <tr align="center">
2643
- <th>'.__( "Item", "woocommerce-ac" ).'</th>
2644
- <th>'.__( "Name", "woocommerce-ac" ).'</th>
2645
- <th>'.__( "Quantity", "woocommerce-ac" ).'</th>
2646
- <th>'.__( "Price", "woocommerce-ac" ).'</th>
2647
- <th>'.__( "Line Subtotal", "woocommerce-ac" ).'</th>
2648
- </tr>
2649
- <tr align="center">
2650
- <td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/images/shoes.jpg"/></td>
2651
- <td>'.__( "Men\'\s Formal Shoes", "woocommerce-ac" ).'</td>
2652
- <td>1</td>
2653
- <td>$100</td>
2654
- <td>$100</td>
2655
- </tr>
2656
- <tr align="center">
2657
- <td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/images/handbag.jpg"/></td>
2658
- <td>'.__( "Woman\'\s Hand Bags", "woocommerce-ac" ).'</td>
2659
- <td>1</td>
2660
- <td>$100</td>
2661
- <td>$100</td>
2662
- </tr>
2663
- <tr align="center">
2664
- <td></td>
2665
- <td></td>
2666
- <td></td>
2667
- <td>'.__( "Cart Total:", "woocommerce-ac" ).'</td>
2668
- <td>$200</td>
2669
- </tr>
2670
- </table>';
2671
-
2672
- $body_email_preview = str_replace( '{{products.cart}}', $var, $body_email_preview );
2673
- if ( isset( $_POST[ 'send_email_id' ] ) ) {
2674
- $to_email_preview = $_POST[ 'send_email_id' ];
2675
- } else {
2676
- $to_email_preview = "";
2677
- }
2678
- $user_email_from = get_option( 'admin_email' );
2679
-
2680
- $body_email_final_preview = stripslashes( $body_email_preview );
2681
- if ( isset( $is_wc_template ) && "true" == $is_wc_template ){
2682
-
2683
- $email_heading = __( 'Abandoned cart reminder', 'woocommerce-ac' );
2684
-
2685
- ob_start();
2686
-
2687
- wc_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading ) );
2688
-
2689
- $email_body_template_header = ob_get_clean();
2690
-
2691
- ob_start();
2692
-
2693
- wc_get_template( 'emails/email-footer.php' );
2694
-
2695
- $email_body_template_footer = ob_get_clean();
2696
-
2697
- $final_email_body = $email_body_template_header . $body_email_final_preview . $email_body_template_footer;
2698
- wc_mail( $to_email_preview, $subject_email_preview, $final_email_body , $headers );
2699
-
2700
- }else{
2701
- wp_mail( $to_email_preview, $subject_email_preview, stripslashes( $body_email_preview ), $headers );
2702
- }
2703
-
2704
- echo "email sent";
2705
-
2706
- die();
2707
- }
2708
- }
2709
-
2710
- }
2711
-
2712
- $woocommerce_abandon_cart = new woocommerce_abandon_cart();
2713
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Abandoned Cart Lite for WooCommerce
4
+ Plugin URI: http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro
5
+ Description: This plugin captures abandoned carts by logged-in users & emails them about it. <strong><a href="http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro">Click here to get the PRO Version.</a></strong>
6
+ Version: 3.2
7
+ Author: Tyche Softwares
8
+ Author URI: http://www.tychesoftwares.com/
9
+ */
10
+
11
+ // Deletion Settings
12
+ register_uninstall_hook( __FILE__, 'woocommerce_ac_delete_lite' );
13
+
14
+ require_once( "includes/wcal_class-guest.php" );
15
+ require_once( "includes/wcal_default-settings.php" );
16
+ require_once( "includes/wcal_actions.php" );
17
+ require_once( "includes/classes/class-wcal-aes.php" );
18
+ require_once( "includes/classes/class-wcal-aes-counter.php" );
19
+
20
+ // Add a new interval of 15 minutes
21
+ add_filter( 'cron_schedules', 'wcal_add_cron_schedule' );
22
+
23
+ function wcal_add_cron_schedule( $schedules ) {
24
+ $schedules['15_minutes_lite'] = array(
25
+ 'interval' => 900, // 15 minutes in seconds
26
+ 'display' => __( 'Once Every Fifteen Minutes' ),
27
+ );
28
+ return $schedules;
29
+ }
30
+ // Schedule an action if it's not already scheduled
31
+ if ( ! wp_next_scheduled( 'woocommerce_ac_send_email_action' ) ) {
32
+ wp_schedule_event( time(), '15_minutes_lite', 'woocommerce_ac_send_email_action' );
33
+ }
34
+
35
+ // Hook into that action that'll fire every 15 minutes
36
+ add_action( 'woocommerce_ac_send_email_action', 'wcal_send_email_cron' );
37
+
38
+ function wcal_send_email_cron() {
39
+ //require_once( ABSPATH.'wp-content/plugins/woocommerce-abandoned-cart/cron/send_email.php' );
40
+ $plugin_dir_path = plugin_dir_path( __FILE__ );
41
+ require_once( $plugin_dir_path . 'cron/wcal_send_email.php' );
42
+ }
43
+
44
+ function woocommerce_ac_delete_lite() {
45
+ global $wpdb;
46
+ $table_name_ac_abandoned_cart_history = $wpdb->prefix . "ac_abandoned_cart_history_lite";
47
+ $sql_ac_abandoned_cart_history = "DROP TABLE " . $table_name_ac_abandoned_cart_history ;
48
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
49
+ $wpdb->get_results( $sql_ac_abandoned_cart_history );
50
+
51
+ $table_name_ac_email_templates = $wpdb->prefix . "ac_email_templates_lite";
52
+ $sql_ac_email_templates = "DROP TABLE " . $table_name_ac_email_templates ;
53
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
54
+ $wpdb->get_results( $sql_ac_email_templates );
55
+
56
+ $table_name_ac_sent_history = $wpdb->prefix . "ac_sent_history_lite";
57
+ $sql_ac_sent_history = "DROP TABLE " . $table_name_ac_sent_history ;
58
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
59
+ $wpdb->get_results( $sql_ac_sent_history );
60
+
61
+ $table_name_ac_guest_abandoned_cart_history = $wpdb->prefix . "ac_guest_abandoned_cart_history_lite";
62
+ $sql_ac_abandoned_cart_history = "DROP TABLE " . $table_name_ac_guest_abandoned_cart_history ;
63
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
64
+ $wpdb->get_results( $sql_ac_abandoned_cart_history );
65
+
66
+ $sql_table_user_meta_cart = "DELETE FROM `" . $wpdb->prefix . "usermeta` WHERE meta_key = '_woocommerce_persistent_cart'";
67
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
68
+ $wpdb->get_results( $sql_table_user_meta_cart );
69
+
70
+ $sql_table_user_meta_cart_modified = "DELETE FROM `" . $wpdb->prefix . "usermeta` WHERE meta_key = '_woocommerce_ac_modified_cart'";
71
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
72
+ $wpdb->get_results( $sql_table_user_meta_cart_modified );
73
+
74
+ $query = "SELECT blog_id FROM `".$wpdb->prefix."blogs`";
75
+ $results = $wpdb->get_results( $query );
76
+
77
+ foreach( $results as $key => $value ) {
78
+ $table_name_ac_abandoned_cart_history = $wpdb->prefix .$value->blog_id."_"."ac_abandoned_cart_history_lite";
79
+ $sql_ac_abandoned_cart_history = "DROP TABLE " . $table_name_ac_abandoned_cart_history ;
80
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
81
+ $wpdb->get_results( $sql_ac_abandoned_cart_history );
82
+
83
+ $table_name_ac_email_templates = $wpdb->prefix .$value->blog_id."_"."ac_email_templates_lite";
84
+ $sql_ac_email_templates = "DROP TABLE " . $table_name_ac_email_templates ;
85
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
86
+ $wpdb->get_results( $sql_ac_email_templates );
87
+
88
+ $table_name_ac_sent_history = $wpdb->prefix .$value->blog_id."_"."ac_sent_history_lite";
89
+ $sql_ac_sent_history = "DROP TABLE " . $table_name_ac_sent_history ;
90
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
91
+ $wpdb->get_results( $sql_ac_sent_history );
92
+
93
+ $table_name_ac_guest_abandoned_cart_history = $wpdb->prefix . "ac_guest_abandoned_cart_history_lite";
94
+ $sql_ac_abandoned_cart_history = "DROP TABLE " . $table_name_ac_guest_abandoned_cart_history ;
95
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
96
+ $wpdb->get_results( $sql_ac_abandoned_cart_history );
97
+
98
+ $sql_table_user_meta_cart = "DELETE FROM `" . $wpdb->prefix.$value->blog_id."_"."usermeta` WHERE meta_key = '_woocommerce_persistent_cart'";
99
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
100
+ $wpdb->get_results( $sql_table_user_meta_cart );
101
+
102
+ $sql_table_user_meta_cart_modified = "DELETE FROM `" . $wpdb->prefix.$value->blog_id."_"."usermeta` WHERE meta_key = '_woocommerce_ac_modified_cart'";
103
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
104
+ $wpdb->get_results( $sql_table_user_meta_cart_modified );
105
+ }
106
+ delete_option( 'woocommerce_ac_email_body' );
107
+ delete_option( 'ac_lite_cart_abandoned_time' );
108
+ delete_option( 'ac_lite_email_admin_on_recovery' );
109
+ delete_option( 'ac_lite_settings_status' );
110
+ delete_option( 'woocommerce_ac_default_templates_installed' );
111
+ delete_option( 'wcal_security_key' );
112
+ }
113
+ /**
114
+ * woocommerce_abandon_cart_lite class
115
+ **/
116
+ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
117
+
118
+ class woocommerce_abandon_cart_lite {
119
+ var $one_hour;
120
+ var $three_hours;
121
+ var $six_hours;
122
+ var $twelve_hours;
123
+ var $one_day;
124
+ var $one_week;
125
+ var $duration_range_select = array();
126
+ var $start_end_dates = array();
127
+
128
+ public function __construct() {
129
+ $this->one_hour = 60 * 60;
130
+ $this->three_hours = 3 * $this->one_hour;
131
+ $this->six_hours = 6 * $this->one_hour;
132
+ $this->twelve_hours = 12 * $this->one_hour;
133
+ $this->one_day = 24 * $this->one_hour;
134
+ $this->one_week = 7 * $this->one_day;
135
+ $this->duration_range_select = array( 'yesterday' => 'Yesterday',
136
+ 'today' => 'Today',
137
+ 'last_seven' => 'Last 7 days',
138
+ 'last_fifteen' => 'Last 15 days',
139
+ 'last_thirty' => 'Last 30 days',
140
+ 'last_ninety' => 'Last 90 days',
141
+ 'last_year_days' => 'Last 365'
142
+ );
143
+
144
+ $this->start_end_dates = array( 'yesterday' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 24*60*60 ) ),
145
+ 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) - 7*24*60*60 ) ) ),
146
+ 'today' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ),
147
+ 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
148
+ 'last_seven' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 7*24*60*60 ) ),
149
+ 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
150
+ 'last_fifteen' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 15*24*60*60 ) ),
151
+ 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
152
+ 'last_thirty' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 30*24*60*60 ) ),
153
+ 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
154
+ 'last_ninety' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 90*24*60*60 ) ),
155
+ 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
156
+ 'last_year_days' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 365*24*60*60 ) ),
157
+ 'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) )
158
+ );
159
+
160
+ // Initialize settings
161
+ register_activation_hook ( __FILE__, array( &$this, 'wcal_activate' ) );
162
+
163
+ // WordPress Administration Menu
164
+ add_action ( 'admin_menu', array( &$this, 'wcal_admin_menu' ) );
165
+
166
+ // Actions to be done on cart update
167
+ add_action ( 'woocommerce_cart_updated', array( &$this, 'wcal_store_cart_timestamp' ) );
168
+
169
+ // delete added temp fields after order is placed
170
+ add_filter ( 'woocommerce_order_details_after_order_table', array( &$this, 'wcal_action_after_delivery_session' ) );
171
+
172
+ add_action ( 'admin_init', array( &$this, 'wcal_action_admin_init' ) );
173
+
174
+ // Update the options as per settings API
175
+ add_action ( 'admin_init', array( &$this, 'wcal_update_db_check' ) );
176
+
177
+ // Wordpress settings API
178
+ add_action( 'admin_init', array( &$this, 'wcal_initialize_plugin_options' ) );
179
+
180
+ // Language Translation
181
+ add_action ( 'init', array( &$this, 'wcal_update_po_file' ) );
182
+
183
+ // track links
184
+ add_filter( 'template_include', array( &$this, 'wcal_email_track_links' ), 99, 1 );
185
+
186
+ //It will used to unsubcribe the emails.
187
+ add_action( 'template_include', array( &$this, 'wcal_email_unsubscribe'),99, 1 );
188
+
189
+ add_action ( 'admin_enqueue_scripts', array( &$this, 'wcal_enqueue_scripts_js' ) );
190
+ add_action ( 'admin_enqueue_scripts', array( &$this, 'wcal_enqueue_scripts_css' ) );
191
+
192
+ if ( is_admin() ) {
193
+ // Load "admin-only" scripts here
194
+ add_action ( 'admin_head', array( &$this, 'wcal_action_send_preview' ) );
195
+ add_action ( 'wp_ajax_wcal_preview_email_sent', array( &$this, 'wcal_preview_email_sent' ) );
196
+ }
197
+
198
+ // Send Email on order recovery
199
+ add_action( 'woocommerce_order_status_pending_to_processing_notification', array( &$this, 'wcal_email_admin_recovery' ) );
200
+ add_action( 'woocommerce_order_status_pending_to_completed_notification', array( &$this, 'wcal_email_admin_recovery' ) );
201
+ add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( &$this, 'wcal_email_admin_recovery' ) );
202
+ add_action( 'woocommerce_order_status_failed_to_processing_notification', array( &$this, 'wcal_email_admin_recovery' ) );
203
+ add_action( 'woocommerce_order_status_failed_to_completed_notification', array( &$this, 'wcal_email_admin_recovery' ) );
204
+
205
+ add_action('woocommerce_order_status_changed', array( &$this, 'wcal_email_admin_recovery_for_paypal' ), 10, 3);
206
+
207
+ add_action( 'admin_init', array( $this, 'wcal_preview_emails' ) );
208
+ add_action( 'init', array( $this, 'wcal_app_output_buffer') );
209
+ add_action( 'admin_init', array( &$this, 'wcal_check_pro_activated' ) );
210
+
211
+ add_action( 'woocommerce_checkout_order_processed', array( &$this, 'wcal_order_placed' ), 10 , 1 );
212
+
213
+ add_filter( 'woocommerce_payment_complete_order_status', array( &$this , 'wcal_order_complete_action' ), 10 , 2 );
214
+ }
215
+
216
+ public static function wcal_order_placed( $order_id ) {
217
+ if( session_id() === '' ) {
218
+ //session has not started
219
+ session_start();
220
+ }
221
+
222
+ if ( isset( $_SESSION['email_sent_id'] ) && $_SESSION['email_sent_id'] !='' ) {
223
+ global $woocommerce, $wpdb;
224
+
225
+ $email_sent_id = $_SESSION['email_sent_id'];
226
+
227
+ $get_ac_id_query = "SELECT abandoned_order_id FROM `" . $wpdb->prefix."ac_sent_history_lite` WHERE id = %d";
228
+ $get_ac_id_results = $wpdb->get_results( $wpdb->prepare( $get_ac_id_query, $email_sent_id ) );
229
+
230
+ $abandoned_order_id = $get_ac_id_results[0]->abandoned_order_id;
231
+
232
+ update_post_meta( $order_id , 'wcal_recover_order_placed', $abandoned_order_id );
233
+ update_post_meta( $order_id , 'wcal_recover_order_placed_sent_id', $email_sent_id );
234
+
235
+
236
+ } else if ( isset( $_SESSION['abandoned_cart_id_lite'] ) && $_SESSION['abandoned_cart_id_lite'] !='' ) {
237
+ global $woocommerce, $wpdb;
238
+
239
+ $results_sent = array();
240
+ $abandoned_cart_id = $_SESSION['abandoned_cart_id_lite'];
241
+
242
+ $get_email_sent_for_abandoned_id = "SELECT * FROM `" . $wpdb->prefix . "ac_sent_history_lite` WHERE abandoned_order_id = %d ";
243
+ $results_sent = $wpdb->get_results ( $wpdb->prepare( $get_email_sent_for_abandoned_id, $abandoned_cart_id ) );
244
+
245
+ if ( empty( $results_sent ) && count( $results_sent ) == 0 ){
246
+ /*
247
+ * If logeged in user place the order once it isdisplyed under the abandoned orders tab.
248
+ * But the email has been not sent to the user. And order is placed successfuly
249
+ * Then We are deleteing those order. But for those orders Recovered email has been set to the Admin.
250
+ * Below code ensure that admin recovery email will not be sent for those orders.
251
+ */
252
+ $get_user_id_of_abandoned_cart = "SELECT * FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE id = %d ";
253
+
254
+ $get_results_of_user_id = $wpdb->get_results ( $wpdb->prepare( $get_user_id_of_abandoned_cart, $abandoned_cart_id ) );
255
+ $user_id = $get_results_of_user_id[0]->user_id;
256
+
257
+ delete_user_meta( $user_id, '_woocommerce_ac_modified_cart' );
258
+ /*
259
+ * It will delete the order from history table if the order is placed before any email sent to the user.
260
+ *
261
+ */
262
+ $table_name = $wpdb->prefix . 'ac_abandoned_cart_history_lite';
263
+ $wpdb->delete( $table_name , array( 'id' => $abandoned_cart_id ) );
264
+ } else {
265
+ $email_sent_id = $results_sent[0]->id;
266
+ update_post_meta( $order_id , 'wcal_recover_order_placed', $abandoned_cart_id );
267
+ update_post_meta( $order_id , 'wcal_recover_order_placed_sent_id', $email_sent_id );
268
+ }
269
+ }
270
+ }
271
+
272
+ public function wcal_order_complete_action( $order_status, $order_id ) {
273
+
274
+
275
+ if ( 'failed' != $order_status ) {
276
+ global $woocommerce, $wpdb;
277
+ $order = new WC_Order( $order_id );
278
+
279
+ $get_abandoned_id_of_order = '';
280
+ $get_sent_email_id_of_order = '';
281
+ $get_abandoned_id_of_order = get_post_meta( $order_id, 'wcal_recover_order_placed', true );
282
+
283
+ if ( isset( $get_abandoned_id_of_order ) && $get_abandoned_id_of_order != '' ){
284
+
285
+ $get_abandoned_id_of_order = get_post_meta( $order_id, 'wcal_recover_order_placed', true );
286
+
287
+ $get_sent_email_id_of_order = get_post_meta( $order_id, 'wcal_recover_order_placed_sent_id', true );
288
+
289
+ $query_order = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` SET recovered_cart= '" . $order_id . "', cart_ignored = '1'
290
+ WHERE id = '".$get_abandoned_id_of_order."' ";
291
+ $wpdb->query( $query_order );
292
+
293
+ $order->add_order_note( __( 'This order was abandoned & subsequently recovered.', 'woocommerce-ac' ) );
294
+
295
+ delete_post_meta( $order_id, 'wcal_recover_order_placed', $get_abandoned_id_of_order );
296
+ delete_post_meta( $order_id, 'wcal_recover_order_placed_sent_id', $get_sent_email_id_of_order );
297
+ delete_post_meta( $order_id, 'wcap_recovered_email_sent', 'yes' );
298
+ }
299
+ }
300
+ return $order_status;
301
+ }
302
+
303
+ /**
304
+ * Check If Pro is activated along with Lite version.
305
+ */
306
+ public static function wcal_check_pro_activated() {
307
+ if( is_plugin_active( 'woocommerce-abandon-cart-pro/woocommerce-ac.php' ) && class_exists( 'woocommerce_abandon_cart' ) ) {
308
+ add_action( 'admin_notices', array( 'woocommerce_abandon_cart_lite', 'wcal_check_pro_notice' ) );
309
+ }
310
+ }
311
+
312
+ /**
313
+ * Display a notice in the admin Plugins page if the LITE version is
314
+ * activated with PRO version is activated.
315
+ */
316
+ public static function wcal_check_pro_notice() {
317
+ $class = 'notice notice-error is-dismissible';
318
+ $message = __( 'The Lite & Pro version of Abandoned Cart plugin for WooCommerce (from Tyche Softwares) are active on your website. <br> In this case, the abandoned carts will be captured in both plugins & email reminders will also be sent from both plugins. <br> It is recommended that you deactivate the Lite version & keep the Pro version active.', 'woocommerce-ac' );
319
+ printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
320
+ }
321
+
322
+ /*-----------------------------------------------------------------------------------*/
323
+ /* Class Functions */
324
+ /*-----------------------------------------------------------------------------------*/
325
+ /**
326
+ * Preview email template
327
+ *
328
+ * @return string
329
+ */
330
+ public function wcal_preview_emails() {
331
+ global $woocommerce;
332
+ if( isset( $_GET['wcal_preview_woocommerce_mail'] ) ) {
333
+ if( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-ac') ) {
334
+ die( 'Security check' );
335
+ }
336
+ $message = '';
337
+ // create a new email
338
+ if( $woocommerce->version < '2.3' ) {
339
+ global $email_heading;
340
+ ob_start();
341
+
342
+ include( 'views/wcal-wc-email-template-preview.php' );
343
+ $mailer = WC()->mailer();
344
+ $message = ob_get_clean();
345
+ $email_heading = __( 'HTML Email Template', 'woocommerce' );
346
+ $message = $mailer->wrap_message( $email_heading, $message );
347
+ } else {
348
+ // load the mailer class
349
+ $mailer = WC()->mailer();
350
+ // get the preview email subject
351
+ $email_heading = __( 'Abandoned cart Email Template', 'woocommerce-ac' );
352
+ // get the preview email content
353
+ ob_start();
354
+ include( 'views/wcal-wc-email-template-preview.php' );
355
+ $message = ob_get_clean();
356
+ // create a new email
357
+ $email = new WC_Email();
358
+ // wrap the content with the email template and then add styles
359
+ $message = $email->style_inline( $mailer->wrap_message( $email_heading, $message ) );
360
+ }
361
+ echo $message;
362
+ exit;
363
+ }
364
+
365
+ if ( isset( $_GET['wcal_preview_mail'] ) ) {
366
+ if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-ac') ) {
367
+ die( 'Security check' );
368
+ }
369
+ // get the preview email content
370
+ ob_start();
371
+ include( 'views/wcal-email-template-preview.php' );
372
+ $message = ob_get_clean();
373
+ // print the preview email
374
+ echo $message;
375
+ exit;
376
+ }
377
+ }
378
+ // Language Translation
379
+ function wcal_update_po_file() {
380
+ $domain = 'woocommerce-ac';
381
+ $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
382
+ if ( $loaded = load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '-' . $locale . '.mo' ) ) {
383
+ return $loaded;
384
+ } else {
385
+ load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/i18n/languages/' );
386
+ }
387
+ }
388
+
389
+ /*-----------------------------------------------------------------------------------*/
390
+ /* Class Functions */
391
+ /*-----------------------------------------------------------------------------------*/
392
+ function wcal_activate() {
393
+ global $wpdb;
394
+ $wcap_collate = '';
395
+ if ( $wpdb->has_cap( 'collation' ) ) {
396
+ $wcap_collate = $wpdb->get_charset_collate();
397
+ }
398
+ $table_name = $wpdb->prefix . "ac_email_templates_lite";
399
+
400
+ $sql = "CREATE TABLE IF NOT EXISTS $table_name (
401
+ `id` int(11) NOT NULL AUTO_INCREMENT,
402
+ `subject` text COLLATE utf8_unicode_ci NOT NULL,
403
+ `body` mediumtext COLLATE utf8_unicode_ci NOT NULL,
404
+ `is_active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL,
405
+ `frequency` int(11) NOT NULL,
406
+ `day_or_hour` enum('Days','Hours') COLLATE utf8_unicode_ci NOT NULL,
407
+ `template_name` text COLLATE utf8_unicode_ci NOT NULL,
408
+ `from_name` text COLLATE utf8_unicode_ci NOT NULL,
409
+ PRIMARY KEY (`id`)
410
+ ) $wcap_collate AUTO_INCREMENT=1 ";
411
+
412
+ require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
413
+ dbDelta( $sql );
414
+
415
+ $table_name = $wpdb->prefix . "ac_email_templates_lite";
416
+ $check_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'is_wc_template' ";
417
+ $results = $wpdb->get_results( $check_template_table_query );
418
+
419
+ if ( count( $results ) == 0 ) {
420
+ $alter_template_table_query = "ALTER TABLE $table_name
421
+ ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8_unicode_ci NOT NULL AFTER `from_name`,
422
+ ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
423
+
424
+ $wpdb->get_results( $alter_template_table_query );
425
+ }
426
+ $table_name = $wpdb->prefix . "ac_email_templates_lite";
427
+ $check_email_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'reply_email' ";
428
+ $results_email = $wpdb->get_results( $check_email_template_table_query );
429
+
430
+ if ( count( $results_email ) == 0 ) {
431
+ $alter_email_template_table_query = "ALTER TABLE $table_name
432
+ ADD COLUMN `reply_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `default_template`,
433
+ ADD COLUMN `from_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `reply_email`";
434
+ $wpdb->get_results( $alter_email_template_table_query );
435
+ }
436
+
437
+ $sent_table_name = $wpdb->prefix . "ac_sent_history_lite";
438
+
439
+ $sql_query = "CREATE TABLE IF NOT EXISTS $sent_table_name (
440
+ `id` int(11) NOT NULL auto_increment,
441
+ `template_id` varchar(40) collate utf8_unicode_ci NOT NULL,
442
+ `abandoned_order_id` int(11) NOT NULL,
443
+ `sent_time` datetime NOT NULL,
444
+ `sent_email_id` text COLLATE utf8_unicode_ci NOT NULL,
445
+ PRIMARY KEY (`id`)
446
+ ) $wcap_collate AUTO_INCREMENT=1 ";
447
+
448
+ require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
449
+ dbDelta ( $sql_query );
450
+
451
+ $ac_history_table_name = $wpdb->prefix . "ac_abandoned_cart_history_lite";
452
+
453
+ $history_query = "CREATE TABLE IF NOT EXISTS $ac_history_table_name (
454
+ `id` int(11) NOT NULL AUTO_INCREMENT,
455
+ `user_id` int(11) NOT NULL,
456
+ `abandoned_cart_info` text COLLATE utf8_unicode_ci NOT NULL,
457
+ `abandoned_cart_time` int(11) NOT NULL,
458
+ `cart_ignored` enum('0','1') COLLATE utf8_unicode_ci NOT NULL,
459
+ `recovered_cart` int(11) NOT NULL,
460
+ PRIMARY KEY (`id`)
461
+ ) $wcap_collate";
462
+
463
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
464
+ dbDelta( $history_query );
465
+
466
+ // Default templates: function call to create default templates.
467
+ $check_table_empty = $wpdb->get_var( "SELECT COUNT(*) FROM `" . $wpdb->prefix . "ac_email_templates_lite`" );
468
+
469
+ if( !get_option( 'woocommerce_ac_default_templates_installed' ) ) {
470
+ if( 0 == $check_table_empty ) {
471
+ $default_template = new wcal_default_template_settings;
472
+ $default_template->wcal_create_default_templates();
473
+ update_option( 'woocommerce_ac_default_templates_installed', "yes" );
474
+ }
475
+ }
476
+ }
477
+
478
+ /***************************************************************
479
+ * WP Settings API
480
+ **************************************************************/
481
+ function wcal_initialize_plugin_options() {
482
+ // First, we register a section. This is necessary since all future options must belong to a
483
+ add_settings_section(
484
+ 'ac_lite_general_settings_section', // ID used to identify this section and with which to register options
485
+ __( 'Settings', 'woocommerce-ac' ), // Title to be displayed on the administration page
486
+ array($this, 'ac_lite_general_options_callback' ), // Callback used to render the description of the section
487
+ 'woocommerce_ac_page' // Page on which to add this section of options
488
+ );
489
+
490
+ add_settings_field(
491
+ 'ac_lite_cart_abandoned_time',
492
+ __( 'Cart abandoned cut-off time', 'woocommerce-ac' ),
493
+ array( $this, 'ac_lite_cart_abandoned_time_callback' ),
494
+ 'woocommerce_ac_page',
495
+ 'ac_lite_general_settings_section',
496
+ array( __( 'Consider cart abandoned after X minutes of item being added to cart & order not placed.', 'woocommerce-ac' ) )
497
+ );
498
+
499
+ add_settings_field(
500
+ 'ac_lite_email_admin_on_recovery',
501
+ __( 'Email admin On Order Recovery', 'woocommerce-ac' ),
502
+ array( $this, 'ac_lite_email_admin_on_recovery' ),
503
+ 'woocommerce_ac_page',
504
+ 'ac_lite_general_settings_section',
505
+ array( __( 'Sends email to Admin if an Abandoned Cart Order is recovered.', 'woocommerce-ac' ) )
506
+ );
507
+
508
+ // Finally, we register the fields with WordPress
509
+ register_setting(
510
+ 'woocommerce_ac_settings',
511
+ 'ac_lite_cart_abandoned_time',
512
+ array ( $this, 'ac_lite_cart_time_validation' )
513
+ );
514
+
515
+ register_setting(
516
+ 'woocommerce_ac_settings',
517
+ 'ac_lite_email_admin_on_recovery'
518
+ );
519
+ }
520
+
521
+ /***************************************************************
522
+ * WP Settings API callback for section
523
+ **************************************************************/
524
+ function ac_lite_general_options_callback() {
525
+
526
+ }
527
+
528
+ /***************************************************************
529
+ * WP Settings API callback for cart time field
530
+ **************************************************************/
531
+ function ac_lite_cart_abandoned_time_callback( $args ) {
532
+ // First, we read the option
533
+ $cart_abandoned_time = get_option( 'ac_lite_cart_abandoned_time' );
534
+ // Next, we update the name attribute to access this element's ID in the context of the display options array
535
+ // We also access the show_header element of the options collection in the call to the checked() helper function
536
+ printf(
537
+ '<input type="text" id="ac_lite_cart_abandoned_time" name="ac_lite_cart_abandoned_time" value="%s" />',
538
+ isset( $cart_abandoned_time ) ? esc_attr( $cart_abandoned_time ) : ''
539
+ );
540
+ // Here, we'll take the first argument of the array and add it to a label next to the checkbox
541
+ $html = '<label for="ac_lite_cart_abandoned_time"> ' . $args[0] . '</label>';
542
+ echo $html;
543
+ }
544
+
545
+ /***************************************************************
546
+ * WP Settings API cart time field validation
547
+ **************************************************************/
548
+ function ac_lite_cart_time_validation( $input ) {
549
+ $output = '';
550
+ if ( $input != '' && ( is_numeric( $input) && $input > 0 ) ) {
551
+ $output = stripslashes( $input) ;
552
+ } else {
553
+ add_settings_error( 'ac_lite_cart_abandoned_time', 'error found', __( 'Abandoned cart cut off time should be numeric and has to be greater than 0.', 'woocommerce-ac' ) );
554
+ }
555
+ return $output;
556
+ }
557
+
558
+ /***************************************************************
559
+ * WP Settings API callback for email admin on cart recovery field
560
+ **************************************************************/
561
+ function ac_lite_email_admin_on_recovery( $args ) {
562
+ // First, we read the option
563
+ $email_admin_on_recovery = get_option( 'ac_lite_email_admin_on_recovery' );
564
+
565
+ // This condition added to avoid the notie displyed while Check box is unchecked.
566
+ if( isset( $email_admin_on_recovery ) && $email_admin_on_recovery == '' ) {
567
+ $email_admin_on_recovery = 'off';
568
+ }
569
+ // Next, we update the name attribute to access this element's ID in the context of the display options array
570
+ // We also access the show_header element of the options collection in the call to the checked() helper function
571
+ $html='';
572
+ printf(
573
+ '<input type="checkbox" id="ac_lite_email_admin_on_recovery" name="ac_lite_email_admin_on_recovery" value="on"
574
+ ' . checked('on', $email_admin_on_recovery, false).' />'
575
+ );
576
+
577
+ // Here, we'll take the first argument of the array and add it to a label next to the checkbox
578
+ $html .= '<label for="ac_lite_email_admin_on_recovery"> ' . $args[0] . '</label>';
579
+ echo $html;
580
+ }
581
+
582
+ /**************************************************
583
+ * This function is run when the plugin is upgraded
584
+ *************************************************/
585
+ function wcal_update_db_check() {
586
+ global $wpdb;
587
+ $wcap_collate = '';
588
+ if ( $wpdb->has_cap( 'collation' ) ) {
589
+ $wcap_collate = $wpdb->get_charset_collate();
590
+ }
591
+ if( get_option( 'ac_lite_delete_alter_table_queries' ) != 'yes' ) {
592
+ update_option( 'ac_lite_alter_table_queries', '' );
593
+ update_option( 'ac_lite_delete_alter_table_queries', 'yes' );
594
+ }
595
+ if( get_option( 'ac_lite_alter_table_queries' ) != 'yes' ) {
596
+ if( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "ac_email_templates'" ) === $wpdb->prefix . 'ac_email_templates' ) {
597
+ $old_table_name = $wpdb->prefix . "ac_email_templates";
598
+ $table_name = $wpdb->prefix . "ac_email_templates_lite";
599
+
600
+ $alter_ac_email_table_query = "ALTER TABLE $old_table_name
601
+ RENAME TO $table_name";
602
+ $wpdb->get_results ( $alter_ac_email_table_query );
603
+ }
604
+
605
+ if( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "ac_sent_history'" ) === $wpdb->prefix . 'ac_sent_history' ) {
606
+ $old_sent_table_name = $wpdb->prefix . "ac_sent_history";
607
+ $sent_table_name = $wpdb->prefix . "ac_sent_history_lite";
608
+ $alter_ac_sent_history_table_query = "ALTER TABLE $old_sent_table_name
609
+ RENAME TO $sent_table_name";
610
+ $wpdb->get_results ( $alter_ac_sent_history_table_query );
611
+ }
612
+
613
+ if( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "ac_abandoned_cart_history'" ) === $wpdb->prefix . 'ac_abandoned_cart_history' ) {
614
+ $old_ac_history_table_name = $wpdb->prefix . "ac_abandoned_cart_history";
615
+ $ac_history_table_name = $wpdb->prefix . "ac_abandoned_cart_history_lite";
616
+
617
+ $alter_ac_abandoned_cart_history_table_query = "ALTER TABLE $old_ac_history_table_name
618
+ RENAME TO $ac_history_table_name";
619
+ $wpdb->get_results ( $alter_ac_abandoned_cart_history_table_query );
620
+ }
621
+ update_option( 'ac_lite_alter_table_queries', 'yes' );
622
+ }
623
+
624
+ $ac_history_table_name = $wpdb->prefix."ac_abandoned_cart_history_lite";
625
+ $check_table_query = "SHOW COLUMNS FROM $ac_history_table_name LIKE 'user_type'";
626
+ $results = $wpdb->get_results( $check_table_query );
627
+
628
+ if ( count( $results ) == 0 ) {
629
+ $alter_table_query = "ALTER TABLE $ac_history_table_name ADD `user_type` text AFTER `recovered_cart`";
630
+ $wpdb->get_results( $alter_table_query );
631
+ }
632
+
633
+ $table_name = $wpdb->prefix . "ac_email_templates_lite";
634
+ $check_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'is_wc_template' ";
635
+ $results = $wpdb->get_results( $check_template_table_query );
636
+
637
+ if ( count( $results ) == 0 ) {
638
+ $alter_template_table_query = "ALTER TABLE $table_name
639
+ ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8_unicode_ci NOT NULL AFTER `from_name`,
640
+ ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
641
+ $wpdb->get_results( $alter_template_table_query );
642
+ }
643
+ $table_name = $wpdb->prefix . "ac_email_templates_lite";
644
+ $check_email_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'reply_email' ";
645
+ $results_email = $wpdb->get_results( $check_email_template_table_query );
646
+
647
+ if ( count( $results_email ) == 0 ) {
648
+ $alter_email_template_table_query = "ALTER TABLE $table_name
649
+ ADD COLUMN `reply_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `default_template`,
650
+ ADD COLUMN `from_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `reply_email`";
651
+ $wpdb->get_results( $alter_email_template_table_query );
652
+ }
653
+
654
+ $table_name = $wpdb->prefix . "ac_email_templates_lite";
655
+ $check_email_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'wc_email_header' ";
656
+ $results_email = $wpdb->get_results( $check_email_template_table_query );
657
+
658
+ if ( count( $results_email ) == 0 ) {
659
+ $alter_email_template_table_query = "ALTER TABLE $table_name
660
+ ADD COLUMN `wc_email_header` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `from_email`";
661
+ $wpdb->get_results( $alter_email_template_table_query );
662
+ }
663
+
664
+ $guest_table = $wpdb->prefix."ac_guest_abandoned_cart_history_lite" ;
665
+ $query_guest_table = "SHOW TABLES LIKE '$guest_table' ";
666
+ $result_guest_table = $wpdb->get_results( $query_guest_table );
667
+
668
+ if ( count( $result_guest_table ) == 0 ) {
669
+
670
+ $ac_guest_history_table_name = $wpdb->prefix . "ac_guest_abandoned_cart_history_lite";
671
+ $ac_guest_history_query = "CREATE TABLE IF NOT EXISTS $ac_guest_history_table_name (
672
+ `id` int(15) NOT NULL AUTO_INCREMENT,
673
+ `billing_first_name` text,
674
+ `billing_last_name` text,
675
+ `billing_company_name` text,
676
+ `billing_address_1` text,
677
+ `billing_address_2` text,
678
+ `billing_city` text,
679
+ `billing_county` text,
680
+ `billing_zipcode` text,
681
+ `email_id` text,
682
+ `phone` text,
683
+ `ship_to_billing` text,
684
+ `order_notes` text,
685
+ `shipping_first_name` text,
686
+ `shipping_last_name` text,
687
+ `shipping_company_name` text,
688
+ `shipping_address_1` text,
689
+ `shipping_address_2` text,
690
+ `shipping_city` text,
691
+ `shipping_county` text,
692
+ `shipping_zipcode` double,
693
+ `shipping_charges` double,
694
+ PRIMARY KEY (`id`)
695
+ ) $wcap_collate AUTO_INCREMENT=63000000";
696
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
697
+ $wpdb->query( $ac_guest_history_query );
698
+ }
699
+
700
+ //get the option, if it is not set to individual then convert to individual records and delete the base record
701
+ $ac_settings = get_option( 'ac_lite_settings_status' );
702
+
703
+ if ( $ac_settings != 'INDIVIDUAL' ) {
704
+ //fetch the existing settings and save them as inidividual to be used for the settings API
705
+ $woocommerce_ac_settings = json_decode( get_option( 'woocommerce_ac_settings' ) );
706
+
707
+ if( isset( $woocommerce_ac_settings[0]->cart_time ) ) {
708
+ add_option( 'ac_lite_cart_abandoned_time', $woocommerce_ac_settings[0]->cart_time );
709
+ } else {
710
+ add_option( 'ac_lite_cart_abandoned_time', '60' );
711
+ }
712
+
713
+ if( isset( $woocommerce_ac_settings[0]->email_admin ) ) {
714
+ add_option( 'ac_lite_email_admin_on_recovery', $woocommerce_ac_settings[0]->email_admin );
715
+ } else {
716
+ add_option( 'ac_lite_email_admin_on_recovery', "" );
717
+ }
718
+ update_option( 'ac_lite_settings_status', 'INDIVIDUAL' );
719
+ //Delete the main settings record
720
+ delete_option( 'woocommerce_ac_settings' );
721
+ }
722
+ if ( !get_option( 'wcal_security_key' ) ){
723
+ update_option( 'wcal_security_key', 'qJB0rGtIn5UB1xG03efyCp' );
724
+ }
725
+
726
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_abandoned_cart_history_lite';" ) ) {
727
+ if ( ! $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}ac_abandoned_cart_history_lite` LIKE 'unsubscribe_link';" ) ) {
728
+ $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`;" );
729
+ }
730
+ }
731
+ }
732
+
733
+ /******
734
+ * Send email to admin when cart is recovered only via PayPal.
735
+ * @since 2.9 version
736
+ */
737
+ public static function wcal_email_admin_recovery_for_paypal ( $order_id, $old, $new_status ) {
738
+ if ( 'pending' == $old && 'processing' == $new_status ) {
739
+ $user_id = get_current_user_id();
740
+ $ac_email_admin_recovery = get_option( 'ac_lite_email_admin_on_recovery' );
741
+ $order = new WC_Order( $order_id );
742
+ $user_id = $order->user_id;
743
+
744
+ if( $ac_email_admin_recovery == 'on' ) {
745
+ $recovered_email_sent = get_post_meta( $order_id, 'wcap_recovered_email_sent', true );
746
+ $check_abandoned_cart = get_user_meta( $user_id, '_woocommerce_ac_modified_cart', true );
747
+ $created_via = get_post_meta ( $order_id, '_created_via', true );
748
+
749
+ // mention here why are we comparing both "yes" and "no" values
750
+ if ( 'checkout' == $created_via && 'yes' != $recovered_email_sent && ( $check_abandoned_cart == md5( "yes" ) || $check_abandoned_cart == md5( "no" ) ) ) { // indicates cart is abandoned
751
+ $order = new WC_Order( $order_id );
752
+ $email_heading = __( 'New Customer Order - Recovered', 'woocommerce' );
753
+ $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
754
+ $email_subject = "New Customer Order - Recovered";
755
+ $user_email = get_option( 'admin_email' );
756
+ $headers[] = "From: Admin <".$user_email.">";
757
+ $headers[] = "Content-Type: text/html";
758
+ // Buffer
759
+ ob_start();
760
+ // Get mail template
761
+ woocommerce_get_template( 'emails/admin-new-order.php', array(
762
+ 'order' => $order,
763
+ 'email_heading' => $email_heading,
764
+ 'sent_to_admin' => false,
765
+ 'plain_text' => false,
766
+ 'email' => true
767
+ )
768
+ );
769
+
770
+ // Get contents
771
+ $email_body = ob_get_clean();
772
+ woocommerce_mail( $user_email, $email_subject, $email_body, $headers );
773
+
774
+ update_post_meta( $order_id, 'wcap_recovered_email_sent', 'yes' );
775
+
776
+ }
777
+ }
778
+ }
779
+ }
780
+
781
+ /******
782
+ * Send email to admin when cart is recovered via any other payment gateway other than PayPal.
783
+ * @since 2.3 version
784
+ */
785
+ function wcal_email_admin_recovery ( $order_id ) {
786
+ $user_id = get_current_user_id();
787
+ $ac_email_admin_recovery = get_option( 'ac_lite_email_admin_on_recovery' );
788
+
789
+ if( $ac_email_admin_recovery == 'on' ) {
790
+ $order = new WC_Order( $order_id );
791
+ $user_id = $order->user_id;
792
+
793
+ $recovered_email_sent = get_post_meta( $order_id, 'wcap_recovered_email_sent', true );
794
+ $check_abandoned_cart = get_user_meta( $user_id, '_woocommerce_ac_modified_cart', true );
795
+ $created_via = get_post_meta ( $order_id, '_created_via', true );
796
+
797
+ if ( 'checkout' == $created_via && 'yes' != $recovered_email_sent && ( $check_abandoned_cart == md5( "yes" ) || $check_abandoned_cart == md5( "no" ) ) ) { // indicates cart is abandoned
798
+
799
+ $email_heading = __( 'New Customer Order - Recovered', 'woocommerce-ac' );
800
+ $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
801
+ $email_subject = "New Customer Order - Recovered";
802
+ $user_email = get_option( 'admin_email' );
803
+ $headers[] = "From: Admin <".$user_email.">";
804
+ $headers[] = "Content-Type: text/html";
805
+ // Buffer
806
+ ob_start();
807
+ // Get mail template
808
+ woocommerce_get_template( 'emails/admin-new-order.php', array(
809
+ 'order' => $order,
810
+ 'email_heading' => $email_heading,
811
+ 'sent_to_admin' => false,
812
+ 'plain_text' => false,
813
+ 'email' => true
814
+ ) );
815
+ // Get contents
816
+ $email_body = ob_get_clean();
817
+ woocommerce_mail( $user_email, $email_subject, $email_body, $headers );
818
+
819
+ update_post_meta( $order_id, 'wcap_recovered_email_sent', 'yes' );
820
+ }
821
+ }
822
+ }
823
+
824
+ // Add a submenu page.
825
+ function wcal_admin_menu() {
826
+ $page = add_submenu_page ( 'woocommerce', __( 'Abandoned Carts', 'woocommerce-ac' ), __( 'Abandoned Carts', 'woocommerce-ac' ), 'manage_woocommerce', 'woocommerce_ac_page', array( &$this, 'wcal_menu_page' ) );
827
+ }
828
+
829
+ // Capture the cart and insert the information of the cart into DataBase
830
+ function wcal_store_cart_timestamp() {
831
+
832
+ if( session_id() === '' ){
833
+ //session has not started
834
+ session_start();
835
+ }
836
+ global $wpdb,$woocommerce;
837
+ $current_time = current_time( 'timestamp' );
838
+ $cut_off_time = get_option( 'ac_lite_cart_abandoned_time' );
839
+ $cart_ignored = 0;
840
+ $recovered_cart = 0;
841
+
842
+ if( isset( $cut_off_time ) ) {
843
+ $cart_cut_off_time = $cut_off_time * 60;
844
+ } else {
845
+ $cart_cut_off_time = 60 * 60;
846
+ }
847
+
848
+ $compare_time = $current_time - $cart_cut_off_time;
849
+
850
+ if ( is_user_logged_in() ) {
851
+ $user_id = get_current_user_id();
852
+ $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
853
+ WHERE user_id = %d
854
+ AND cart_ignored = %s
855
+ AND recovered_cart = %d ";
856
+ $results = $wpdb->get_results($wpdb->prepare( $query, $user_id, $cart_ignored, $recovered_cart ) );
857
+
858
+ if ( count($results) == 0 ) {
859
+ $cart_info = json_encode( get_user_meta( $user_id, '_woocommerce_persistent_cart', true ) );
860
+ $user_type = "REGISTERED";
861
+ $insert_query = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
862
+ ( user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type )
863
+ VALUES ( %d, %s, %d, %s, %s )";
864
+ $wpdb->query( $wpdb->prepare( $insert_query, $user_id, $cart_info,$current_time, $cart_ignored, $user_type ) );
865
+
866
+ $abandoned_cart_id = $wpdb->insert_id;
867
+ $_SESSION['abandoned_cart_id_lite'] = $abandoned_cart_id;
868
+ } elseif ( isset( $results[0]->abandoned_cart_time ) && $compare_time > $results[0]->abandoned_cart_time ) {
869
+ $updated_cart_info = json_encode( get_user_meta( $user_id, '_woocommerce_persistent_cart', true ) );
870
+
871
+ if ( ! $this->wcal_compare_carts( $user_id, $results[0]->abandoned_cart_info ) ) {
872
+ $updated_cart_ignored = 1;
873
+ $query_ignored = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
874
+ SET cart_ignored = %s
875
+ WHERE user_id = %d ";
876
+ $wpdb->query( $wpdb->prepare( $query_ignored, $updated_cart_ignored, $user_id ) );
877
+
878
+ $user_type = "REGISTERED";
879
+ $query_update = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
880
+ (user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type)
881
+ VALUES (%d, %s, %d, %s, %s)";
882
+ $wpdb->query( $wpdb->prepare( $query_update, $user_id, $updated_cart_info, $current_time, $cart_ignored, $user_type ) );
883
+
884
+ update_user_meta ( $user_id, '_woocommerce_ac_modified_cart', md5( "yes" ) );
885
+
886
+ $abandoned_cart_id = $wpdb->insert_id;
887
+ $_SESSION['abandoned_cart_id_lite'] = $abandoned_cart_id;
888
+ } else {
889
+ update_user_meta ( $user_id, '_woocommerce_ac_modified_cart', md5( "no" ) );
890
+ }
891
+ } else {
892
+ $updated_cart_info = json_encode( get_user_meta( $user_id, '_woocommerce_persistent_cart', true ) );
893
+
894
+ $query_update = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
895
+ SET abandoned_cart_info = %s,
896
+ abandoned_cart_time = %d
897
+ WHERE user_id = %d
898
+ AND cart_ignored = %s ";
899
+ $wpdb->query( $wpdb->prepare( $query_update, $updated_cart_info, $current_time, $user_id, $cart_ignored ) );
900
+
901
+ $query_update = "SELECT * FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE user_id ='" . $user_id . "' AND cart_ignored='0' ";
902
+ $get_abandoned_record = $wpdb->get_results( $query_update );
903
+ $abandoned_cart_id = $get_abandoned_record[0]->id;
904
+
905
+ $_SESSION['abandoned_cart_id_lite'] = $abandoned_cart_id;
906
+ }
907
+ } else {
908
+ //start here guest user
909
+ if ( isset( $_SESSION['user_id'] ) ) {
910
+ $user_id = $_SESSION['user_id'];
911
+ } else {
912
+ $user_id = "";
913
+ }
914
+
915
+ $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id = %d AND cart_ignored = '0' AND recovered_cart = '0'";
916
+ $results = $wpdb->get_results( $wpdb->prepare( $query, $user_id ) );
917
+ $cart = array();
918
+
919
+ if ( function_exists('WC') ) {
920
+ $cart['cart'] = WC()->session->cart;
921
+ } else {
922
+ $cart['cart'] = $woocommerce->session->cart;
923
+ }
924
+
925
+ $updated_cart_info = json_encode($cart);
926
+ $updated_cart_info = addslashes ( $updated_cart_info );
927
+
928
+ if ( $results ) {
929
+ if ( $compare_time > $results[0]->abandoned_cart_time ) {
930
+ if ( ! $this->wcal_compare_only_guest_carts( $updated_cart_info, $results[0]->abandoned_cart_info ) ) {
931
+
932
+ $query_ignored = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
933
+ SET cart_ignored = '1'
934
+ WHERE user_id ='".$user_id."'";
935
+ $wpdb->query( $query_ignored );
936
+ $user_type = 'GUEST';
937
+ $query_update = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
938
+ (user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type)
939
+ VALUES (%d, %s, %d, %s, %s)";
940
+ $wpdb->query( $wpdb->prepare( $query_update, $user_id, $updated_cart_info, $current_time, $cart_ignored, $user_type ) );
941
+ update_user_meta( $user_id, '_woocommerce_ac_modified_cart', md5("yes") );
942
+ } else {
943
+ update_user_meta( $user_id, '_woocommerce_ac_modified_cart', md5("no") );
944
+ }
945
+ } else {
946
+ $query_update = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
947
+ SET abandoned_cart_info = '".$updated_cart_info."', abandoned_cart_time = '".$current_time."'
948
+ WHERE user_id='".$user_id."' AND cart_ignored='0' ";
949
+ $wpdb->query( $query_update );
950
+ }
951
+ }
952
+ }
953
+ }
954
+
955
+ // Decrypt Function
956
+ function wcal_decrypt_validate( $validate ) {
957
+ $cryptKey = get_option( 'wcal_security_key' );
958
+ $validate_decoded = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), base64_decode( $validate ), MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ), "\0");
959
+ return( $validate_decoded );
960
+ }
961
+
962
+ function wcal_email_unsubscribe( $args ) {
963
+ global $wpdb;
964
+
965
+ if ( isset( $_GET['wcal_track_unsubscribe'] ) && $_GET['wcal_track_unsubscribe'] == 'wcal_unsubscribe' ) {
966
+ $encoded_email_id = rawurldecode ( $_GET['validate'] );
967
+ $validate_email_id_string = str_replace ( " " , "+", $encoded_email_id);
968
+ $validate_email_address_string = '';
969
+ $validate_email_id_decode = 0;
970
+
971
+ if( isset( $_GET['track_email_id'] ) ) {
972
+ $encoded_email_address = rawurldecode ( $_GET['track_email_id'] );
973
+ $validate_email_address_string = str_replace ( " " , "+", $encoded_email_address);
974
+
975
+ if( isset( $validate_email_id_string ) ) {
976
+ if( function_exists( "mcrypt_encrypt" ) ) {
977
+ $validate_email_id_decode = $this->wcal_decrypt_validate( $validate_email_id_string );
978
+ } else {
979
+ $validate_email_id_decode = base64_decode( $validate_email_id_string );
980
+ }
981
+ }
982
+ $validate_email_address_string = $validate_email_address_string;
983
+ }
984
+
985
+ if( !preg_match('/^[1-9][0-9]*$/', $validate_email_id_decode ) ) { // This will decrypt more security
986
+ $cryptKey = get_option( 'wcal_security_key' );
987
+ $validate_email_id_decode = Wcal_Aes_Ctr::decrypt( $validate_email_id_string, $cryptKey, 256 );
988
+ }
989
+
990
+ $query_id = "SELECT * FROM `" . $wpdb->prefix . "ac_sent_history_lite` WHERE id = %d ";
991
+ $results_sent = $wpdb->get_results ( $wpdb->prepare( $query_id, $validate_email_id_decode ) );
992
+ $email_address = '';
993
+
994
+ if( isset( $results_sent[0] ) ) {
995
+ $email_address = $results_sent[0]->sent_email_id;
996
+ }
997
+
998
+ if( $validate_email_address_string == hash( 'sha256', $email_address ) ) {
999
+ $email_sent_id = $validate_email_id_decode;
1000
+ $get_ac_id_query = "SELECT abandoned_order_id FROM `" . $wpdb->prefix . "ac_sent_history_lite` WHERE id = %d";
1001
+ $get_ac_id_results = $wpdb->get_results( $wpdb->prepare( $get_ac_id_query , $email_sent_id ) );
1002
+ $user_id = 0;
1003
+
1004
+ if( isset( $get_ac_id_results[0] ) ) {
1005
+ $get_user_id_query = "SELECT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE id = %d";
1006
+ $get_user_results = $wpdb->get_results( $wpdb->prepare( $get_user_id_query , $get_ac_id_results[0]->abandoned_order_id ) );
1007
+ }
1008
+ if( isset( $get_user_results[0] ) ) {
1009
+ $user_id = $get_user_results[0]->user_id;
1010
+ }
1011
+
1012
+ $unsubscribe_query = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
1013
+ SET unsubscribe_link = '1'
1014
+ WHERE user_id= %d AND cart_ignored='0' ";
1015
+ $wpdb->query( $wpdb->prepare( $unsubscribe_query , $user_id ) );
1016
+ echo "Unsubscribed Successfully";
1017
+ sleep( 2 );
1018
+ $url = get_option( 'siteurl' );
1019
+ ?>
1020
+ <script>
1021
+ location.href = "<?php echo $url; ?>";
1022
+ </script>
1023
+ <?php
1024
+ }
1025
+ } else {
1026
+ return $args;
1027
+ }
1028
+ }
1029
+
1030
+ // It will track the URL of cart link from email
1031
+ function wcal_email_track_links( $template ) {
1032
+ global $woocommerce;
1033
+ $track_link = '';
1034
+
1035
+ if ( isset( $_GET['wcal_action'] ) ) {
1036
+ $track_link = $_GET['wcal_action'];
1037
+ }
1038
+
1039
+ if ( $track_link == 'track_links' ) {
1040
+ if( session_id() === '' ) {
1041
+ //session has not started
1042
+ session_start();
1043
+ }
1044
+
1045
+ global $wpdb;
1046
+ $validate_server_string = rawurldecode( $_GET ['validate'] );
1047
+ $validate_server_string = str_replace( " " , "+", $validate_server_string );
1048
+ $validate_encoded_string = $validate_server_string;
1049
+ $link_decode_test = base64_decode( $validate_encoded_string );
1050
+
1051
+ // it will check if any old email have open the link
1052
+ if ( preg_match( '/&url=/', $link_decode_test ) ) {
1053
+ $link_decode = $link_decode_test;
1054
+ } else {
1055
+ if( function_exists( "mcrypt_encrypt" ) ) {
1056
+ $link_decode = $this->wcal_decrypt_validate( $validate_encoded_string );
1057
+ } else {
1058
+ $link_decode = base64_decode( $validate_encoded_string );
1059
+ }
1060
+ }
1061
+
1062
+ if ( !preg_match( '/&url=/', $link_decode ) ) { // This will decrypt more security
1063
+ $cryptKey = get_option( 'wcal_security_key' );
1064
+ $link_decode = Wcal_Aes_Ctr::decrypt( $validate_encoded_string, $cryptKey, 256 );
1065
+ }
1066
+
1067
+
1068
+ $sent_email_id_pos = strpos( $link_decode, '&' );
1069
+
1070
+ $email_sent_id = substr( $link_decode , 0, $sent_email_id_pos );
1071
+ $_SESSION['email_sent_id'] = $email_sent_id;
1072
+ $url_pos = strpos( $link_decode, '=' );
1073
+ $url_pos = $url_pos + 1;
1074
+ $url = substr( $link_decode, $url_pos );
1075
+ $get_ac_id_query = "SELECT abandoned_order_id FROM `".$wpdb->prefix."ac_sent_history_lite` WHERE id = %d";
1076
+ $get_ac_id_results = $wpdb->get_results( $wpdb->prepare( $get_ac_id_query, $email_sent_id ) );
1077
+ $get_user_id_query = "SELECT user_id FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE id = %d";
1078
+ $get_user_results = $wpdb->get_results( $wpdb->prepare( $get_user_id_query, $get_ac_id_results[0]->abandoned_order_id ) );
1079
+ $user_id = 0;
1080
+
1081
+ if ( isset( $get_user_results ) && count( $get_user_results ) > 0 ) {
1082
+ $user_id = $get_user_results[0]->user_id;
1083
+ }
1084
+
1085
+ if ( $user_id == 0 ) {
1086
+ echo "Link expired";
1087
+ exit;
1088
+ }
1089
+
1090
+ $user = wp_set_current_user( $user_id );
1091
+
1092
+ if ( $user_id >= "63000000" ) {
1093
+ $query_guest = "SELECT * from `". $wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = %d";
1094
+ $results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $user_id ) );
1095
+ $query_cart = "SELECT recovered_cart FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id = %d";
1096
+ $results = $wpdb->get_results( $wpdb->prepare( $query_cart, $user_id ) );
1097
+
1098
+ if ( $results_guest && $results[0]->recovered_cart == '0' ) {
1099
+ $_SESSION['guest_first_name'] = $results_guest[0]->billing_first_name;
1100
+ $_SESSION['guest_last_name'] = $results_guest[0]->billing_last_name;
1101
+ $_SESSION['guest_email'] = $results_guest[0]->email_id;
1102
+ $_SESSION['user_id'] = $user_id;
1103
+ } else {
1104
+ wp_redirect( get_permalink( woocommerce_get_page_id( 'shop' ) ) );
1105
+ }
1106
+ }
1107
+
1108
+ if ( $user_id < "63000000" ) {
1109
+ $user_login = $user->data->user_login;
1110
+ wp_set_auth_cookie( $user_id );
1111
+ $my_temp = woocommerce_load_persistent_cart( $user_login, $user );
1112
+ do_action( 'wp_login', $user_login, $user );
1113
+
1114
+ if ( isset( $sign_in ) && is_wp_error( $sign_in ) ) {
1115
+ echo $sign_in->get_error_message();
1116
+ exit;
1117
+ }
1118
+ } else
1119
+ $my_temp = $this->wcal_load_guest_persistent_cart( $user_id );
1120
+
1121
+ if ( $email_sent_id > 0 && is_numeric( $email_sent_id ) ) {
1122
+ header( "Location: $url" );
1123
+ }
1124
+ } else
1125
+ return $template;
1126
+ }
1127
+
1128
+ // load the information of the guest user
1129
+ function wcal_load_guest_persistent_cart() {
1130
+ global $woocommerce;
1131
+ $saved_cart = json_decode( get_user_meta( $_SESSION['user_id'], '_woocommerce_persistent_cart',true ), true );
1132
+ $c = array();
1133
+ $cart_contents_total = $cart_contents_weight = $cart_contents_count = $cart_contents_tax = $total = $subtotal = $subtotal_ex_tax = $tax_total = 0;
1134
+
1135
+ foreach ( $saved_cart as $key => $value ) {
1136
+ foreach ( $value as $a => $b ) {
1137
+ $c['product_id'] = $b['product_id'];
1138
+ $c['variation_id'] = $b['variation_id'];
1139
+ $c['variation'] = $b['variation'];
1140
+ $c['quantity'] = $b['quantity'];
1141
+ $product_id = $b['product_id'];
1142
+ $c['data'] = get_product($product_id);
1143
+ $c['line_total'] = $b['line_total'];
1144
+ $c['line_tax'] = $cart_contents_tax;
1145
+ $c['line_subtotal'] = $b['line_subtotal'];
1146
+ $c['line_subtotal_tax'] = $cart_contents_tax;
1147
+ $value_new[ $a ] = $c;
1148
+ $cart_contents_total = $b['line_subtotal'] + $cart_contents_total;
1149
+ $cart_contents_count = $cart_contents_count + $b['quantity'];
1150
+ $total = $total + $b['line_total'];
1151
+ $subtotal = $subtotal + $b['line_subtotal'];
1152
+ $subtotal_ex_tax = $subtotal_ex_tax + $b['line_subtotal'];
1153
+ }
1154
+ $saved_cart_data[ $key ] = $value_new;
1155
+ $woocommerce_cart_hash = $a;
1156
+ }
1157
+
1158
+ if( $saved_cart ) {
1159
+ if ( empty( $woocommerce->session->cart ) || ! is_array( $woocommerce->session->cart ) || sizeof( $woocommerce->session->cart ) == 0 ) {
1160
+ $woocommerce->session->cart = $saved_cart['cart'];
1161
+ $woocommerce->session->cart_contents_total = $cart_contents_total;
1162
+ $woocommerce->session->cart_contents_weight = $cart_contents_weight;
1163
+ $woocommerce->session->cart_contents_count = $cart_contents_count;
1164
+ $woocommerce->session->cart_contents_tax = $cart_contents_tax;
1165
+ $woocommerce->session->total = $total;
1166
+ $woocommerce->session->subtotal = $subtotal;
1167
+ $woocommerce->session->subtotal_ex_tax = $subtotal_ex_tax;
1168
+ $woocommerce->session->tax_total = $tax_total;
1169
+ $woocommerce->session->shipping_taxes = array();
1170
+ $woocommerce->session->taxes = array();
1171
+ $woocommerce->session->ac_customer = array();
1172
+ $woocommerce->cart->cart_contents = $saved_cart_data['cart'];
1173
+ $woocommerce->cart->cart_contents_total = $cart_contents_total;
1174
+ $woocommerce->cart->cart_contents_weight = $cart_contents_weight;
1175
+ $woocommerce->cart->cart_contents_count = $cart_contents_count;
1176
+ $woocommerce->cart->cart_contents_tax = $cart_contents_tax;
1177
+ $woocommerce->cart->total = $total;
1178
+ $woocommerce->cart->subtotal = $subtotal;
1179
+ $woocommerce->cart->subtotal_ex_tax = $subtotal_ex_tax;
1180
+ $woocommerce->cart->tax_total = $tax_total;
1181
+ }
1182
+ }
1183
+ }
1184
+
1185
+ function wcal_compare_only_guest_carts( $new_cart, $last_abandoned_cart ) {
1186
+ $current_woo_cart = array();
1187
+ $current_woo_cart = json_decode( stripslashes( $new_cart ), true );
1188
+ $abandoned_cart_arr = array();
1189
+ $abandoned_cart_arr = json_decode( $last_abandoned_cart, true );
1190
+ $temp_variable = "";
1191
+
1192
+ if( count( $current_woo_cart['cart'] ) >= count( $abandoned_cart_arr['cart'] ) ) {
1193
+ //do nothing
1194
+ } else {
1195
+ $temp_variable = $current_woo_cart;
1196
+ $current_woo_cart = $abandoned_cart_arr;
1197
+ $abandoned_cart_arr = $temp_variable;
1198
+ }
1199
+ if( is_array( $current_woo_cart ) || is_object( $current_woo_cart ) ) {
1200
+ foreach( $current_woo_cart as $key => $value ) {
1201
+ foreach( $value as $item_key => $item_value ) {
1202
+ $current_cart_product_id = $item_value['product_id'];
1203
+ $current_cart_variation_id = $item_value['variation_id'];
1204
+ $current_cart_quantity = $item_value['quantity'];
1205
+
1206
+ if( isset( $abandoned_cart_arr[$key][$item_key]['product_id'] ) ){
1207
+ $abandoned_cart_product_id = $abandoned_cart_arr[$key][$item_key]['product_id'];
1208
+ } else {
1209
+ $abandoned_cart_product_id = "";
1210
+ }
1211
+ if( isset( $abandoned_cart_arr[$key][$item_key]['variation_id'] ) ) {
1212
+ $abandoned_cart_variation_id = $abandoned_cart_arr[$key][$item_key]['variation_id'];
1213
+ } else {
1214
+ $abandoned_cart_variation_id = "";
1215
+ }
1216
+ if( isset( $abandoned_cart_arr[$key][$item_key]['quantity'] ) ) {
1217
+ $abandoned_cart_quantity = $abandoned_cart_arr[$key][$item_key]['quantity'];
1218
+ } else {
1219
+ $abandoned_cart_quantity = "";
1220
+ }
1221
+ if( ( $current_cart_product_id != $abandoned_cart_product_id ) ||
1222
+ ( $current_cart_variation_id != $abandoned_cart_variation_id ) ||
1223
+ ( $current_cart_quantity != $abandoned_cart_quantity ) ) {
1224
+ return false;
1225
+ }
1226
+ }
1227
+ }
1228
+ }
1229
+ return true;
1230
+ }
1231
+
1232
+ // Compare the existing cart with new cart
1233
+ function wcal_compare_carts( $user_id, $last_abandoned_cart ) {
1234
+ $current_woo_cart = get_user_meta( $user_id, '_woocommerce_persistent_cart', true );
1235
+ $abandoned_cart_arr = json_decode( $last_abandoned_cart, true );
1236
+ $temp_variable = "";
1237
+
1238
+ if ( count( $current_woo_cart['cart'] ) >= count( $abandoned_cart_arr['cart'] ) ) {
1239
+ //do nothing
1240
+ }
1241
+ else {
1242
+ $temp_variable = $current_woo_cart;
1243
+ $current_woo_cart = $abandoned_cart_arr;
1244
+ $abandoned_cart_arr = $temp_variable;
1245
+ }
1246
+ foreach ( $current_woo_cart as $key => $value ) {
1247
+
1248
+ foreach ( $value as $item_key => $item_value ) {
1249
+ $current_cart_product_id = $item_value['product_id'];
1250
+ $current_cart_variation_id = $item_value['variation_id'];
1251
+ $current_cart_quantity = $item_value['quantity'];
1252
+
1253
+ if ( isset( $abandoned_cart_arr[$key][$item_key]['product_id'] ) ) {
1254
+ $abandoned_cart_product_id = $abandoned_cart_arr[$key][$item_key]['product_id'];
1255
+ } else {
1256
+ $abandoned_cart_product_id = "";
1257
+ }
1258
+ if ( isset( $abandoned_cart_arr[$key][$item_key]['variation_id'] ) ) {
1259
+ $abandoned_cart_variation_id = $abandoned_cart_arr[$key][$item_key]['variation_id'];
1260
+ } else {
1261
+ $abandoned_cart_variation_id = "";
1262
+ }
1263
+ if ( isset( $abandoned_cart_arr[$key][$item_key]['quantity'] ) ) {
1264
+ $abandoned_cart_quantity = $abandoned_cart_arr[$key][$item_key]['quantity'];
1265
+ } else {
1266
+ $abandoned_cart_quantity = "";
1267
+ }
1268
+ if ( ( $current_cart_product_id != $abandoned_cart_product_id ) ||
1269
+ ( $current_cart_variation_id != $abandoned_cart_variation_id ) ||
1270
+ ( $current_cart_quantity != $abandoned_cart_quantity ) )
1271
+ {
1272
+ return false;
1273
+ }
1274
+ }
1275
+ }
1276
+ return true;
1277
+ }
1278
+
1279
+ // function is call when order is recovered
1280
+ function wcal_action_after_delivery_session( $order ) {
1281
+
1282
+ if( session_id() === '' ){
1283
+ //session has not started
1284
+ session_start();
1285
+ }
1286
+ global $wpdb;
1287
+ $order_id = $order->id;
1288
+ $get_abandoned_id_of_order = '';
1289
+ $get_sent_email_id_of_order = '';
1290
+ $get_abandoned_id_of_order = get_post_meta( $order_id, 'wcal_recover_order_placed', true );
1291
+
1292
+ if( isset( $get_abandoned_id_of_order ) && $get_abandoned_id_of_order != '' ){
1293
+ $get_abandoned_id_of_order = get_post_meta( $order_id, 'wcal_recover_order_placed', true );
1294
+ $get_sent_email_id_of_order = get_post_meta( $order_id, 'wcal_recover_order_placed_sent_id', true );
1295
+
1296
+ $query_order = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` SET recovered_cart= '" . $order_id . "', cart_ignored = '1'
1297
+ WHERE id = '".$get_abandoned_id_of_order."' ";
1298
+ $wpdb->query( $query_order );
1299
+
1300
+ $order->add_order_note( __( 'This order was abandoned & subsequently recovered.', 'woocommerce-ac' ) );
1301
+
1302
+ delete_post_meta( $order_id, 'wcal_recover_order_placed', $get_abandoned_id_of_order );
1303
+ delete_post_meta( $order_id , 'wcal_recover_order_placed_sent_id', $get_sent_email_id_of_order );
1304
+ }
1305
+ $user_id = get_current_user_id();
1306
+ $sent_email = '';
1307
+ if( isset( $_SESSION['email_sent_id'] ) ){
1308
+ $sent_email = $_SESSION['email_sent_id'];
1309
+ }
1310
+ if( $user_id == "" ) {
1311
+ $user_id = $_SESSION['user_id'];
1312
+ // Set the session variables to blanks
1313
+ $_SESSION['guest_first_name'] = $_SESSION['guest_last_name'] = $_SESSION['guest_email'] = $_SESSION['user_id'] = "";
1314
+ }
1315
+ delete_user_meta( $user_id, '_woocommerce_ac_persistent_cart_time' );
1316
+ delete_user_meta( $user_id, '_woocommerce_ac_persistent_cart_temp_time' );
1317
+
1318
+ // get all latest abandoned carts that were modified
1319
+ $cart_ignored = 0;
1320
+ $recovered_cart = 0;
1321
+ $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1322
+ WHERE user_id = %d
1323
+ AND cart_ignored = %s
1324
+ AND recovered_cart = %d
1325
+ ORDER BY id DESC
1326
+ LIMIT 1";
1327
+ $results = $wpdb->get_results( $wpdb->prepare( $query, $user_id, $cart_ignored, $recovered_cart ) );
1328
+
1329
+ if ( count( $results ) > 0 ) {
1330
+ if ( get_user_meta( $user_id, '_woocommerce_ac_modified_cart', true ) == md5( "yes" ) ||
1331
+ get_user_meta( $user_id, '_woocommerce_ac_modified_cart', true ) == md5( "no" ) ) {
1332
+
1333
+ $order_id = $order->id;
1334
+ $updated_cart_ignored = 1;
1335
+ $query_order = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1336
+ SET recovered_cart = %d,
1337
+ cart_ignored = %s
1338
+ WHERE id = %d ";
1339
+ $wpdb->query( $wpdb->prepare( $query_order, $order_id, $updated_cart_ignored, $results[0]->id ) );
1340
+ delete_user_meta( $user_id, '_woocommerce_ac_modified_cart' );
1341
+ delete_post_meta( $order_id, 'wcap_recovered_email_sent', 'yes' );
1342
+
1343
+ } else {
1344
+ $delete_query = "DELETE FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1345
+ WHERE id= %d ";
1346
+ $wpdb->query( $wpdb->prepare( $delete_query, $results[0]->id ) );
1347
+ }
1348
+ } else {
1349
+ $email_id = $order->billing_email;
1350
+ $query = "SELECT * FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE email_id = %s";
1351
+ $results_id = $wpdb->get_results( $wpdb->prepare( $query, $email_id ) );
1352
+
1353
+ if ( $results_id ) {
1354
+ $record_status = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1355
+ WHERE user_id = %d AND recovered_cart = '0'";
1356
+ $results_status = $wpdb->get_results( $wpdb->prepare( $record_status, $results_id[0]->id ) );
1357
+
1358
+ if ( $results_status ) {
1359
+ if ( get_user_meta( $results_id[0]->id, '_woocommerce_ac_modified_cart', true ) == md5("yes") ||
1360
+ get_user_meta( $results_id[0]->id, '_woocommerce_ac_modified_cart', true ) == md5("no") ) {
1361
+
1362
+ $order_id = $order->id;
1363
+ $query_order = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
1364
+ SET recovered_cart= '".$order_id."', cart_ignored = '1'
1365
+ WHERE id='".$results_status[0]->id."' ";
1366
+ $wpdb->query( $query_order );
1367
+ delete_user_meta( $results_id[0]->id, '_woocommerce_ac_modified_cart' );
1368
+ delete_post_meta( $order_id, 'wcap_recovered_email_sent', 'yes' );
1369
+ } else {
1370
+ $delete_guest = "DELETE FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = '".$results_id[0]->id."'";
1371
+ $wpdb->query( $delete_guest );
1372
+
1373
+ $delete_query = "DELETE FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id='".$results_id[0]->id."' ";
1374
+ $wpdb->query( $delete_query );
1375
+ }
1376
+ }
1377
+ }
1378
+ }
1379
+ }
1380
+
1381
+ function wcal_action_admin_init() {
1382
+ global $typenow;
1383
+ // only hook up these filters if we're in the admin panel and the current user has permission
1384
+ // to edit posts and pages
1385
+ if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) {
1386
+ return;
1387
+ }
1388
+
1389
+ if ( !isset( $_GET['page'] ) || $_GET['page'] != "woocommerce_ac_page" ) {
1390
+ return;
1391
+ }
1392
+
1393
+ if ( get_user_option( 'rich_editing' ) == 'true' ) {
1394
+ remove_filter( 'the_excerpt', 'wpautop' );
1395
+ add_filter( 'tiny_mce_before_init', array( &$this, 'wcal_format_tiny_MCE' ) );
1396
+ add_filter( 'mce_buttons', array( &$this, 'wcal_filter_mce_button' ) );
1397
+ add_filter( 'mce_external_plugins', array( &$this, 'wcal_filter_mce_plugin' ) );
1398
+ }
1399
+
1400
+ if ( isset( $_GET['page'] ) && 'woocommerce_ac_page' == $_GET['page'] ) {
1401
+ if( session_id() === '' ){
1402
+ //session has not started
1403
+ session_start();
1404
+ }
1405
+ }
1406
+ }
1407
+
1408
+ function wcal_filter_mce_button( $buttons ) {
1409
+ // add a separation before our button, here our button's id is &quot;mygallery_button&quot;
1410
+ array_push( $buttons, 'abandoncart', '|' );
1411
+ return $buttons;
1412
+ }
1413
+
1414
+ function wcal_filter_mce_plugin( $plugins ) {
1415
+ // this plugin file will work the magic of our button
1416
+ $plugins['abandoncart'] = plugin_dir_url( __FILE__ ) . 'assets/js/abandoncart_plugin_button.js';
1417
+ return $plugins;
1418
+ }
1419
+
1420
+ function wcal_display_tabs() {
1421
+
1422
+ if ( isset( $_GET['action'] ) ) {
1423
+ $action = $_GET['action'];
1424
+ } else {
1425
+ $action = "";
1426
+ $active_listcart = "";
1427
+ $active_emailtemplates = "";
1428
+ $active_settings = "";
1429
+ $active_stats = "";
1430
+ }
1431
+ if ( ( $action == 'listcart' || $action == 'orderdetails' ) || $action == '' ) {
1432
+ $active_listcart = "nav-tab-active";
1433
+ }
1434
+ if ( $action == 'emailtemplates' ) {
1435
+ $active_emailtemplates = "nav-tab-active";
1436
+ }
1437
+ if ( $action == 'emailsettings' ) {
1438
+ $active_settings = "nav-tab-active";
1439
+ }
1440
+ if ( $action == 'stats' ) {
1441
+ $active_stats = "nav-tab-active";
1442
+ }
1443
+ if ( $action == 'report' ) {
1444
+ $active_report = "nav-tab-active";
1445
+ }
1446
+
1447
+ ?>
1448
+
1449
+ <div style="background-image: url('<?php echo plugins_url(); ?>/woocommerce-abandoned-cart/assets/images/ac_tab_icon.png') !important;" class="icon32"><br>
1450
+ </div>
1451
+ <h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
1452
+ <a href="admin.php?page=woocommerce_ac_page&action=listcart" class="nav-tab <?php if (isset($active_listcart)) echo $active_listcart; ?>"> <?php _e( 'Abandoned Orders', 'woocommerce-ac' );?> </a>
1453
+ <a href="admin.php?page=woocommerce_ac_page&action=emailtemplates" class="nav-tab <?php if (isset($active_emailtemplates)) echo $active_emailtemplates; ?>"> <?php _e( 'Email Templates', 'woocommerce-ac' );?> </a>
1454
+ <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-ac' );?> </a>
1455
+ <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-ac' );?> </a>
1456
+ <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-ac' );?> </a>
1457
+ </h2>
1458
+ <?php
1459
+ }
1460
+
1461
+ function wcal_enqueue_scripts_js( $hook ) {
1462
+
1463
+ if ( $hook != 'woocommerce_page_woocommerce_ac_page' ) {
1464
+ return;
1465
+ } else {
1466
+ wp_enqueue_script( 'jquery' );
1467
+ wp_enqueue_script(
1468
+ 'jquery-ui-min',
1469
+ '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js',
1470
+ '',
1471
+ '',
1472
+ false
1473
+ );
1474
+ wp_enqueue_script( 'jquery-ui-datepicker' );
1475
+
1476
+ wp_enqueue_script(
1477
+ 'jquery-tip',
1478
+ plugins_url( '/assets/js/jquery.tipTip.minified.js', __FILE__ ),
1479
+ '',
1480
+ '',
1481
+ false
1482
+ );
1483
+ wp_register_script( 'woocommerce_admin', plugins_url() . '/woocommerce/assets/js/admin/woocommerce_admin.js', array( 'jquery', 'jquery-ui-widget', 'jquery-ui-core' ) );
1484
+ wp_enqueue_script( 'woocommerce_admin' );
1485
+ ?>
1486
+ <script type="text/javascript" >
1487
+ function wcal_activate_email_template( template_id, active_state ) {
1488
+ location.href = 'admin.php?page=woocommerce_ac_page&action=emailtemplates&mode=activate_template&id='+template_id+'&active_state='+active_state ;
1489
+ }
1490
+ </script>
1491
+ <?php
1492
+ $js_src = includes_url('js/tinymce/') . 'tinymce.min.js';
1493
+ wp_enqueue_script( 'tinyMce_ac',$js_src );
1494
+ wp_enqueue_script( 'ac_email_variables', plugins_url() . '/woocommerce-abandoned-cart/assets/js/abandoncart_plugin_button.js' );
1495
+ }
1496
+ }
1497
+
1498
+ function wcal_format_tiny_MCE( $in ) {
1499
+ $in['force_root_block'] = false;
1500
+ $in['valid_children'] = '+body[style]';
1501
+ $in['remove_linebreaks'] = false;
1502
+ $in['gecko_spellcheck'] = false;
1503
+ $in['keep_styles'] = true;
1504
+ $in['accessibility_focus'] = true;
1505
+ $in['tabfocus_elements'] = 'major-publishing-actions';
1506
+ $in['media_strict'] = false;
1507
+ $in['paste_remove_styles'] = false;
1508
+ $in['paste_remove_spans'] = false;
1509
+ $in['paste_strip_class_attributes'] = 'none';
1510
+ $in['paste_text_use_dialog'] = true;
1511
+ $in['wpeditimage_disable_captions'] = true;
1512
+ $in['wpautop'] = false;
1513
+ $in['apply_source_formatting'] = true;
1514
+ $in['cleanup'] = true;
1515
+ $in['convert_newlines_to_brs'] = FALSE;
1516
+ $in['fullpage_default_xml_pi'] = false;
1517
+ $in['convert_urls'] = false;
1518
+ // Do not remove redundant BR tags
1519
+ $in['remove_redundant_brs'] = false;
1520
+ return $in;
1521
+ }
1522
+
1523
+ function wcal_enqueue_scripts_css( $hook ) {
1524
+ if ( $hook != 'woocommerce_page_woocommerce_ac_page' ) {
1525
+ return;
1526
+ } else {
1527
+ wp_enqueue_style( 'jquery-ui', "//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" , '', '', false );
1528
+ wp_enqueue_style( 'woocommerce_admin_styles', plugins_url() . '/woocommerce/assets/css/admin.css' );
1529
+ wp_enqueue_style( 'jquery-ui-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' );
1530
+ wp_enqueue_style( 'abandoned-orders-list', plugins_url() . '/woocommerce-abandoned-cart/assets/css/view.abandoned.orders.style.css' );
1531
+
1532
+ }
1533
+ }
1534
+ //bulk action
1535
+ // to over come the wp redirect warning while deleting
1536
+ function wcal_app_output_buffer() {
1537
+ ob_start();
1538
+ }
1539
+
1540
+ /**
1541
+ * Abandon Cart Settings Page
1542
+ */
1543
+ function wcal_menu_page() {
1544
+
1545
+ if ( is_user_logged_in() ) {
1546
+ global $wpdb;
1547
+
1548
+ // Check the user capabilities
1549
+ if ( !current_user_can( 'manage_woocommerce' ) ) {
1550
+ wp_die( __( 'You do not have sufficient permissions to access this page.', 'woocommerce-ac' ) );
1551
+ }
1552
+ ?>
1553
+ <div class="wrap">
1554
+ <h2><?php _e( 'WooCommerce - Abandon Cart Lite', 'woocommerce-ac' ); ?></h2>
1555
+ <?php
1556
+
1557
+ if ( isset( $_GET['action'] ) ) {
1558
+ $action = $_GET['action'];
1559
+ } else {
1560
+ $action = "";
1561
+ }
1562
+ if ( isset( $_GET['mode'] ) ) {
1563
+ $mode = $_GET['mode'];
1564
+ } else {
1565
+ $mode = "";
1566
+ }
1567
+ $this->wcal_display_tabs();
1568
+
1569
+ /**
1570
+ * When we delete the item from the below drop down it is registred in action 2
1571
+ */
1572
+ if ( isset( $_GET['action2'] ) ) {
1573
+ $action_two = $_GET['action2'];
1574
+ } else {
1575
+ $action_two = "";
1576
+ }
1577
+ // Detect when a bulk action is being triggered on abandoned orders page.
1578
+ if( 'wcal_delete' === $action || 'wcal_delete' === $action_two ) {
1579
+ $ids = isset( $_GET['abandoned_order_id'] ) ? $_GET['abandoned_order_id'] : false;
1580
+ if ( ! is_array( $ids ) ) {
1581
+ $ids = array( $ids );
1582
+ }
1583
+ foreach ( $ids as $id ) {
1584
+ $class = new wcal_delete_bulk_action_handler();
1585
+ $class->wcal_delete_bulk_action_handler_function( $id );
1586
+ }
1587
+ }
1588
+ //Detect when a bulk action is being triggered on temnplates page.
1589
+ if( 'wcal_delete_template' === $action || 'wcal_delete_template' === $action_two ) {
1590
+ $ids = isset( $_GET['template_id'] ) ? $_GET['template_id'] : false;
1591
+ if ( ! is_array( $ids ) ) {
1592
+ $ids = array( $ids );
1593
+ }
1594
+ foreach ( $ids as $id ) {
1595
+ $class = new wcal_delete_bulk_action_handler();
1596
+ $class->wcal_delete_template_bulk_action_handler_function( $id );
1597
+ }
1598
+ }
1599
+
1600
+ if ( isset( $_GET['wcal_deleted'] ) && 'YES' == $_GET['wcal_deleted'] ) { ?>
1601
+ <div id="message" class="updated fade">
1602
+ <p><strong><?php _e( 'The Abandoned cart has been successfully deleted.', 'woocommerce-ac' ); ?></strong></p>
1603
+ </div>
1604
+ <?php }
1605
+
1606
+ if ( isset( $_GET ['wcal_template_deleted'] ) && 'YES' == $_GET['wcal_template_deleted'] ) { ?>
1607
+ <div id="message" class="updated fade">
1608
+ <p><strong><?php _e( 'The Template has been successfully deleted.', 'woocommerce-ac' ); ?></strong></p>
1609
+ </div>
1610
+ <?php }
1611
+
1612
+ if ( $action == 'emailsettings' ) {
1613
+ // Save the field values
1614
+ ?>
1615
+ <p><?php _e( 'Change settings for sending email notifications to Customers after X minute.', 'woocommerce-ac' ); ?></p>
1616
+ <div id="content">
1617
+ <form method="post" action="options.php">
1618
+ <?php settings_fields( 'woocommerce_ac_settings' ); ?>
1619
+ <?php do_settings_sections( 'woocommerce_ac_page' ); ?>
1620
+ <?php settings_errors(); ?>
1621
+ <?php submit_button(); ?>
1622
+
1623
+ </form>
1624
+ </div>
1625
+ <?php
1626
+ } elseif ( $action == 'listcart' || '' == $action || '-1' == $action || '-1' == $action_two ) {
1627
+ ?>
1628
+ <p> <?php _e( 'The list below shows all Abandoned Carts which have remained in cart for a time higher than the "Cart abandoned cut-off time" setting.', 'woocommerce-ac' );?> </p>
1629
+ <?php
1630
+ global $wpdb;
1631
+
1632
+ include_once( 'includes/classes/class-wcal-abandoned-orders-table.php' );
1633
+ $wcal_abandoned_order_list = new WCAL_Abandoned_Orders_Table();
1634
+ $wcal_abandoned_order_list->wcal_abandoned_order_prepare_items();
1635
+ ?>
1636
+ <div class="wrap">
1637
+ <form id="wcal-abandoned-orders" method="get" >
1638
+ <input type="hidden" name="page" value="woocommerce_ac_page" />
1639
+ <input type="hidden" name="action" value="listcart" />
1640
+ <?php $wcal_abandoned_order_list->display(); ?>
1641
+ </form>
1642
+ </div>
1643
+ <?php
1644
+ } elseif ( $action == 'emailtemplates' && ( $mode != 'edittemplate' && $mode != 'addnewtemplate' ) ) {
1645
+ ?>
1646
+ <p> <?php _e( 'Add email templates at different intervals to maximize the possibility of recovering your abandoned carts.', 'woocommerce-ac' );?> </p>
1647
+ <?php
1648
+
1649
+ // Save the field values
1650
+ $insert_template_successfuly = $update_template_successfuly = '';
1651
+ if( isset( $_POST['ac_settings_frm'] ) && $_POST['ac_settings_frm'] == 'save' ) {
1652
+ $active_post = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1653
+ $is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
1654
+
1655
+ if ( $active_post == 1 ) {
1656
+ $is_active = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1657
+ $email_frequency = trim( $_POST['email_frequency'] );
1658
+ $day_or_hour = trim( $_POST['day_or_hour'] );
1659
+
1660
+ $check_query = "SELECT * FROM `".$wpdb->prefix."ac_email_templates_lite`
1661
+ WHERE is_active = %s
1662
+ AND frequency = %d
1663
+ AND day_or_hour = %s ";
1664
+ $check_results = $wpdb->get_results( $wpdb->prepare( $check_query, $is_active, $email_frequency, $day_or_hour ) );
1665
+ $default_value = 0 ;
1666
+
1667
+ if ( count( $check_results ) == 0 ) {
1668
+ $active_post = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1669
+ $woocommerce_ac_email_subject = trim( $_POST['woocommerce_ac_email_subject'] );
1670
+ $woocommerce_ac_email_body = trim( $_POST['woocommerce_ac_email_body'] );
1671
+ $woocommerce_ac_template_name = trim( $_POST['woocommerce_ac_template_name'] );
1672
+ $woocommerce_ac_from_name = trim( $_POST['woocommerce_ac_from_name'] );
1673
+ $woocommerce_ac_email_reply = trim( $_POST['woocommerce_ac_email_reply'] );
1674
+ $woocommerce_ac_email_from = trim( $_POST['woocommerce_ac_email_from'] );
1675
+ $woocommerce_ac_email_header = trim( $_POST['wcal_wc_email_header'] );
1676
+ $query = "INSERT INTO `".$wpdb->prefix."ac_email_templates_lite`
1677
+ (subject, body, is_active, frequency, day_or_hour, template_name, from_name, is_wc_template, default_template, reply_email, from_email, wc_email_header )
1678
+ VALUES ( %s, %s, %s, %d, %s, %s, %s, %s, %d, %s, %s, %s )"; //It is fix
1679
+
1680
+ $insert_template_successfuly = $wpdb->query( $wpdb->prepare( $query,
1681
+ $woocommerce_ac_email_subject,
1682
+ $woocommerce_ac_email_body,
1683
+ $active_post,
1684
+ $email_frequency,
1685
+ $day_or_hour,
1686
+ $woocommerce_ac_template_name,
1687
+ $woocommerce_ac_from_name,
1688
+ $is_wc_template,
1689
+ $default_value,
1690
+ $woocommerce_ac_email_reply,
1691
+ $woocommerce_ac_email_from,
1692
+ $woocommerce_ac_email_header)
1693
+ );
1694
+ } else {
1695
+ $update_is_active = 0;
1696
+ $query_update = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1697
+ SET
1698
+ is_active = %s
1699
+ WHERE frequency = %d
1700
+ AND day_or_hour = %s ";
1701
+ $update_template_successfuly = $wpdb->query($wpdb->prepare( $query_update, $update_is_active, $email_frequency, $day_or_hour ) );
1702
+
1703
+ $woocommerce_ac_email_subject = trim( $_POST['woocommerce_ac_email_subject'] );
1704
+ $woocommerce_ac_email_body = trim( $_POST['woocommerce_ac_email_body'] );
1705
+ $woocommerce_ac_template_name = trim( $_POST['woocommerce_ac_template_name'] );
1706
+ $woocommerce_ac_from_name = trim( $_POST['woocommerce_ac_from_name'] );
1707
+ $woocommerce_ac_email_from = trim( $_POST['woocommerce_ac_email_from'] );
1708
+ $woocommerce_ac_email_reply = trim( $_POST['woocommerce_ac_email_reply'] );
1709
+ $woocommerce_ac_email_header = trim( $_POST['wcal_wc_email_header'] );
1710
+ $query_insert_new = "INSERT INTO `".$wpdb->prefix."ac_email_templates_lite`
1711
+ (subject, body, is_active, frequency, day_or_hour, template_name, from_name, is_wc_template, default_template, reply_email, from_email, wc_email_header )
1712
+ VALUES ( %s, %s, %s, %d, %s, %s, %s, %s, %d, %s, %s, %s )";
1713
+
1714
+ $insert_template_successfuly = $wpdb->query( $wpdb->prepare( $query_insert_new,
1715
+ $woocommerce_ac_email_subject,
1716
+ $woocommerce_ac_email_body,
1717
+ $active_post,
1718
+ $email_frequency,
1719
+ $day_or_hour,
1720
+ $woocommerce_ac_template_name,
1721
+ $woocommerce_ac_from_name,
1722
+ $is_wc_template,
1723
+ $default_value,
1724
+ $woocommerce_ac_email_reply,
1725
+ $woocommerce_ac_email_from,
1726
+ $woocommerce_ac_email_header )
1727
+ );
1728
+ }
1729
+ } else {
1730
+ $woocommerce_ac_email_subject = trim( $_POST['woocommerce_ac_email_subject'] );
1731
+ $woocommerce_ac_email_body = trim( $_POST['woocommerce_ac_email_body'] );
1732
+ $woocommerce_ac_template_name = trim( $_POST['woocommerce_ac_template_name'] );
1733
+ $woocommerce_ac_from_name = trim( $_POST['woocommerce_ac_from_name'] );
1734
+ $woocommerce_ac_email_reply = trim( $_POST['woocommerce_ac_email_reply'] );
1735
+ $woocommerce_ac_email_from = trim( $_POST['woocommerce_ac_email_from'] );
1736
+ $woocommerce_ac_email_header = trim( $_POST['wcal_wc_email_header'] );
1737
+ $active_post = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1738
+ $email_frequency = trim( $_POST['email_frequency'] );
1739
+ $day_or_hour = trim( $_POST['day_or_hour'] );
1740
+ $is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
1741
+ $default_value = 0 ;
1742
+
1743
+ $query = "INSERT INTO `".$wpdb->prefix."ac_email_templates_lite`
1744
+ (subject, body, is_active, frequency, day_or_hour, template_name, from_name, is_wc_template, default_template, reply_email, from_email, wc_email_header )
1745
+ VALUES ( %s, %s, %s, %d, %s, %s, %s, %s, %d, %s, %s, %s )";
1746
+
1747
+ $insert_template_successfuly = $wpdb->query( $wpdb->prepare( $query,
1748
+ $woocommerce_ac_email_subject,
1749
+ $woocommerce_ac_email_body,
1750
+ $active_post,
1751
+ $email_frequency,
1752
+ $day_or_hour,
1753
+ $woocommerce_ac_template_name,
1754
+ $woocommerce_ac_from_name,
1755
+ $is_wc_template,
1756
+ $default_value,
1757
+ $woocommerce_ac_email_reply,
1758
+ $woocommerce_ac_email_from,
1759
+ $woocommerce_ac_email_header )
1760
+ );
1761
+ }
1762
+ }
1763
+
1764
+ if( isset( $_POST['ac_settings_frm'] ) && $_POST['ac_settings_frm'] == 'update' ) {
1765
+ $active = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1766
+ $is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
1767
+
1768
+ if ( $active == 1 ) {
1769
+ $is_active = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1770
+ $email_frequency = trim( $_POST['email_frequency'] );
1771
+ $day_or_hour = trim( $_POST['day_or_hour'] );
1772
+ $check_query = "SELECT * FROM `".$wpdb->prefix."ac_email_templates_lite`
1773
+ WHERE is_active= %s
1774
+ AND frequency = %d
1775
+ AND day_or_hour= %s ";
1776
+ $check_results = $wpdb->get_results( $wpdb->prepare( $check_query, $is_active, $email_frequency, $day_or_hour ) );
1777
+ $default_value = '';
1778
+
1779
+ foreach( $check_results as $result_key => $result_value ) {
1780
+ $default_value = ( empty( $result_value->default_template ) ) ? 0 : $result_value->default_template;
1781
+ }
1782
+
1783
+ if( count( $check_results ) == 0 ) {
1784
+ $woocommerce_ac_email_subject = trim( $_POST['woocommerce_ac_email_subject'] );
1785
+ $woocommerce_ac_email_body = trim( $_POST['woocommerce_ac_email_body'] );
1786
+ $woocommerce_ac_template_name = trim( $_POST['woocommerce_ac_template_name'] );
1787
+ $woocommerce_ac_from_name = trim( $_POST['woocommerce_ac_from_name'] );
1788
+ $woocommerce_ac_email_from = trim( $_POST['woocommerce_ac_email_from'] );
1789
+ $woocommerce_ac_email_reply = trim( $_POST['woocommerce_ac_email_reply'] );
1790
+ $woocommerce_ac_email_header = trim( $_POST['wcal_wc_email_header'] );
1791
+ $id = trim( $_POST['id'] );
1792
+
1793
+ $query_update = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1794
+ SET
1795
+ subject = %s,
1796
+ body = %s,
1797
+ is_active = %s,
1798
+ frequency = %d,
1799
+ day_or_hour = %s,
1800
+ template_name = %s,
1801
+ from_name = %s,
1802
+ is_wc_template = %s,
1803
+ default_template = %d,
1804
+ reply_email = %s,
1805
+ from_email = %s,
1806
+ wc_email_header = %s
1807
+ WHERE id = %d ";
1808
+ $update_template_successfuly = $wpdb->query($wpdb->prepare( $query_update,
1809
+ $woocommerce_ac_email_subject,
1810
+ $woocommerce_ac_email_body,
1811
+ $active,
1812
+ $email_frequency,
1813
+ $day_or_hour,
1814
+ $woocommerce_ac_template_name,
1815
+ $woocommerce_ac_from_name,
1816
+ $is_wc_template,
1817
+ $default_value,
1818
+ $woocommerce_ac_email_from,
1819
+ $woocommerce_ac_email_reply,
1820
+ $woocommerce_ac_email_header,
1821
+ $id )
1822
+
1823
+ );
1824
+ } else {
1825
+ $updated_is_active = 0;
1826
+ $query_update_new = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1827
+ SET is_active = %s
1828
+ WHERE frequency = %d
1829
+ AND day_or_hour = %s ";
1830
+ $update_template_successfuly = $wpdb->query( $wpdb->prepare( $query_update_new, $updated_is_active, $email_frequency, $day_or_hour ) );
1831
+ $woocommerce_ac_email_subject = trim( $_POST['woocommerce_ac_email_subject'] );
1832
+ $woocommerce_ac_email_body = trim( $_POST['woocommerce_ac_email_body'] );
1833
+ $woocommerce_ac_template_name = trim( $_POST['woocommerce_ac_template_name'] );
1834
+ $woocommerce_ac_from_name = trim( $_POST['woocommerce_ac_from_name'] );
1835
+ $woocommerce_ac_email_from = trim( $_POST['woocommerce_ac_email_from'] );
1836
+ $woocommerce_ac_email_reply = trim( $_POST['woocommerce_ac_email_reply'] );
1837
+ $woocommerce_ac_email_header = trim( $_POST['wcal_wc_email_header'] );
1838
+ $id = trim( $_POST['id'] );
1839
+
1840
+ $query_update_latest = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1841
+ SET
1842
+ subject = %s,
1843
+ body = %s,
1844
+ is_active = %s,
1845
+ frequency = %d,
1846
+ day_or_hour = %s,
1847
+ template_name = %s,
1848
+ from_name = %s,
1849
+ is_wc_template = %s,
1850
+ default_template = %d,
1851
+ reply_email = %s,
1852
+ from_email = %s,
1853
+ wc_email_header = %s
1854
+ WHERE id = %d ";
1855
+ $update_template_successfuly = $wpdb->query($wpdb->prepare( $query_update_latest,
1856
+ $woocommerce_ac_email_subject,
1857
+ $woocommerce_ac_email_body,
1858
+ $active,
1859
+ $email_frequency,
1860
+ $day_or_hour,
1861
+ $woocommerce_ac_template_name,
1862
+ $woocommerce_ac_from_name,
1863
+ $is_wc_template,
1864
+ $default_value,
1865
+ $woocommerce_ac_email_reply,
1866
+ $woocommerce_ac_email_from,
1867
+ $woocommerce_ac_email_header,
1868
+ $id )
1869
+
1870
+ );
1871
+ }
1872
+ } else {
1873
+ $updated_is_active = '0';
1874
+ $is_active = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
1875
+ $email_frequency = trim( $_POST['email_frequency'] );
1876
+ $day_or_hour = trim( $_POST['day_or_hour'] );
1877
+ $is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
1878
+
1879
+ $query_update_new = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1880
+ SET is_active = %s
1881
+ WHERE frequency = %d
1882
+ AND day_or_hour = %s ";
1883
+ $wpdb->query( $wpdb->prepare( $query_update_new, $updated_is_active, $email_frequency, $day_or_hour ) );
1884
+
1885
+ $woocommerce_ac_email_subject = trim( $_POST['woocommerce_ac_email_subject'] );
1886
+ $woocommerce_ac_email_body = trim( $_POST['woocommerce_ac_email_body'] );
1887
+ $woocommerce_ac_template_name = trim( $_POST['woocommerce_ac_template_name'] );
1888
+ $woocommerce_ac_from_name = trim( $_POST['woocommerce_ac_from_name'] );
1889
+ $woocommerce_ac_email_from = trim( $_POST['woocommerce_ac_email_from'] );
1890
+ $woocommerce_ac_email_reply = trim( $_POST['woocommerce_ac_email_reply'] );
1891
+ $woocommerce_ac_email_header = trim( $_POST['wcal_wc_email_header'] );
1892
+ $id = trim( $_POST['id'] );
1893
+ $check_query = "SELECT * FROM `".$wpdb->prefix."ac_email_templates_lite`
1894
+ WHERE is_active= %s
1895
+ AND frequency = %d
1896
+ AND day_or_hour= %s ";
1897
+ $check_results = $wpdb->get_results( $wpdb->prepare( $check_query, $is_active, $email_frequency, $day_or_hour ) );
1898
+ $default_value = '';
1899
+
1900
+ foreach( $check_results as $result_key => $result_value ) {
1901
+ $default_value = ( empty( $result_value->default_template ) ) ? 0 : $result_value->default_template;
1902
+ }
1903
+
1904
+ $query_update_latest = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
1905
+ SET
1906
+ subject = %s,
1907
+ body = %s,
1908
+ is_active = %s,
1909
+ frequency = %d,
1910
+ day_or_hour = %s,
1911
+ template_name = %s,
1912
+ from_name = %s,
1913
+ is_wc_template = %s,
1914
+ default_template = %d,
1915
+ reply_email = %s,
1916
+ from_email = %s,
1917
+ wc_email_header = %s
1918
+ WHERE id = %d ";
1919
+
1920
+ $update_template_successfuly = $wpdb->query( $wpdb->prepare( $query_update_latest,
1921
+ $woocommerce_ac_email_subject,
1922
+ $woocommerce_ac_email_body,
1923
+ $is_active,
1924
+ $email_frequency,
1925
+ $day_or_hour,
1926
+ $woocommerce_ac_template_name,
1927
+ $woocommerce_ac_from_name,
1928
+ $is_wc_template,
1929
+ $default_value,
1930
+ $woocommerce_ac_email_reply,
1931
+ $woocommerce_ac_email_from,
1932
+ $woocommerce_ac_email_header,
1933
+ $id )
1934
+ );
1935
+ }
1936
+ }
1937
+
1938
+ if ( $action == 'emailtemplates' && $mode == 'removetemplate' ) {
1939
+ $id_remove = $_GET['id'];
1940
+ $query_remove = "DELETE FROM `".$wpdb->prefix."ac_email_templates_lite` WHERE id= %d ";
1941
+ $wpdb->query( $wpdb->prepare( $query_remove, $id_remove ) );
1942
+ }
1943
+
1944
+ if ( $action == 'emailtemplates' && $mode == 'activate_template' ) {
1945
+ $template_id = $_GET['id'];
1946
+ $current_template_status = $_GET['active_state'];
1947
+
1948
+ if( "1" == $current_template_status ) {
1949
+ $active = "0";
1950
+ } else {
1951
+ $active = "1";
1952
+ }
1953
+ $query_update = "UPDATE `" . $wpdb->prefix . "ac_email_templates_lite`
1954
+ SET
1955
+ is_active = '" . $active . "'
1956
+ WHERE id = '" . $template_id . "' ";
1957
+ $wpdb->query( $query_update );
1958
+
1959
+ wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&action=emailtemplates' ) );
1960
+ }
1961
+
1962
+ if( isset( $_POST['ac_settings_frm'] ) && $_POST['ac_settings_frm'] == 'save' && ( isset( $insert_template_successfuly ) && $insert_template_successfuly != '' ) ) { ?>
1963
+ <div id="message" class="updated fade"><p><strong><?php _e( 'The Email Template has been successfully added.', 'woocommerce-ac' ); ?></strong></p></div>
1964
+ <?php } else if ( isset( $_POST['ac_settings_frm'] ) && $_POST['ac_settings_frm'] == 'save' && ( isset( $insert_template_successfuly ) && $insert_template_successfuly == '' ) ) {
1965
+ ?>
1966
+ <div id="message" class="error fade"><p><strong><?php _e( ' There was a problem adding the email template. Please contact the plugin author via <a href= "https://wordpress.org/support/plugin/woocommerce-abandoned-cart">support forum</a>.', 'woocommerce-ac' ); ?></strong></p></div>
1967
+ <?php
1968
+ }
1969
+
1970
+ if ( isset( $_POST['ac_settings_frm'] ) && $_POST['ac_settings_frm'] == 'update' && isset($update_template_successfuly) && $update_template_successfuly >= 0 ) { ?>
1971
+ <div id="message" class="updated fade"><p><strong><?php _e( 'The Email Template has been successfully updated.', 'woocommerce-ac' ); ?></strong></p></div>
1972
+ <?php } else if ( isset( $_POST['ac_settings_frm'] ) && $_POST['ac_settings_frm'] == 'update' && isset($update_template_successfuly) && $update_template_successfuly === false ){
1973
+ ?>
1974
+ <div id="message" class="error fade"><p><strong><?php _e( ' There was a problem updating the email template. Please contact the plugin author via <a href= "https://wordpress.org/support/plugin/woocommerce-abandoned-cart">support forum</a>.', 'woocommerce-ac' ); ?></strong></p></div>
1975
+ <?php
1976
+ }
1977
+ ?>
1978
+ <div class="tablenav">
1979
+ <p style="float:left;">
1980
+ <a cursor: pointer; href="<?php echo "admin.php?page=woocommerce_ac_page&action=emailtemplates&mode=addnewtemplate"; ?>" class="button-secondary"><?php _e( 'Add New Template', 'woocommerce-ac' ); ?></a>
1981
+ </p>
1982
+
1983
+ <?php
1984
+ /* From here you can do whatever you want with the data from the $result link. */
1985
+ include_once('includes/classes/class-wcal-templates-table.php');
1986
+ $wcal_template_list = new WCAL_Templates_Table();
1987
+ $wcal_template_list->wcal_templates_prepare_items();
1988
+ ?>
1989
+ <div class="wrap">
1990
+ <form id="wcal-abandoned-templates" method="get" >
1991
+ <input type="hidden" name="page" value="woocommerce_ac_page" />
1992
+ <input type="hidden" name="action" value="emailtemplates" />
1993
+ <?php $wcal_template_list->display(); ?>
1994
+ </form>
1995
+ </div>
1996
+ </div>
1997
+ <?php
1998
+ } elseif ($action == 'stats' || $action == '') {
1999
+ ?>
2000
+ <p>
2001
+ <script language='javascript'>
2002
+ jQuery( document ).ready( function()
2003
+ {
2004
+ jQuery( '#duration_select' ).change( function()
2005
+ {
2006
+ var group_name = jQuery( '#duration_select' ).val();
2007
+ var today = new Date();
2008
+ var start_date = "";
2009
+ var end_date = "";
2010
+ if ( group_name == "yesterday" )
2011
+ {
2012
+ start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 1 );
2013
+ end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 1 );
2014
+ }
2015
+ else if ( group_name == "today")
2016
+ {
2017
+ start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
2018
+ end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
2019
+ }
2020
+ else if ( group_name == "last_seven" )
2021
+ {
2022
+ start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 7 );
2023
+ end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
2024
+ }
2025
+ else if ( group_name == "last_fifteen" )
2026
+ {
2027
+ start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 15 );
2028
+ end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
2029
+ }
2030
+ else if ( group_name == "last_thirty" )
2031
+ {
2032
+ start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 30 );
2033
+ end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
2034
+ }
2035
+ else if ( group_name == "last_ninety" )
2036
+ {
2037
+ start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 90 );
2038
+ end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
2039
+ }
2040
+ else if ( group_name == "last_year_days" )
2041
+ {
2042
+ start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 365 );
2043
+ end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
2044
+ }
2045
+
2046
+ var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
2047
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
2048
+
2049
+ var start_date_value = start_date.getDate() + " " + monthNames[start_date.getMonth()] + " " + start_date.getFullYear();
2050
+ var end_date_value = end_date.getDate() + " " + monthNames[end_date.getMonth()] + " " + end_date.getFullYear();
2051
+
2052
+ jQuery( '#start_date' ).val( start_date_value );
2053
+ jQuery( '#end_date' ).val( end_date_value );
2054
+
2055
+ });
2056
+ });
2057
+ </script>
2058
+ <?php
2059
+
2060
+ if ( isset( $_POST['duration_select'] ) ){
2061
+ $duration_range = $_POST['duration_select'];
2062
+ } else {
2063
+ $duration_range = "";
2064
+ }
2065
+ if ( $duration_range == "" ) {
2066
+ if ( isset( $_GET['duration_select'] ) ){
2067
+ $duration_range = $_GET['duration_select'];
2068
+ }
2069
+ }
2070
+ if ($duration_range == "") $duration_range = "last_seven";
2071
+
2072
+ _e( 'The Report below shows how many Abandoned Carts we were able to recover for you by sending automatic emails to encourage shoppers.', 'woocommerce-ac');
2073
+ ?>
2074
+ <div id="recovered_stats" class="postbox" style="display:block">
2075
+ <div class="inside">
2076
+ <form method="post" action="admin.php?page=woocommerce_ac_page&action=stats" id="ac_stats">
2077
+ <select id="duration_select" name="duration_select" >
2078
+ <?php
2079
+ foreach ( $this->duration_range_select as $key => $value )
2080
+ {
2081
+ $sel = "";
2082
+ if ($key == $duration_range) {
2083
+ $sel = " selected ";
2084
+ }
2085
+ echo"<option value='$key' $sel> $value </option>";
2086
+ }
2087
+
2088
+ $date_sett = $this->start_end_dates[ $duration_range ];
2089
+
2090
+ ?>
2091
+ </select>
2092
+ <script type="text/javascript">
2093
+ jQuery( document ).ready( function()
2094
+ {
2095
+ var formats = ["d.m.y", "d M yy","MM d, yy"];
2096
+ jQuery( "#start_date" ).datepicker( { dateFormat: formats[1] } );
2097
+ });
2098
+
2099
+ jQuery( document ).ready( function()
2100
+ {
2101
+ var formats = ["d.m.y", "d M yy","MM d, yy"];
2102
+ jQuery( "#end_date" ).datepicker( { dateFormat: formats[1] } );
2103
+ });
2104
+ </script>
2105
+ <?php
2106
+ include_once('includes/classes/class-wcal-recover-orders-table.php');
2107
+ $wcal_recover_orders_list = new WCAL_Recover_Orders_Table();
2108
+ $wcal_recover_orders_list->wcal_recovered_orders_prepare_items();
2109
+
2110
+ if ( isset( $_POST['start_date'] ) ) $start_date_range = $_POST['start_date'];
2111
+ else $start_date_range = "";
2112
+
2113
+ if ( $start_date_range == "" ) {
2114
+ $start_date_range = $date_sett['start_date'];
2115
+ }
2116
+
2117
+ if ( isset( $_POST['end_date'] ) ) $end_date_range = $_POST['end_date'];
2118
+ else $end_date_range = "";
2119
+
2120
+ if ( $end_date_range == "" ) {
2121
+ $end_date_range = $date_sett['end_date'];
2122
+ }
2123
+ ?>
2124
+ <label class="start_label" for="start_day"> <?php _e( 'Start Date:', 'woocommerce-ac' ); ?> </label>
2125
+ <input type="text" id="start_date" name="start_date" readonly="readonly" value="<?php echo $start_date_range; ?>"/>
2126
+ <label class="end_label" for="end_day"> <?php _e( 'End Date:', 'woocommerce-ac' ); ?> </label>
2127
+ <input type="text" id="end_date" name="end_date" readonly="readonly" value="<?php echo $end_date_range; ?>"/>
2128
+ <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e( 'Go', 'woocommerce-ac' ); ?>" />
2129
+ </form>
2130
+ </div>
2131
+ </div>
2132
+ <div id="recovered_stats" class="postbox" style="display:block">
2133
+ <div class="inside" >
2134
+ <p style="font-size: 15px"><?php _e( 'During the selected range ', 'woocommerce-ac' ); ?>
2135
+ <strong>
2136
+ <?php $count = $wcal_recover_orders_list->total_abandoned_cart_count;
2137
+ echo $count; ?>
2138
+ </strong>
2139
+ <?php _e( 'carts totaling', 'woocommerce-ac' ); ?>
2140
+ <strong>
2141
+ <?php $total_of_all_order = $wcal_recover_orders_list->total_order_amount;
2142
+
2143
+ echo $total_of_all_order; ?>
2144
+ </strong>
2145
+ <?php _e( ' were abandoned. We were able to recover', 'woocommerce-ac' ); ?>
2146
+ <strong>
2147
+ <?php
2148
+ $recovered_item = $wcal_recover_orders_list->recovered_item;
2149
+
2150
+ echo $recovered_item; ?>
2151
+ </strong>
2152
+ <?php _e( ' of them, which led to an extra', 'woocommerce-ac' ); ?>
2153
+ <strong>
2154
+ <?php
2155
+ $recovered_total = $wcal_recover_orders_list->total_recover_amount;
2156
+ echo wc_price( $recovered_total ); ?>
2157
+ </strong>
2158
+ </p>
2159
+ </div>
2160
+ </div>
2161
+ <div class="wrap">
2162
+ <form id="wcal-recover-orders" method="get" >
2163
+ <input type="hidden" name="page" value="woocommerce_ac_page" />
2164
+ <input type="hidden" name="action" value="stats" />
2165
+ <?php $wcal_recover_orders_list->display(); ?>
2166
+ </form>
2167
+ </div>
2168
+ <?php
2169
+ } elseif ( $action == 'orderdetails' ) {
2170
+ $ac_order_id = $_GET['id'];
2171
+ ?>
2172
+ <p> </p>
2173
+ <div id="ac_order_details" class="postbox" style="display:block">
2174
+ <h3> <p> <?php _e( "Abandoned Order #$ac_order_id Details", "woocommerce-ac" ); ?> </p> </h3>
2175
+ <div class="inside">
2176
+ <table cellpadding="0" cellspacing="0" class="wp-list-table widefat fixed posts">
2177
+ <tr>
2178
+ <th> <?php _e( 'Item', 'woocommerce-ac' ); ?> </th>
2179
+ <th> <?php _e( 'Name', 'woocommerce-ac' ); ?> </th>
2180
+ <th> <?php _e( 'Quantity', 'woocommerce-ac' ); ?> </th>
2181
+ <th> <?php _e( 'Line Subtotal', 'woocommerce-ac' ); ?> </th>
2182
+ <th> <?php _e( 'Line Total', 'woocommerce-ac' ); ?> </th>
2183
+ </tr>
2184
+ <?php
2185
+ $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE id = %d ";
2186
+ $results = $wpdb->get_results( $wpdb->prepare( $query,$_GET['id'] ) );
2187
+
2188
+ $shipping_charges = 0;
2189
+ $currency_symbol = get_woocommerce_currency_symbol();
2190
+ $number_decimal = wc_get_price_decimals();
2191
+
2192
+ if ( $results[0]->user_type == "GUEST" ) {
2193
+ $query_guest = "SELECT * FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = %d";
2194
+ $results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $results[0]->user_id ) );
2195
+ $user_email = $results_guest[0]->email_id;
2196
+ $user_first_name = $results_guest[0]->billing_first_name;
2197
+ $user_last_name = $results_guest[0]->billing_last_name;
2198
+ $user_billing_postcode = $results_guest[0]->billing_zipcode;
2199
+ $user_shipping_postcode = $results_guest[0]->shipping_zipcode;
2200
+ $shipping_charges = $results_guest[0]->shipping_charges;
2201
+ $user_billing_company = $user_billing_address_1 = $user_billing_address_2 = $user_billing_city = $user_billing_state = $user_billing_country = $user_billing_phone = "";
2202
+ $user_shipping_company = $user_shipping_address_1 = $user_shipping_address_2 = $user_shipping_city = $user_shipping_state = $user_shipping_country = "";
2203
+ } else {
2204
+ $user_id = $results[0]->user_id;
2205
+ if ( isset( $results[0]->user_login ) ) {
2206
+ $user_login = $results[0]->user_login;
2207
+ }
2208
+ $user_email = get_user_meta( $results[0]->user_id, 'billing_email', true );
2209
+
2210
+ if( "" == $user_email ) {
2211
+ $user_data = get_userdata( $results[0]->user_id );
2212
+ $user_email = $user_data->user_email;
2213
+ }
2214
+
2215
+ $user_first_name = "";
2216
+ $user_first_name_temp = get_user_meta( $user_id, 'billing_first_name', true );
2217
+ if( isset( $user_first_name_temp ) && "" == $user_first_name_temp ) {
2218
+ $user_data = get_userdata( $user_id );
2219
+ $user_first_name = $user_data->first_name;
2220
+ } else {
2221
+ $user_first_name = $user_first_name_temp;
2222
+ }
2223
+
2224
+ $user_last_name = "";
2225
+ $user_last_name_temp = get_user_meta( $user_id, 'billing_last_name', true );
2226
+ if( isset( $user_last_name_temp ) && "" == $user_last_name_temp ) {
2227
+ $user_data = get_userdata( $user_id );
2228
+ $user_last_name = $user_data->last_name;
2229
+ } else {
2230
+ $user_last_name = $user_last_name_temp;
2231
+ }
2232
+
2233
+ $user_billing_first_name = get_user_meta( $results[0]->user_id, 'billing_first_name' );
2234
+ $user_billing_last_name = get_user_meta( $results[0]->user_id, 'billing_last_name' );
2235
+
2236
+ $user_billing_company_temp = get_user_meta( $results[0]->user_id, 'billing_company' );
2237
+ if ( isset( $user_billing_company_temp[0] ) ) {
2238
+ $user_billing_company = $user_billing_company_temp[0];
2239
+ }
2240
+ else {
2241
+ $user_billing_company = "";
2242
+ }
2243
+
2244
+ $user_billing_address_1_temp = get_user_meta( $results[0]->user_id, 'billing_address_1' );
2245
+ if ( isset( $user_billing_address_1_temp[0] ) ) {
2246
+ $user_billing_address_1 = $user_billing_address_1_temp[0];
2247
+ }
2248
+ else {
2249
+ $user_billing_address_1 = "";
2250
+ }
2251
+
2252
+ $user_billing_address_2_temp = get_user_meta( $results[0]->user_id, 'billing_address_2' );
2253
+ if ( isset( $user_billing_address_2_temp[0] ) ) {
2254
+ $user_billing_address_2 = $user_billing_address_2_temp[0];
2255
+ }
2256
+ else {
2257
+ $user_billing_address_2 = "";
2258
+ }
2259
+
2260
+ $user_billing_city_temp = get_user_meta( $results[0]->user_id, 'billing_city' );
2261
+ if ( isset( $user_billing_city_temp[0] ) ) {
2262
+ $user_billing_city = $user_billing_city_temp[0];
2263
+ }
2264
+ else {
2265
+ $user_billing_city = "";
2266
+ }
2267
+
2268
+ $user_billing_postcode_temp = get_user_meta( $results[0]->user_id, 'billing_postcode' );
2269
+ if ( isset( $user_billing_postcode_temp[0] ) ) {
2270
+ $user_billing_postcode = $user_billing_postcode_temp[0];
2271
+ }
2272
+ else {
2273
+ $user_billing_postcode = "";
2274
+ }
2275
+
2276
+ $user_billing_state_temp = get_user_meta( $results[0]->user_id, 'billing_state' );
2277
+ if ( isset( $user_billing_state_temp[0] ) ) {
2278
+ $user_billing_state = $user_billing_state_temp[0];
2279
+ }
2280
+ else {
2281
+ $user_billing_state = "";
2282
+ }
2283
+
2284
+ $user_billing_country_temp = get_user_meta( $results[0]->user_id, 'billing_country' );
2285
+ if ( isset( $user_billing_country_temp[0] ) ) {
2286
+ $user_billing_country = $user_billing_country_temp[0];
2287
+ }
2288
+ else {
2289
+ $user_billing_country = "";
2290
+ }
2291
+
2292
+ $user_billing_phone_temp = get_user_meta( $results[0]->user_id, 'billing_phone' );
2293
+ if ( isset( $user_billing_phone_temp[0] ) ) {
2294
+ $user_billing_phone = $user_billing_phone_temp[0];
2295
+ }
2296
+ else {
2297
+ $user_billing_phone = "";
2298
+ }
2299
+
2300
+ $user_shipping_first_name = get_user_meta( $results[0]->user_id, 'shipping_first_name' );
2301
+ $user_shipping_last_name = get_user_meta( $results[0]->user_id, 'shipping_last_name' );
2302
+ $user_shipping_company_temp = get_user_meta( $results[0]->user_id, 'shipping_company' );
2303
+
2304
+ if ( isset( $user_shipping_company_temp[0] ) ) {
2305
+ $user_shipping_company = $user_shipping_company_temp[0];
2306
+ }
2307
+ else {
2308
+ $user_shipping_company = "";
2309
+ }
2310
+
2311
+ $user_shipping_address_1_temp = get_user_meta( $results[0]->user_id, 'shipping_address_1' );
2312
+ if ( isset( $user_shipping_address_1_temp[0] ) ) {
2313
+ $user_shipping_address_1 = $user_shipping_address_1_temp[0];
2314
+ }
2315
+ else {
2316
+ $user_shipping_address_1 = "";
2317
+ }
2318
+
2319
+ $user_shipping_address_2_temp = get_user_meta( $results[0]->user_id, 'shipping_address_2' );
2320
+ if ( isset( $user_shipping_address_2_temp[0] ) ) {
2321
+ $user_shipping_address_2 = $user_shipping_address_2_temp[0];
2322
+ }
2323
+ else {
2324
+ $user_shipping_address_2 = "";
2325
+ }
2326
+
2327
+ $user_shipping_city_temp = get_user_meta( $results[0]->user_id, 'shipping_city' );
2328
+ if ( isset( $user_shipping_city_temp[0] ) ) {
2329
+ $user_shipping_city = $user_shipping_city_temp[0];
2330
+ }
2331
+ else {
2332
+ $user_shipping_city = "";
2333
+ }
2334
+
2335
+ $user_shipping_postcode_temp = get_user_meta( $results[0]->user_id, 'shipping_postcode' );
2336
+ if ( isset( $user_shipping_postcode_temp[0] ) ) {
2337
+ $user_shipping_postcode = $user_shipping_postcode_temp[0];
2338
+ }
2339
+ else {
2340
+ $user_shipping_postcode = "";
2341
+ }
2342
+
2343
+ $user_shipping_state_temp = get_user_meta( $results[0]->user_id, 'shipping_state' );
2344
+ if ( isset( $user_shipping_state_temp[0] ) ) {
2345
+ $user_shipping_state = $user_shipping_state_temp[0];
2346
+ }
2347
+ else {
2348
+ $user_shipping_state = "";
2349
+ }
2350
+
2351
+ $user_shipping_country_temp = get_user_meta( $results[0]->user_id, 'shipping_country' );
2352
+ if ( isset( $user_shipping_country_temp[0] ) ) {
2353
+ $user_shipping_country = $user_shipping_country_temp[0];
2354
+ }
2355
+ else {
2356
+ $user_shipping_country = "";
2357
+ }
2358
+ }
2359
+ $cart_details = array();
2360
+ $cart_info = json_decode( $results[0]->abandoned_cart_info );
2361
+ $cart_details = (array) $cart_info->cart;
2362
+ $item_subtotal = $item_total = 0;
2363
+
2364
+ if ( is_array ( $cart_details ) && count( $cart_details ) > 0 ) {
2365
+
2366
+ foreach ( $cart_details as $k => $v ) {
2367
+ $quantity_total = $v->quantity;
2368
+ $product_id = $v->product_id;
2369
+ $prod_name = get_post($product_id);
2370
+ $product_name = $prod_name->post_title;
2371
+
2372
+ if ( isset( $v->variation_id ) && '' != $v->variation_id ){
2373
+ $variation_id = $v->variation_id;
2374
+ $variation = wc_get_product( $variation_id );
2375
+ $name = $variation->get_formatted_name() ;
2376
+ $explode_all = explode ( "&ndash;", $name );
2377
+ $pro_name_variation = array_slice( $explode_all, 1, -1 );
2378
+ $product_name_with_variable = '';
2379
+ $explode_many_varaition = array();
2380
+
2381
+ foreach ( $pro_name_variation as $pro_name_variation_key => $pro_name_variation_value ){
2382
+ $explode_many_varaition = explode ( ",", $pro_name_variation_value );
2383
+ if ( !empty( $explode_many_varaition ) ) {
2384
+ foreach( $explode_many_varaition as $explode_many_varaition_key => $explode_many_varaition_value ){
2385
+ $product_name_with_variable = $product_name_with_variable . "<br>". html_entity_decode ( $explode_many_varaition_value );
2386
+ }
2387
+ } else {
2388
+ $product_name_with_variable = $product_name_with_variable . "<br>". html_entity_decode ( $explode_many_varaition_value );
2389
+ }
2390
+ }
2391
+
2392
+ $product_name = $product_name_with_variable;
2393
+ }
2394
+
2395
+ // Item subtotal is calculated as product total including taxes
2396
+ if ( $v->line_subtotal_tax != 0 && $v->line_subtotal_tax > 0 ) {
2397
+ $item_subtotal = $item_subtotal + $v->line_total + $v->line_subtotal_tax;
2398
+ } else {
2399
+ $item_subtotal = $item_subtotal + $v->line_total;
2400
+ }
2401
+
2402
+ // Line total
2403
+ $item_total = $item_subtotal;
2404
+ $item_subtotal = $item_subtotal / $quantity_total;
2405
+ $item_total = wc_price( $item_total );
2406
+ $item_subtotal = wc_price( $item_subtotal );
2407
+ $product = get_product( $product_id );
2408
+ $prod_image = $product->get_image();
2409
+ ?>
2410
+ <tr>
2411
+ <td> <?php echo $prod_image; ?></td>
2412
+ <td> <?php echo $product_name; ?></td>
2413
+ <td> <?php echo $quantity_total; ?></td>
2414
+ <td> <?php echo $item_subtotal; ?></td>
2415
+ <td> <?php echo $item_total; ?></td>
2416
+ </tr>
2417
+ <?php
2418
+ $item_subtotal = $item_total = 0;
2419
+ }
2420
+ }
2421
+ ?>
2422
+ </table>
2423
+ </div>
2424
+ </div>
2425
+ <div id="ac_order_customer_details" class="postbox" style="display:block">
2426
+ <h3> <p> <?php _e( 'Customer Details' , 'woocommerce-ac' ); ?> </p> </h3>
2427
+ <div class="inside" style="height: 300px;" >
2428
+ <div id="order_data" class="panel">
2429
+ <div style="width:50%;float:left">
2430
+ <h3> <p> <?php _e( 'Billing Details' , 'woocommerce-ac' ); ?> </p> </h3>
2431
+ <p> <strong> <?php _e( 'Name:' , 'woocommerce-ac' ); ?> </strong>
2432
+ <?php echo $user_first_name." ".$user_last_name;?>
2433
+ </p>
2434
+ <p> <strong> <?php _e( 'Address:' , 'woocommerce-ac' ); ?> </strong>
2435
+ <?php echo $user_billing_company."</br>".
2436
+ $user_billing_address_1."</br>".
2437
+ $user_billing_address_2."</br>".
2438
+ $user_billing_city."</br>".
2439
+ $user_billing_postcode."</br>".
2440
+ $user_billing_state."</br>".
2441
+ $user_billing_country."</br>";
2442
+ ?>
2443
+ </p>
2444
+ <p> <strong> <?php _e( 'Email:', 'woocommerce-ac' ); ?> </strong>
2445
+ <?php $user_mail_to = "mailto:".$user_email; ?>
2446
+ <a href=<?php echo $user_mail_to;?>><?php echo $user_email;?> </a>
2447
+ </p>
2448
+ <p> <strong> <?php _e( 'Phone:', 'woocommerce-ac' ); ?> </strong>
2449
+ <?php echo $user_billing_phone;?>
2450
+ </p>
2451
+ </div>
2452
+ <div style="width:50%;float:right">
2453
+ <h3> <p> <?php _e( 'Shipping Details', 'woocommerce-ac' ); ?> </p> </h3>
2454
+ <p> <strong> <?php _e( 'Address:', 'woocommerce-ac' ); ?> </strong>
2455
+ <?php
2456
+ if ( $user_shipping_company == '' &&
2457
+ $user_shipping_address_1 == '' &&
2458
+ $user_shipping_address_2 == '' &&
2459
+ $user_shipping_city == '' &&
2460
+ $user_shipping_postcode == '' &&
2461
+ $user_shipping_state == '' &&
2462
+ $user_shipping_country == '') {
2463
+ echo "Shipping Address same as Billing Address";
2464
+ } else { ?>
2465
+ <?php echo $user_shipping_company."</br>".
2466
+ $user_shipping_address_1."</br>".
2467
+ $user_shipping_address_2."</br>".
2468
+ $user_shipping_city."</br>".
2469
+ $user_shipping_postcode."</br>".
2470
+ $user_shipping_state."</br>".
2471
+ $user_shipping_country."</br>";
2472
+ ?>
2473
+ <br><br>
2474
+ <strong> Shipping Charges: </strong>
2475
+ <?php if ( $shipping_charges != 0 ) echo $currency_symbol . $shipping_charges;?>
2476
+ </p>
2477
+ <?php }?>
2478
+ </div>
2479
+ </div>
2480
+ </div>
2481
+ </div>
2482
+ <?php } elseif ( $action == 'report' ) {
2483
+ include_once('includes/classes/class-wcal-product-report-table.php');
2484
+ $wcal_product_report_list = new WCAL_Product_Report_Table();
2485
+ $wcal_product_report_list->wcal_product_report_prepare_items();
2486
+ ?>
2487
+ <div class="wrap">
2488
+ <form id="wcal-sent-emails" method="get" >
2489
+ <input type="hidden" name="page" value="woocommerce_ac_page" />
2490
+ <input type="hidden" name="action" value="report" />
2491
+ <?php $wcal_product_report_list->display(); ?>
2492
+ </form>
2493
+ </div>
2494
+ <?php }
2495
+ }
2496
+ echo( "</table>" );
2497
+
2498
+ if ( isset( $_GET['action'] ) ) {
2499
+ $action = $_GET['action'];
2500
+ }
2501
+ if ( isset( $_GET['mode'] ) ){
2502
+ $mode = $_GET['mode'];
2503
+ }
2504
+ if ( $action == 'emailtemplates' && ( $mode == 'addnewtemplate' || $mode == 'edittemplate' ) ) {
2505
+
2506
+ if( $mode=='edittemplate' ) {
2507
+ $edit_id = $_GET['id'];
2508
+ $query = "SELECT wpet . * FROM `".$wpdb->prefix."ac_email_templates_lite` AS wpet WHERE id = %d ";
2509
+ $results = $wpdb->get_results( $wpdb->prepare( $query, $edit_id ) );
2510
+ }
2511
+ $active_post = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
2512
+ ?>
2513
+ <div id="content">
2514
+ <form method="post" action="admin.php?page=woocommerce_ac_page&action=emailtemplates" id="ac_settings">
2515
+ <input type="hidden" name="mode" value="<?php echo $mode;?>" />
2516
+ <?php
2517
+ $id_by = "";
2518
+ if ( isset( $_GET['id'] ) ) {
2519
+ $id_by = $_GET['id'];
2520
+ }
2521
+ ?>
2522
+ <input type="hidden" name="id" value="<?php echo $id_by ;?>" />
2523
+ <?php
2524
+ $button_mode = "save";
2525
+ $display_message = "Add Email Template";
2526
+ if ( $mode == 'edittemplate' ) {
2527
+ $button_mode = "update";
2528
+ $display_message = "Edit Email Template";
2529
+ }
2530
+ print'<input type="hidden" name="ac_settings_frm" value="'.$button_mode.'">';?>
2531
+ <div id="poststuff">
2532
+ <div> <!-- <div class="postbox" > -->
2533
+ <h3 class="hndle"><?php _e( $display_message, 'woocommerce-ac' ); ?></h3>
2534
+ <div>
2535
+ <table class="form-table" id="addedit_template">
2536
+ <tr>
2537
+ <th>
2538
+ <label for="woocommerce_ac_template_name"><b><?php _e( 'Template Name:', 'woocommerce-ac');?></b></label>
2539
+ </th>
2540
+ <td>
2541
+ <?php
2542
+ $template_name = "";
2543
+ if( $mode == 'edittemplate' )
2544
+ {
2545
+ $template_name = $results[0]->template_name;
2546
+ }
2547
+
2548
+ print'<input type="text" name="woocommerce_ac_template_name" id="woocommerce_ac_template_name" class="regular-text" value="'.$template_name.'">';?>
2549
+ <img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter a template name for reference', 'woocommerce-ac') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
2550
+ </td>
2551
+ </tr>
2552
+
2553
+ <tr>
2554
+ <th>
2555
+ <label for="woocommerce_ac_from_name"><b><?php _e( 'Send From This Name:', 'woocommerce-ac' ); ?></b></label>
2556
+ </th>
2557
+ <td>
2558
+ <?php
2559
+ $from_name = "Admin";
2560
+ if ( $mode == 'edittemplate' )
2561
+ {
2562
+ $from_name=$results[0]->from_name;
2563
+ }
2564
+
2565
+ print'<input type="text" name="woocommerce_ac_from_name" id="woocommerce_ac_from_name" class="regular-text" value="'.$from_name.'">';?>
2566
+ <img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter the name that should appear in the email sent', 'woocommerce-ac') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
2567
+ </td>
2568
+ </tr>
2569
+
2570
+ <tr>
2571
+ <th>
2572
+ <label for="woocommerce_ac_email_from"><b><?php _e( 'Send From This Email Address:', 'woocommerce-ac' ); ?></b></label>
2573
+ </th>
2574
+ <td>
2575
+ <?php
2576
+ $from_edit = get_option( 'admin_email' );
2577
+
2578
+ if ( $mode == 'edittemplate' && $results[0]->from_email != '') { // this is the fix
2579
+ $from_edit = $results[0]->from_email;
2580
+ }
2581
+ print'<input type="text" name="woocommerce_ac_email_from" id="woocommerce_ac_email_from" class="regular-text" value="' . $from_edit . '">'; ?>
2582
+ <img class="help_tip" width="16" height="16" data-tip='<?php _e( 'Which email address should be shown in the "From Email" field for this email?', 'woocommerce' ) ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
2583
+ </td>
2584
+ </tr>
2585
+
2586
+ <tr>
2587
+ <th>
2588
+ <label for="woocommerce_ac_email_reply"><b><?php _e( 'Send Reply Emails to:', 'woocommerce-ac' ); ?></b></label>
2589
+ </th>
2590
+ <td>
2591
+ <?php
2592
+ $reply_edit = get_option( 'admin_email' );
2593
+
2594
+ if ( $mode == 'edittemplate' && $results[0]->reply_email != '' ) { // this is the fix
2595
+ $reply_edit = $results[0]->reply_email;
2596
+ }
2597
+
2598
+ print'<input type="text" name="woocommerce_ac_email_reply" id="woocommerce_ac_email_reply" class="regular-text" value="' . $reply_edit . '">'; ?>
2599
+ <img class="help_tip" width="16" height="16" data-tip='<?php _e( 'When a contact receives your email and clicks reply, which email address should that reply be sent to?', 'woocommerce' ) ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
2600
+ </td>
2601
+ </tr>
2602
+
2603
+ <tr>
2604
+ <th>
2605
+ <label for="woocommerce_ac_email_subject"><b><?php _e( 'Subject:', 'woocommerce-ac' ); ?></b></label>
2606
+ </th>
2607
+ <td>
2608
+ <?php
2609
+ $subject_edit = "";
2610
+ if ( $mode == 'edittemplate' )
2611
+ {
2612
+ $subject_edit= stripslashes ( $results[0]->subject );
2613
+ }
2614
+
2615
+ print'<input type="text" name="woocommerce_ac_email_subject" id="woocommerce_ac_email_subject" class="regular-text" value="'.$subject_edit.'">';?>
2616
+ <img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter the subject that should appear in the email sent', 'woocommerce-ac') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
2617
+ </td>
2618
+ </tr>
2619
+
2620
+ <tr>
2621
+ <th>
2622
+ <label for="woocommerce_ac_email_body"><b><?php _e( 'Email Body:', 'woocommerce-ac' ); ?></b></label>
2623
+ </th>
2624
+ <td>
2625
+ <?php
2626
+ $initial_data = "";
2627
+ if ( $mode == 'edittemplate' )
2628
+ {
2629
+ $initial_data = stripslashes( $results[0]->body );
2630
+ }
2631
+
2632
+ $initial_data = str_replace ( "My document title", "", $initial_data );
2633
+
2634
+ wp_editor(
2635
+ $initial_data,
2636
+ 'woocommerce_ac_email_body',
2637
+ array(
2638
+ 'media_buttons' => true,
2639
+ 'textarea_rows' => 15,
2640
+ 'tabindex' => 4,
2641
+ 'tinymce' => array(
2642
+ 'theme_advanced_buttons1' => 'bold,italic,underline,|,bullist,numlist,blockquote,|,link,unlink,|,spellchecker,fullscreen,|,formatselect,styleselect'
2643
+ ),
2644
+ )
2645
+ );
2646
+
2647
+ ?>
2648
+ <?php echo stripslashes( get_option( 'woocommerce_ac_email_body' ) ); ?>
2649
+ <span class="description"><?php
2650
+ echo __( 'Message to be sent in the reminder email.', 'woocommerce-ac' );
2651
+ ?></span>
2652
+ </td>
2653
+ </tr>
2654
+
2655
+ <tr>
2656
+ <th>
2657
+ <label for="is_wc_template"><b><?php _e( 'Use WooCommerce Template Style:', 'woocommerce-ac' ); ?></b></label>
2658
+ </th>
2659
+ <td>
2660
+ <?php
2661
+ $is_wc_template = "";
2662
+ if ( $mode == 'edittemplate' ) {
2663
+ $use_wc_template = $results[0]->is_wc_template;
2664
+
2665
+ if ( $use_wc_template == '1' ) {
2666
+ $is_wc_template = "checked";
2667
+ } else {
2668
+ $is_wc_template = "";
2669
+ }
2670
+ }
2671
+ print'<input type="checkbox" name="is_wc_template" id="is_wc_template" ' . $is_wc_template . '> </input>'; ?>
2672
+ <img class="help_tip" width="16" height="16" data-tip='<?php _e( 'Use WooCommerce default style template for abandoned cart reminder emails.', 'woocommerce' ) ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" /> <a target = '_blank' href= <?php echo wp_nonce_url( admin_url( '?wcal_preview_woocommerce_mail=true' ), 'woocommerce-ac' ) ; ?> >
2673
+ Click here to preview </a>how the email template will look with WooCommerce Template Style enabled. Alternatively, if this is unchecked, the template will appear as <a target = '_blank' href=<?php echo wp_nonce_url( admin_url( '?wcal_preview_mail=true' ), 'woocommerce-ac' ) ; ?>>shown here</a>. <br> <strong>Note: </strong>When this setting is enabled, then "Send From This Name:" & "Send From This Email Address:" will be overwritten with WooCommerce -> Settings -> Email -> Email Sender Options.
2674
+ </td>
2675
+ </tr>
2676
+
2677
+ <tr>
2678
+ <th>
2679
+ <label for="wcal_wc_email_header"><b><?php _e( 'Email Template Header Text: ', 'woocommerce-ac' ); ?></b></label>
2680
+ </th>
2681
+ <td>
2682
+
2683
+ <?php
2684
+
2685
+ $wcal_wc_email_header = "";
2686
+ if ( $mode == 'edittemplate' ) {
2687
+ $wcal_wc_email_header = $results[0]->wc_email_header;
2688
+ }
2689
+
2690
+ if ( $wcal_wc_email_header == ""){
2691
+ $wcal_wc_email_header = "Abandoned cart reminder";
2692
+ }
2693
+ print'<input type="text" name="wcal_wc_email_header" id="wcal_wc_email_header" class="regular-text" value="' . $wcal_wc_email_header . '">'; ?>
2694
+ <img class="help_tip" width="16" height="16" data-tip='<?php _e( 'Enter the header which will appear in the abandoned WooCommerce email sent. This is only applicable when only used when "Use WooCommerce Template Style:" is checked.', 'woocommerce-ac' ) ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
2695
+ </td>
2696
+ </tr>
2697
+
2698
+ <tr>
2699
+ <th>
2700
+ <label for="is_active"><b><?php _e( 'Active:', 'woocommerce-ac' ); ?></b></label>
2701
+ </th>
2702
+ <td>
2703
+ <?php
2704
+ $is_active_edit="";
2705
+
2706
+ if ( $mode == 'edittemplate' ) {
2707
+ $active_edit = $results[0]->is_active;
2708
+
2709
+ if ( $active_edit == '1' ) {
2710
+ $is_active_edit = "checked";
2711
+ } else {
2712
+ $is_active_edit = "";
2713
+ }
2714
+ }
2715
+ if ( $mode == 'copytemplate' ) {
2716
+ $active_edit = $results_copy[0]->is_active;
2717
+
2718
+ if($active_edit == '1') {
2719
+ $is_active_edit = "checked";
2720
+ } else {
2721
+ $is_active_edit = "";
2722
+ }
2723
+ }
2724
+ print'<input type="checkbox" name="is_active" id="is_active" ' . $is_active_edit . '> </input>'; ?>
2725
+ <img class="help_tip" width="16" height="16" data-tip='<?php _e( 'The email template will be sent to customers only if the "Active" checkbox is enabled. Leave this unchecked if you want to add the email template but not send it to customers.', 'woocommerce' ) ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" /></p>
2726
+ </td>
2727
+ </tr>
2728
+
2729
+ <tr>
2730
+ <th>
2731
+ <label for="woocommerce_ac_email_frequency"><b><?php _e( 'Send this email:', 'woocommerce-ac' ); ?></b></label>
2732
+ </th>
2733
+ <td>
2734
+ <select name="email_frequency" id="email_frequency">
2735
+ <?php
2736
+ $frequency_edit = "";
2737
+ if( $mode == 'edittemplate')
2738
+ {
2739
+ $frequency_edit = $results[0]->frequency;
2740
+ }
2741
+
2742
+ for ( $i = 1; $i < 4; $i++ )
2743
+ {
2744
+ printf( "<option %s value='%s'>%s</option>\n",
2745
+ selected( $i, $frequency_edit, false ),
2746
+ esc_attr( $i ),
2747
+ $i
2748
+ );
2749
+ }
2750
+
2751
+ ?>
2752
+ </select>
2753
+
2754
+ <select name="day_or_hour" id="day_or_hour">
2755
+ <?php
2756
+ $days_or_hours_edit = "";
2757
+ if ( $mode == 'edittemplate')
2758
+ {
2759
+ $days_or_hours_edit = $results[0]->day_or_hour;
2760
+ }
2761
+
2762
+ $days_or_hours = array(
2763
+ 'Days' => 'Day(s)',
2764
+ 'Hours' => 'Hour(s)'
2765
+ );
2766
+ foreach( $days_or_hours as $k => $v )
2767
+ {
2768
+ printf( "<option %s value='%s'>%s</option>\n",
2769
+ selected( $k, $days_or_hours_edit, false ),
2770
+ esc_attr( $k ),
2771
+ $v
2772
+ );
2773
+ }
2774
+ ?>
2775
+ </select>
2776
+ <span class="description">
2777
+ <?php echo __( 'after cart is abandoned.', 'woocommerce-ac' ); ?>
2778
+ </span>
2779
+ </td>
2780
+ </tr>
2781
+
2782
+ <tr>
2783
+ <th>
2784
+ <label for="woocommerce_ac_email_preview"><b><?php _e( 'Send a test email to:', 'woocommerce-ac' ); ?></b></label>
2785
+ </th>
2786
+ <td>
2787
+ <input type="text" id="send_test_email" name="send_test_email" class="regular-text" >
2788
+ <input type="button" value="Send a test email" id="preview_email" onclick="javascript:void(0);">
2789
+ <img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter the email id to which the test email needs to be sent.', 'woocommerce-ac') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
2790
+ <div id="preview_email_sent_msg" style="display:none;"></div>
2791
+ </td>
2792
+ </tr>
2793
+ </table>
2794
+ </div>
2795
+ </div>
2796
+ </div>
2797
+ <p class="submit">
2798
+ <?php
2799
+ $button_value = "Save Changes";
2800
+ if ( $mode == 'edittemplate' )
2801
+ {
2802
+ $button_value = "Update Changes";
2803
+ }?>
2804
+ <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e( $button_value, 'woocommerce-ac' ); ?>" />
2805
+ </p>
2806
+ </form>
2807
+ </div>
2808
+ <?php
2809
+ }
2810
+ }
2811
+
2812
+ function bubble_sort_function( $unsort_array, $order ) {
2813
+
2814
+ $temp = array();
2815
+ foreach ( $unsort_array as $key => $value )
2816
+ $temp[ $key ] = $value; //concatenate something unique to make sure two equal weights don't overwrite each other
2817
+
2818
+ asort( $temp, SORT_NUMERIC ); // or ksort($temp, SORT_NATURAL); see paragraph above to understand why
2819
+
2820
+ if( $order == 'desc' ) {
2821
+ $array = array_reverse( $temp, true );
2822
+ }
2823
+ else if($order == 'asc') {
2824
+ $array = $temp;
2825
+ }
2826
+ unset( $temp );
2827
+ return $array;
2828
+ }
2829
+
2830
+ function wcal_action_send_preview() {
2831
+ ?>
2832
+ <script type="text/javascript" >
2833
+ jQuery( document ).ready( function( $ )
2834
+ {
2835
+ $( "table#addedit_template input#preview_email" ).click( function()
2836
+ {
2837
+ var email_body = '';
2838
+ if ( jQuery("#wp-woocommerce_ac_email_body-wrap").hasClass( "tmce-active" ) ) {
2839
+ email_body = tinyMCE.get('woocommerce_ac_email_body').getContent();
2840
+ } else {
2841
+ email_body = jQuery('#woocommerce_ac_email_body').val();
2842
+ }
2843
+ var from_name_preview = $( '#woocommerce_ac_from_name' ).val();
2844
+ var reply_name_preview = $( '#woocommerce_ac_email_reply' ).val();
2845
+ var from_email_preview = $( '#woocommerce_ac_email_from' ).val();
2846
+ var subject_email_preview = $( '#woocommerce_ac_email_subject' ).val();
2847
+ var body_email_preview = email_body;
2848
+ var send_email_id = $( '#send_test_email' ).val();
2849
+ var is_wc_template = document.getElementById( "is_wc_template" ).checked;
2850
+ var wc_template_header = $( '#wcal_wc_email_header' ).val() != '' ? $( '#wcal_wc_email_header' ).val() : 'Abandoned cart reminder';
2851
+ var data = {
2852
+ from_name_preview : from_name_preview,
2853
+ reply_name_preview : reply_name_preview,
2854
+ from_email_preview : from_email_preview,
2855
+ subject_email_preview: subject_email_preview,
2856
+ body_email_preview : body_email_preview,
2857
+ send_email_id : send_email_id,
2858
+ is_wc_template : is_wc_template,
2859
+ wc_template_header : wc_template_header,
2860
+ action : 'wcal_preview_email_sent'
2861
+ };
2862
+
2863
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
2864
+ $.post( ajaxurl, data, function( response )
2865
+ {
2866
+ if ( 'not sent' == response ) {
2867
+ $( "#preview_email_sent_msg" ).html( "Test email is not sent as the Email body is empty." );
2868
+ $( "#preview_email_sent_msg" ).fadeIn();
2869
+ setTimeout( function(){$( "#preview_email_sent_msg" ).fadeOut();}, 4000 );
2870
+ } else {
2871
+ $( "#preview_email_sent_msg" ).html( "<img src='<?php echo plugins_url(); ?>/woocommerce-abandoned-cart/assets/images/check.jpg'>&nbsp;Email has been sent successfully." );
2872
+ $( "#preview_email_sent_msg" ).fadeIn();
2873
+ setTimeout( function(){$( "#preview_email_sent_msg" ).fadeOut();}, 3000 );
2874
+ }
2875
+ //alert('Got this from the server: ' + response);
2876
+ });
2877
+ });
2878
+ });
2879
+ </script>
2880
+ <?php
2881
+ }
2882
+ // Send Test Email
2883
+ function wcal_preview_email_sent() {
2884
+
2885
+ if ( '' != $_POST['body_email_preview'] ) {
2886
+ $from_email_name = $_POST['from_name_preview'];
2887
+ $reply_name_preview = $_POST['reply_name_preview'];
2888
+ $from_email_preview = $_POST['from_email_preview'];
2889
+ $subject_email_preview = stripslashes ( $_POST['subject_email_preview'] );
2890
+ $body_email_preview = $_POST['body_email_preview'];
2891
+ $is_wc_template = $_POST['is_wc_template'];
2892
+ $wc_template_header = stripslashes( $_POST['wc_template_header'] );
2893
+ $headers = "From: " . $from_email_name . " <" . $from_email_preview . ">" . "\r\n";
2894
+ $headers .= "Content-Type: text/html" . "\r\n";
2895
+ $headers .= "Reply-To: " . $reply_name_preview . " " . "\r\n";
2896
+ $body_email_preview = str_replace( '{{customer.firstname}}', 'John', $body_email_preview );
2897
+ $body_email_preview = str_replace( '{{customer.lastname}}', 'Doe', $body_email_preview );
2898
+ $body_email_preview = str_replace( '{{customer.fullname}}', 'John'." ".'Doe', $body_email_preview );
2899
+ $current_time_stamp = current_time( 'timestamp' );
2900
+ $test_date = date( 'd M, Y h:i A', $current_time_stamp );
2901
+ $body_email_preview = str_replace( '{{cart.abandoned_date}}', $test_date, $body_email_preview );
2902
+
2903
+ $cart_url = wc_get_page_permalink( 'cart' );
2904
+ $body_email_preview = str_replace( '{{cart.link}}', $cart_url, $body_email_preview );
2905
+ $body_email_preview = str_replace( '{{cart.unsubscribe}}', '<a href=#>unsubscribe</a>', $body_email_preview );
2906
+
2907
+ $var = '<h3>'.__( "Your Shopping Cart", "woocommerce-ac" ).'</h3>
2908
+ <table border="0" cellpadding="10" cellspacing="0" class="templateDataTable">
2909
+ <tr align="center">
2910
+ <th>'.__( "Item", "woocommerce-ac" ).'</th>
2911
+ <th>'.__( "Name", "woocommerce-ac" ).'</th>
2912
+ <th>'.__( "Quantity", "woocommerce-ac" ).'</th>
2913
+ <th>'.__( "Price", "woocommerce-ac" ).'</th>
2914
+ <th>'.__( "Line Subtotal", "woocommerce-ac" ).'</th>
2915
+ </tr>
2916
+ <tr align="center">
2917
+ <td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/assets/images/shoes.jpg"/></td>
2918
+ <td>'.__( "Men\'\s Formal Shoes", "woocommerce-ac" ).'</td>
2919
+ <td>1</td>
2920
+ <td>$100</td>
2921
+ <td>$100</td>
2922
+ </tr>
2923
+ <tr align="center">
2924
+ <td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/assets/images/handbag.jpg"/></td>
2925
+ <td>'.__( "Woman\'\s Hand Bags", "woocommerce-ac" ).'</td>
2926
+ <td>1</td>
2927
+ <td>$100</td>
2928
+ <td>$100</td>
2929
+ </tr>
2930
+ <tr align="center">
2931
+ <td></td>
2932
+ <td></td>
2933
+ <td></td>
2934
+ <td>'.__( "Cart Total:", "woocommerce-ac" ).'</td>
2935
+ <td>$200</td>
2936
+ </tr>
2937
+ </table>';
2938
+
2939
+ $body_email_preview = str_replace( '{{products.cart}}', $var, $body_email_preview );
2940
+
2941
+ if ( isset( $_POST['send_email_id'] ) ) {
2942
+ $to_email_preview = $_POST['send_email_id'];
2943
+ } else {
2944
+ $to_email_preview = "";
2945
+ }
2946
+
2947
+ $user_email_from = get_option( 'admin_email' );
2948
+ $body_email_final_preview = stripslashes( $body_email_preview );
2949
+
2950
+ if ( isset( $is_wc_template ) && "true" == $is_wc_template ) {
2951
+ ob_start();
2952
+ // Get email heading
2953
+ wc_get_template( 'emails/email-header.php', array( 'email_heading' => $wc_template_header ) );
2954
+ $email_body_template_header = ob_get_clean();
2955
+
2956
+ ob_start();
2957
+ wc_get_template( 'emails/email-footer.php' );
2958
+ $email_body_template_footer = ob_get_clean();
2959
+
2960
+ $final_email_body = $email_body_template_header . $body_email_final_preview . $email_body_template_footer;
2961
+
2962
+ wc_mail( $to_email_preview, $subject_email_preview, $final_email_body , $headers );
2963
+ }
2964
+ else {
2965
+ wp_mail( $to_email_preview, $subject_email_preview, stripslashes( $body_email_preview ), $headers );
2966
+ }
2967
+ echo "email sent";
2968
+ die();
2969
+ } else {
2970
+ echo "not sent";
2971
+ die();
2972
+ }
2973
+ }
2974
+ }
2975
+ }
2976
+ $woocommerce_abandon_cart = new woocommerce_abandon_cart_lite();
2977
+ ?>
woocommerce_guest_ac.class.php DELETED
@@ -1,208 +0,0 @@
1
- <?php
2
- /* Woocommerce Abandoned Cart Plugin Addon - Saves guest cart information
3
- *
4
- */
5
- {
6
- /**
7
- * Localisation
8
- **/
9
-
10
- /**
11
- * woocommerce_abandon_cart class
12
- **/
13
- if ( ! class_exists( 'woocommerce_guest_ac' ) ) {
14
-
15
- class woocommerce_guest_ac {
16
- var $a;
17
- public function __construct() {
18
- add_action( 'woocommerce_after_checkout_billing_form', 'user_side_js' );
19
- add_action( 'init','load_ac_ajax' );
20
- add_filter( 'woocommerce_checkout_fields', 'guest_checkout_fields' );
21
- }
22
- }
23
-
24
- /*-----------------------------------------------------------------------------------*/
25
- /* Class Functions */
26
- /*-----------------------------------------------------------------------------------*/
27
- function load_ac_ajax() {
28
-
29
- if ( ! is_user_logged_in() ) {
30
- add_action( 'wp_ajax_nopriv_save_data', 'save_data' );
31
- } else {
32
- add_action( 'wp_ajax_save_data', 'save_data' );
33
- }
34
- }
35
-
36
- function user_side_js() {
37
- ?>
38
- <script type="text/javascript">
39
- jQuery( 'input#billing_email' ).on( 'change', function() {
40
- var data = {
41
- billing_first_name : jQuery('#billing_first_name').val(),
42
- billing_last_name : jQuery('#billing_last_name').val(),
43
- billing_company : jQuery('#billing_company').val(),
44
- billing_address_1 : jQuery('#billing_address_1').val(),
45
- billing_address_2 : jQuery('#billing_address_2').val(),
46
- billing_city : jQuery('#billing_city').val(),
47
- billing_state : jQuery('#billing_state').val(),
48
- billing_postcode : jQuery('#billing_postcode').val(),
49
- billing_country : jQuery('#billing_country').val(),
50
- billing_phone : jQuery('#billing_phone').val(),
51
- billing_email : jQuery('#billing_email').val(),
52
- order_notes : jQuery('#order_comments').val(),
53
- shipping_first_name : jQuery('#shipping_first_name').val(),
54
- shipping_last_name : jQuery('#shipping_last_name').val(),
55
- shipping_company : jQuery('#shipping_company').val(),
56
- shipping_address_1 : jQuery('#shipping_address_1').val(),
57
- shipping_address_2 : jQuery('#shipping_address_2').val(),
58
- shipping_city : jQuery('#shipping_city').val(),
59
- shipping_state : jQuery('#shipping_state').val(),
60
- shipping_postcode : jQuery('#shipping_postcode').val(),
61
- shipping_country : jQuery('#shipping_country').val(),
62
- ship_to_billing : jQuery('#shiptobilling-checkbox').val(),
63
- action: 'save_data'
64
- };
65
- jQuery.post( "<?php echo get_home_url();?>/wp-admin/admin-ajax.php", data, function(response) {
66
- });
67
- });
68
- </script>
69
- <?php
70
- }
71
-
72
- function save_data() {
73
-
74
- if ( ! is_user_logged_in() ) {
75
- global $wpdb, $woocommerce;
76
-
77
- $_SESSION['billing_first_name'] = $_POST['billing_first_name'];
78
- $_SESSION['billing_last_name'] = $_POST['billing_last_name'];
79
- $_SESSION['billing_company'] = $_POST['billing_company'];
80
- $_SESSION['billing_address_1'] = $_POST['billing_address_1'];
81
- $_SESSION['billing_address_2'] = $_POST['billing_address_2'];
82
- $_SESSION['billing_city'] = $_POST['billing_city'];
83
- $_SESSION['billing_state'] = $_POST['billing_state'];
84
- $_SESSION['billing_postcode'] = $_POST['billing_postcode'];
85
- $_SESSION['billing_country'] = $_POST['billing_country'];
86
- $_SESSION['billing_email'] = $_POST['billing_email'];
87
- $_SESSION['billing_phone'] = $_POST['billing_phone'];
88
- $_SESSION['order_notes'] = $_POST['order_notes'];
89
- $_SESSION['ship_to_billing'] = $_POST['ship_to_billing'];
90
- $_SESSION['shipping_first_name'] = $_POST['shipping_first_name'];
91
- $_SESSION['shipping_last_name'] = $_POST['shipping_last_name'];
92
- $_SESSION['shipping_company'] = $_POST['shipping_company'];
93
- $_SESSION['shipping_address_1'] = $_POST['shipping_address_1'];
94
- $_SESSION['shipping_address_2'] = $_POST['shipping_address_2'];
95
- $_SESSION['shipping_city'] = $_POST['shipping_city'];
96
- $_SESSION['shipping_state'] = $_POST['shipping_state'];
97
- $_SESSION['shipping_postcode'] = $_POST['shipping_postcode'];
98
- $_SESSION['shipping_country'] = $_POST['shipping_country'];
99
-
100
- // If a record is present in the guest cart history table for the same email id, then delete the previous records
101
- $query_guest = "SELECT id FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE email_id = %s";
102
- $results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $_SESSION['billing_email'] ) );
103
-
104
- if ( $results_guest ) {
105
-
106
- foreach ( $results_guest as $key => $value ) {
107
- $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
108
- WHERE user_id = %d AND recovered_cart = '0'" ;
109
- $result = $wpdb->get_results( $wpdb->prepare( $query, $value->id ) );
110
-
111
- if ( $result ) {
112
- $delete_sent_email = "DELETE FROM `".$wpdb->prefix."ac_sent_history` WHERE abandoned_order_id = '".$result[0]->id."'";
113
- $wpdb->query( $delete_sent_email );
114
- $delete_query = "DELETE FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id = '".$value->id."'";
115
- $wpdb->query( $delete_query );
116
- }
117
- $guest_delete = "DELETE FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = '".$value->id."'";
118
- $wpdb->query( $guest_delete );
119
- }
120
- }
121
-
122
- // Insert record in guest table
123
- if ( isset( $_SESSION['billing_first_name'] ) ) $billing_first_name = $_SESSION['billing_first_name'];
124
- else $billing_first_name = '';
125
-
126
- if ( isset( $_SESSION['billing_last_name'] ) ) $billing_last_name = $_SESSION['billing_last_name'];
127
- else $billing_last_name = '';
128
-
129
- $shipping_zipcode = $billing_zipcode = '';
130
-
131
- if ( isset( $_SESSION['shipping_postcode'] ) && $_SESSION['shipping_postcode'] != "" ) $shipping_zipcode = $_SESSION['shipping_postcode'];
132
- else $shipping_zipcode = $billing_zipcode = $_SESSION['billing_postcode'];
133
- $shipping_charges = $woocommerce->cart->shipping_total;
134
- $insert_guest = "INSERT INTO `".$wpdb->prefix . "ac_guest_abandoned_cart_history_lite`( billing_first_name, billing_last_name, email_id, billing_zipcode, shipping_zipcode, shipping_charges )
135
- VALUES ( '".$billing_first_name."', '".$billing_last_name."', '".$_SESSION['billing_email']."', '".$billing_zipcode."', '".$shipping_zipcode."', '".$shipping_charges."' )";
136
- $wpdb->query( $insert_guest );
137
-
138
- //Insert record in abandoned cart table for the guest user
139
- $user_id = $wpdb->insert_id;
140
- $_SESSION['user_id'] = $user_id;
141
- $current_time = current_time('timestamp');
142
- $cut_off_time = get_option('ac_cart_abandoned_time');
143
- $cart_cut_off_time = $cut_off_time * 60;
144
- $compare_time = $current_time - $cart_cut_off_time;
145
-
146
- $query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id = %d AND cart_ignored = '0' AND recovered_cart = '0' AND user_type = 'GUEST'";
147
- $results = $wpdb->get_results( $wpdb->prepare( $query, $user_id ) );
148
- $cart = array();
149
-
150
- foreach ( $woocommerce->cart->cart_contents as $cart_id => $value ) {
151
- $cart['cart'][$cart_id] = array();
152
- foreach ( $value as $k=>$v ) {
153
- $cart['cart'][$cart_id][$k] = $v;
154
- if ( $k == "quantity" ) {
155
- $product = get_product( $cart['cart'][$cart_id]['product_id'] );
156
- $product_type = $product->product_type;
157
-
158
- if ( $product_type == "variable" ) {
159
- if(is_plugin_active('woocommerce-dynamic-pricing/woocommerce-dynamic-pricing.php')) {
160
- $price = floatval( preg_replace( '#[^\d.]#', '', $woocommerce->cart->total ) );
161
- } else {
162
- $price = get_post_meta( $cart['cart'][$cart_id]['variation_id'], '_price', true);
163
- }
164
- } else {
165
- if(is_plugin_active('woocommerce-dynamic-pricing/woocommerce-dynamic-pricing.php')) {
166
- $price = floatval( preg_replace( '#[^\d.]#', '', $woocommerce->cart->total ) );
167
- } else {
168
- $price = get_post_meta( $cart['cart'][$cart_id]['product_id'], '_price', true);
169
- }
170
- }
171
- if(is_plugin_active('woocommerce-dynamic-pricing/woocommerce-dynamic-pricing.php')) {
172
- $cart['cart'][$cart_id]['line_total'] = $price;
173
- }else {
174
- $cart['cart'][$cart_id]['line_total'] = $cart['cart'][$cart_id]['quantity'] * $price;
175
- }
176
- $cart['cart'][$cart_id]['line_tax'] = '0';
177
- $cart['cart'][$cart_id]['line_subtotal'] = $cart['cart'][$cart_id]['line_total'];
178
- $cart['cart'][$cart_id]['line_subtotal_tax'] = $cart['cart'][$cart_id]['line_tax'];
179
- break;
180
- }
181
- }
182
- }
183
-
184
- if ( count( $results ) == 0 ) {
185
- $cart_info = json_encode( $cart );
186
- $insert_query = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`( user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, recovered_cart, user_type )
187
- VALUES ( '".$user_id."', '".$cart_info."', '".$current_time."', '0', '0', 'GUEST' )";
188
- $wpdb->query( $insert_query );
189
- $insert_persistent_cart = "INSERT INTO `".$wpdb->prefix."usermeta`( user_id, meta_key, meta_value )
190
- VALUES ( '".$user_id."', '_woocommerce_persistent_cart', '".$cart_info."' )";
191
- $wpdb->query( $insert_persistent_cart );
192
- }
193
- }
194
- }
195
-
196
- function guest_checkout_fields( $fields ) {
197
-
198
- if ( isset( $_SESSION['guest_first_name']) && $_SESSION['guest_first_name'] != "" ) $_POST['billing_first_name'] = $_SESSION['guest_first_name'];
199
-
200
- if ( isset( $_SESSION['guest_last_name']) && $_SESSION['guest_last_name'] != "" ) $_POST['billing_last_name'] = $_SESSION['guest_last_name'];
201
-
202
- if ( isset( $_SESSION['guest_email']) && $_SESSION['guest_email'] != "" ) $_POST['billing_email'] = $_SESSION['guest_email'];
203
- return $fields;
204
- }
205
- }
206
- $woocommerce_guest_ac = new woocommerce_guest_ac();
207
- }
208
- ?>