Version Description
(12.08.2019) =
- Enhancement - Added a setting to allow the admin the ability to enable/disable the sending of reminder emails.
- Tweak - Added a setting to allow the admin to add text for GDPR messages which will be displayed as links and allows the end user to opt out of cart tracking.
- Bug - Fixed some warnings displayed from the plugin.
- Bug - Carts were not accessible for guest users from links in the reminder emails.
Download this release
Release Info
Developer | Dhruvin |
Plugin | Abandoned Cart Lite for WooCommerce |
Version | 5.5 |
Comparing to | |
See all releases |
Code changes from version 5.4 to 5.5
- assets/js/wcal_guest_capture.js +53 -25
- assets/js/wcal_guest_capture.min.js +1 -1
- assets/js/wcal_registered_user_capture.js +16 -0
- cron/wcal_send_email.php +334 -331
- includes/admin/wcal_privacy_export.php +89 -89
- includes/admin/wcap_add_cart_popup_modal.php +439 -41
- includes/admin/wcap_pro_settings.php +54 -158
- includes/admin/wcap_pro_settings_callbacks.php +25 -46
- includes/classes/class-wcal-templates-table.php +68 -66
- includes/wcal-common.php +31 -0
- includes/wcal_all_component.php +35 -26
- includes/wcal_class-guest.php +20 -3
- includes/wcal_data_tracking_message.php +34 -37
- readme.txt +7 -0
- uninstall.php +2 -1
- woocommerce-ac.php +701 -584
assets/js/wcal_guest_capture.js
CHANGED
@@ -1,29 +1,57 @@
|
|
|
|
1 |
jQuery( 'input#billing_email' ).on( 'change', function() {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
};
|
27 |
-
|
|
|
|
|
|
|
|
|
28 |
});
|
|
|
29 |
});
|
1 |
+
var gdpr_consent = true;
|
2 |
jQuery( 'input#billing_email' ).on( 'change', function() {
|
3 |
+
|
4 |
+
if( gdpr_consent && wcal_guest_capture_params._show_gdpr_message ) {
|
5 |
+
var data = {
|
6 |
+
billing_first_name : jQuery('#billing_first_name').val(),
|
7 |
+
billing_last_name : jQuery('#billing_last_name').val(),
|
8 |
+
billing_company : jQuery('#billing_company').val(),
|
9 |
+
billing_address_1 : jQuery('#billing_address_1').val(),
|
10 |
+
billing_address_2 : jQuery('#billing_address_2').val(),
|
11 |
+
billing_city : jQuery('#billing_city').val(),
|
12 |
+
billing_state : jQuery('#billing_state').val(),
|
13 |
+
billing_postcode : jQuery('#billing_postcode').val(),
|
14 |
+
billing_country : jQuery('#billing_country').val(),
|
15 |
+
billing_phone : jQuery('#billing_phone').val(),
|
16 |
+
billing_email : jQuery('#billing_email').val(),
|
17 |
+
order_notes : jQuery('#order_comments').val(),
|
18 |
+
shipping_first_name : jQuery('#shipping_first_name').val(),
|
19 |
+
shipping_last_name : jQuery('#shipping_last_name').val(),
|
20 |
+
shipping_company : jQuery('#shipping_company').val(),
|
21 |
+
shipping_address_1 : jQuery('#shipping_address_1').val(),
|
22 |
+
shipping_address_2 : jQuery('#shipping_address_2').val(),
|
23 |
+
shipping_city : jQuery('#shipping_city').val(),
|
24 |
+
shipping_state : jQuery('#shipping_state').val(),
|
25 |
+
shipping_postcode : jQuery('#shipping_postcode').val(),
|
26 |
+
shipping_country : jQuery('#shipping_country').val(),
|
27 |
+
ship_to_billing : jQuery('#shiptobilling-checkbox').val(),
|
28 |
+
action: 'save_data'
|
29 |
+
};
|
30 |
+
jQuery.post( wcal_guest_capture_params.ajax_url, data, function(response) {
|
31 |
+
});
|
32 |
+
}
|
33 |
+
});
|
34 |
+
|
35 |
+
jQuery( document ).ready( function() {
|
36 |
+
|
37 |
+
if ( wcal_guest_capture_params._show_gdpr_message && ! jQuery("#wcal_gdpr_message_block").length && gdpr_consent ) {
|
38 |
+
jQuery("#billing_email").after("<span id='wcal_gdpr_message_block'> <span style='font-size: small'> "+ wcal_guest_capture_params._gdpr_message +" <a style='cursor: pointer' id='wcal_gdpr_no_thanks'> "+ wcal_guest_capture_params._gdpr_nothanks_msg +" </a></span></span>");
|
39 |
+
}
|
40 |
+
|
41 |
+
jQuery("#wcal_gdpr_no_thanks").click( function () {
|
42 |
+
wcal_guest_capture_params._show_gdpr_message = false;
|
43 |
+
|
44 |
+
gdpr_consent = false;
|
45 |
+
|
46 |
+
// run an ajax call and save the data that user did not give consent
|
47 |
+
var data = {
|
48 |
+
action : 'wcal_gdpr_refused'
|
49 |
};
|
50 |
+
jQuery.post( wcal_guest_capture_params.ajax_url, data, function() {
|
51 |
+
jQuery("#wcal_gdpr_message_block").empty().append("<span style='font-size: small'>" +
|
52 |
+
wcal_guest_capture_params._gdpr_after_no_thanks_msg + "</span>").delay(5000).fadeOut();
|
53 |
+
});
|
54 |
+
|
55 |
});
|
56 |
+
|
57 |
});
|
assets/js/wcal_guest_capture.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(
|
1 |
+
var gdpr_consent=!0;jQuery("input#billing_email").on("change",function(){if(gdpr_consent&&wcal_guest_capture_params._show_gdpr_message){var a={billing_first_name:jQuery("#billing_first_name").val(),billing_last_name:jQuery("#billing_last_name").val(),billing_company:jQuery("#billing_company").val(),billing_address_1:jQuery("#billing_address_1").val(),billing_address_2:jQuery("#billing_address_2").val(),billing_city:jQuery("#billing_city").val(),billing_state:jQuery("#billing_state").val(),billing_postcode:jQuery("#billing_postcode").val(),billing_country:jQuery("#billing_country").val(),billing_phone:jQuery("#billing_phone").val(),billing_email:jQuery("#billing_email").val(),order_notes:jQuery("#order_comments").val(),shipping_first_name:jQuery("#shipping_first_name").val(),shipping_last_name:jQuery("#shipping_last_name").val(),shipping_company:jQuery("#shipping_company").val(),shipping_address_1:jQuery("#shipping_address_1").val(),shipping_address_2:jQuery("#shipping_address_2").val(),shipping_city:jQuery("#shipping_city").val(),shipping_state:jQuery("#shipping_state").val(),shipping_postcode:jQuery("#shipping_postcode").val(),shipping_country:jQuery("#shipping_country").val(),ship_to_billing:jQuery("#shiptobilling-checkbox").val(),action:"save_data"};jQuery.post(wcal_guest_capture_params.ajax_url,a,function(a){})}}),jQuery(document).ready(function(){wcal_guest_capture_params._show_gdpr_message&&!jQuery("#wcal_gdpr_message_block").length&&gdpr_consent&&jQuery("#billing_email").after("<span id='wcal_gdpr_message_block'> <span style='font-size: small'> "+wcal_guest_capture_params._gdpr_message+" <a style='cursor: pointer' id='wcal_gdpr_no_thanks'> "+wcal_guest_capture_params._gdpr_nothanks_msg+" </a></span></span>"),jQuery("#wcal_gdpr_no_thanks").click(function(){wcal_guest_capture_params._show_gdpr_message=!1,gdpr_consent=!1;jQuery.post(wcal_guest_capture_params.ajax_url,{action:"wcal_gdpr_refused"},function(){jQuery("#wcal_gdpr_message_block").empty().append("<span style='font-size: small'>"+wcal_guest_capture_params._gdpr_after_no_thanks_msg+"</span>").delay(5e3).fadeOut()})})});
|
assets/js/wcal_registered_user_capture.js
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery( document ).ready( function() {
|
2 |
+
|
3 |
+
jQuery("#wcal_gdpr_no_thanks").click( function () {
|
4 |
+
|
5 |
+
// run an ajax call and save the data that user did not give consent
|
6 |
+
var data = {
|
7 |
+
action : 'wcal_gdpr_refused'
|
8 |
+
};
|
9 |
+
jQuery.post( wcal_registered_capture_params.ajax_url, data, function() {
|
10 |
+
jQuery("#wcal_gdpr_message_block").empty().append("<span style='font-size: small'>" +
|
11 |
+
wcal_registered_capture_params._gdpr_after_no_thanks_msg + "</span>").delay(5000).fadeOut();
|
12 |
+
});
|
13 |
+
|
14 |
+
} );
|
15 |
+
|
16 |
+
});
|
cron/wcal_send_email.php
CHANGED
@@ -38,13 +38,8 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
|
|
38 |
* It will send the automatic reminder emails to the customers
|
39 |
* @since 1.3
|
40 |
*/
|
41 |
-
class woocommerce_abandon_cart_cron {
|
42 |
-
|
43 |
-
var $cart_abandon_cut_off_time_cron;
|
44 |
-
public function __construct() {
|
45 |
-
$this->cart_settings_cron = get_option( 'ac_lite_cart_abandoned_time' );
|
46 |
-
$this->cart_abandon_cut_off_time_cron = ( $this->cart_settings_cron ) * 60;
|
47 |
-
}
|
48 |
/**
|
49 |
* It will send the reminder emails to the cutomers.
|
50 |
* It will also replace the merge code to its original data.
|
@@ -55,365 +50,373 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
|
|
55 |
*/
|
56 |
function wcal_send_email_notification() {
|
57 |
global $wpdb, $woocommerce;
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
$hour_seconds = 3600; // 60 * 60
|
66 |
-
$day_seconds = 86400; // 24 * 60 * 60
|
67 |
-
foreach ( $results as $key => $value ) {
|
68 |
-
if ( $value->day_or_hour == 'Days' ) {
|
69 |
-
$time_to_send_template_after = $value->frequency * $day_seconds;
|
70 |
-
} elseif ( $value->day_or_hour == 'Hours' ) {
|
71 |
-
$time_to_send_template_after = $value->frequency * $hour_seconds;
|
72 |
-
}
|
73 |
-
|
74 |
-
$carts = $this->wcal_get_carts( $time_to_send_template_after, $cart_abandon_cut_off_time, $value->id );
|
75 |
-
$email_frequency = $value->frequency;
|
76 |
-
$email_body_template = $value->body;
|
77 |
-
$template_email_subject = stripslashes ( $value->subject );
|
78 |
-
$template_email_subject = convert_smilies ( $template_email_subject );
|
79 |
-
$wcal_from_name = get_option ( 'wcal_from_name' );
|
80 |
-
$wcal_from_email = get_option ( 'wcal_from_email' );
|
81 |
-
$wcal_reply_email = get_option ( 'wcal_reply_email' );
|
82 |
-
if ( class_exists( 'WP_Better_Emails' ) ) {
|
83 |
-
$headers = "From: " . $wcal_from_name . " <" . $wcal_from_email . ">" . "\r\n";
|
84 |
-
$headers .= "Content-Type: text/plain"."\r\n";
|
85 |
-
$headers .= "Reply-To: " . $wcal_reply_email . " " . "\r\n";
|
86 |
-
} else {
|
87 |
-
$headers = "From: " . $wcal_from_name . " <" . $wcal_from_email . ">" . "\r\n";
|
88 |
-
$headers .= "Content-Type: text/html"."\r\n";
|
89 |
-
$headers .= "Reply-To: " . $wcal_reply_email . " " . "\r\n";
|
90 |
}
|
91 |
-
|
92 |
-
$
|
93 |
-
|
94 |
-
$
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
-
$
|
114 |
-
|
115 |
-
$user_biiling_email = get_user_meta( $user_id, $key, $single );
|
116 |
-
if ( isset( $user_biiling_email ) && $user_biiling_email != '' ) {
|
117 |
-
$value->user_email = $user_biiling_email;
|
118 |
}
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
}
|
123 |
-
$cart = new stdClass();
|
124 |
-
if( !empty( $cart_info_db_field->cart ) ) {
|
125 |
-
$cart = $cart_info_db_field->cart;
|
126 |
-
}
|
127 |
-
if( count( get_object_vars( $cart ) ) > 0 && isset( $value->user_id ) && '0' != $value->user_id && isset( $value->id ) ) {
|
128 |
-
$cart_update_time = $value->abandoned_cart_time;
|
129 |
-
$new_user = $this->wcal_check_sent_history( $value->user_id, $cart_update_time, $template_id, $value->id );
|
130 |
-
if ( $new_user == true ) {
|
131 |
-
|
132 |
-
/**
|
133 |
-
* When there are 3 templates and for cart id 1 all template time has been reached. BUt all templates
|
134 |
-
* are deactivated.
|
135 |
-
* If we activate all 3 template then at a 1 time all 3 email templates send to the users.
|
136 |
-
* So below function check that after first email is sent time and then from that time it will send the
|
137 |
-
* 2nd template time. ( It will not consider the cart abadoned time in this case. )
|
138 |
-
*/
|
139 |
-
|
140 |
-
$wcal_check_cart_needed_for_multiple_template = $this->wcal_remove_cart_for_mutiple_templates( $value->id, $time_to_send_template_after, $template_id );
|
141 |
-
|
142 |
-
/**
|
143 |
-
* When we click on the place order button, we check if the order is placed after the
|
144 |
-
* cut off time. And if yes then if the status of the order is pending or falied then
|
145 |
-
* we keep it as the abandonoed and we need to send reminder emails. So in below function
|
146 |
-
* we first check if any order is placed with todays date then we do not send the
|
147 |
-
* reminder email. But what if placed order status is pending or falied? So this
|
148 |
-
* condition will not call that function andthe reminder email will be sent.
|
149 |
-
*/
|
150 |
-
|
151 |
-
$wcal_check_if_cart_is_present_in_post_meta = "SELECT wpm.post_id, wpost.post_date, wpost.post_status FROM `" . $wpdb->prefix . "postmeta` AS wpm
|
152 |
-
LEFT JOIN `" . $wpdb->prefix . "posts` AS wpost
|
153 |
-
ON wpm.post_id = wpost.ID
|
154 |
-
WHERE wpm.meta_key = 'wcal_recover_order_placed' AND
|
155 |
-
wpm.meta_value = %s AND wpm.post_id = wpost.ID AND
|
156 |
-
wpost.post_type = 'shop_order'
|
157 |
-
ORDER BY wpm.post_id DESC LIMIT 1";
|
158 |
-
|
159 |
-
$results_wcal_check_if_cart_is_present_in_post_meta = $wpdb->get_results( $wpdb->prepare( $wcal_check_if_cart_is_present_in_post_meta, $value->id ) );
|
160 |
-
|
161 |
-
$wcap_check_cart_staus_need_to_update = false;
|
162 |
-
|
163 |
-
if ( empty ($results_wcal_check_if_cart_is_present_in_post_meta) ||
|
164 |
-
( isset( $results_wcal_check_if_cart_is_present_in_post_meta[0] ) &&
|
165 |
-
$results_wcal_check_if_cart_is_present_in_post_meta[0]->post_status != "wc-failed" &&
|
166 |
-
$results_wcal_check_if_cart_is_present_in_post_meta [0]->post_status != "wc-pending" ) ){
|
167 |
-
|
168 |
-
$wcap_check_cart_staus_need_to_update = woocommerce_abandon_cart_cron::wcal_update_abandoned_cart_status_for_placed_orders ( $time_to_send_template_after, $cart_update_time, $value->user_id, $value->user_type, $value->id, $value->user_email );
|
169 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
}
|
196 |
-
} else {
|
197 |
-
$user_first_name = '';
|
198 |
-
$user_first_name_temp = get_user_meta( $value->user_id, 'billing_first_name', true );
|
199 |
-
if( isset( $user_first_name_temp ) && "" == $user_first_name_temp ) {
|
200 |
-
$user_data = get_userdata( $user_id );
|
201 |
-
if ( isset( $user_data->first_name ) ) {
|
202 |
-
$user_first_name = $user_data->first_name;
|
203 |
-
} else {
|
204 |
-
$user_first_name = '';
|
205 |
}
|
206 |
} else {
|
207 |
-
$user_first_name
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
$user_last_name = $user_data->last_name;
|
217 |
} else {
|
218 |
-
$
|
219 |
}
|
220 |
-
|
221 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
223 |
-
$
|
224 |
-
$
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
$
|
230 |
-
$
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
$results_sent = $wpdb->get_results( $wpdb->prepare( $query_id, $template_id, $value->id ) );
|
243 |
-
if ( count( $results_sent ) > 0 ) {
|
244 |
-
$email_sent_id = $results_sent[0]->id;
|
245 |
-
} else {
|
246 |
-
$email_sent_id = '';
|
247 |
-
}
|
248 |
-
|
249 |
-
if ( '' != $email_sent_id ) {
|
250 |
-
|
251 |
-
if( $woocommerce->version < '2.3' ) {
|
252 |
-
$cart_page_link = $woocommerce->cart->get_cart_url();
|
253 |
} else {
|
254 |
-
$
|
255 |
-
$cart_page_link = $cart_page_id ? get_permalink( $cart_page_id ) : '';
|
256 |
}
|
257 |
|
258 |
-
|
259 |
-
$validate_cart = $this->wcal_encrypt_validate( $encoding_cart );
|
260 |
-
$cart_link_track = get_option('siteurl').'/?wcal_action=track_links&validate=' . $validate_cart;
|
261 |
-
$email_body = str_replace( "{{cart.link}}", $cart_link_track, $email_body );
|
262 |
|
263 |
-
|
264 |
-
|
265 |
-
$email_sent_id_address = $results_sent[0]->sent_email_id;
|
266 |
-
}
|
267 |
-
$encrypt_email_sent_id_address = hash( 'sha256', $email_sent_id_address );
|
268 |
-
$plugins_url = get_option( 'siteurl' ) . "/?wcal_track_unsubscribe=wcal_unsubscribe&validate=" . $validate_unsubscribe . "&track_email_id=" . $encrypt_email_sent_id_address;
|
269 |
-
$unsubscribe_link_track = $plugins_url;
|
270 |
-
$email_body = str_replace( "{{cart.unsubscribe}}" , $unsubscribe_link_track , $email_body );
|
271 |
-
$var = '';
|
272 |
-
if( preg_match( "{{products.cart}}", $email_body, $matched ) ) {
|
273 |
-
if ( class_exists( 'WP_Better_Emails' ) ) {
|
274 |
-
$var = '<table width = 100%>
|
275 |
-
<tr> <td colspan="5"> <h3>'.__( "Your Shopping Cart", "woocommerce-abandoned-cart" ).'</h3> </td></tr>
|
276 |
-
<tr>
|
277 |
-
<th>'.__( "Item", "woocommerce-abandoned-cart" ).'</th>
|
278 |
-
<th>'.__( "Name", "woocommerce-abandoned-cart" ).'</th>
|
279 |
-
<th>'.__( "Quantity", "woocommerce-abandoned-cart" ).'</th>
|
280 |
-
<th>'.__( "Price", "woocommerce-abandoned-cart" ).'</th>
|
281 |
-
<th>'.__( "Line Subtotal", "woocommerce-abandoned-cart" ).'</th>
|
282 |
-
</tr>';
|
283 |
} else {
|
284 |
-
$
|
285 |
-
|
286 |
-
<tr>
|
287 |
-
<th>'.__( "Item", 'woocommerce-abandoned-cart' ).'</th>
|
288 |
-
<th>'.__( "Name", 'woocommerce-abandoned-cart' ).'</th>
|
289 |
-
<th>'.__( "Quantity", 'woocommerce-abandoned-cart' ).'</th>
|
290 |
-
<th>'.__( "Price", 'woocommerce-abandoned-cart' ).'</th>
|
291 |
-
<th>'.__( "Line Subtotal", 'woocommerce-abandoned-cart' ).'</th>
|
292 |
-
</tr>';
|
293 |
}
|
294 |
-
$cart_details = $cart_info_db_field->cart;
|
295 |
-
$cart_total = $item_subtotal = $item_total = 0;
|
296 |
-
$sub_line_prod_name = '';
|
297 |
-
foreach ( $cart_details as $k => $v ) {
|
298 |
-
$quantity_total = $v->quantity;
|
299 |
-
$product_id = $v->product_id;
|
300 |
-
$product = wc_get_product( $product_id );
|
301 |
-
if ( $product ) {
|
302 |
-
$prod_name = get_post( $product_id );
|
303 |
-
$product_link_track = get_permalink( $product_id );
|
304 |
-
$product_name = $prod_name->post_title;
|
305 |
-
if( $sub_line_prod_name == '' ) {
|
306 |
-
$sub_line_prod_name = $product_name;
|
307 |
-
}
|
308 |
-
// Item subtotal is calculated as product total including taxes
|
309 |
-
if( $v->line_tax != 0 && $v->line_tax > 0 ) {
|
310 |
-
$item_subtotal = $item_subtotal + $v->line_total + $v->line_tax;
|
311 |
-
} else {
|
312 |
-
$item_subtotal = $item_subtotal + $v->line_total;
|
313 |
-
}
|
314 |
-
// Line total
|
315 |
-
$item_total = $item_subtotal;
|
316 |
-
$item_subtotal = $item_subtotal / $quantity_total;
|
317 |
-
$item_total_display = wc_price( $item_total );
|
318 |
-
$item_subtotal = wc_price( $item_subtotal );
|
319 |
-
//$product = wc_get_product( $product_id );
|
320 |
-
$prod_image = $product->get_image();
|
321 |
-
$image_url = wp_get_attachment_url( get_post_thumbnail_id( $product_id ) );
|
322 |
-
if ( strpos( $image_url, '/' ) === 0 ) {
|
323 |
-
$image_url = get_option('siteurl') . $image_url;
|
324 |
-
}
|
325 |
-
if ( isset( $v->variation_id ) && '' != $v->variation_id ) {
|
326 |
-
$variation_id = $v->variation_id;
|
327 |
-
$variation = wc_get_product( $variation_id );
|
328 |
-
$name = $variation->get_formatted_name() ;
|
329 |
-
$explode_all = explode ( "–", $name );
|
330 |
-
if( version_compare( $woocommerce->version, '3.0.0', ">=" ) ) {
|
331 |
-
$wcap_sku = '';
|
332 |
-
if ( $variation->get_sku() ) {
|
333 |
-
$wcap_sku = "SKU: " . $variation->get_sku() . "<br>";
|
334 |
-
}
|
335 |
-
$wcap_get_formatted_variation = wc_get_formatted_variation( $variation, true );
|
336 |
|
337 |
-
|
|
|
|
|
|
|
338 |
|
339 |
-
|
340 |
-
|
341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
}
|
343 |
-
|
344 |
-
$
|
345 |
-
|
346 |
-
$
|
347 |
-
|
348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
$product_name_with_variable = $product_name_with_variable . html_entity_decode ( $explode_many_varaition_value ) . "<br>";
|
350 |
}
|
351 |
-
} else {
|
352 |
-
$product_name_with_variable = $product_name_with_variable . html_entity_decode ( $explode_many_varaition_value ) . "<br>";
|
353 |
}
|
|
|
354 |
}
|
355 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
}
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
<td>
|
|
|
|
|
|
|
|
|
363 |
</tr>';
|
364 |
-
$
|
365 |
-
|
366 |
-
$
|
|
|
367 |
}else {
|
368 |
-
$
|
369 |
-
$
|
370 |
-
|
371 |
-
$p_exists = false;
|
372 |
}
|
373 |
}
|
374 |
|
375 |
-
|
376 |
-
$
|
377 |
-
$
|
378 |
-
|
379 |
-
|
380 |
-
<td> </td>
|
381 |
-
<td>'.__( "Cart Total:", 'woocommerce-abandoned-cart' ).'</td>
|
382 |
-
<td> '.$cart_total.'</td>
|
383 |
-
</tr>';
|
384 |
-
$var .= '</table>
|
385 |
-
';
|
386 |
-
$email_body = str_replace( "{{products.cart}}", $var, $email_body );
|
387 |
-
$email_subject = str_replace( "{{product.name}}", __( $sub_line_prod_name, 'woocommerce-abandoned-cart' ), $email_subject );
|
388 |
-
}else {
|
389 |
-
$email_body = str_replace( "{{products.cart}}", 'Product no longer exists', $email_body );
|
390 |
-
$email_subject = str_replace( "{{product.name}}", __( $sub_line_prod_name, 'woocommerce-abandoned-cart' ), $email_subject );
|
391 |
-
}
|
392 |
-
}
|
393 |
|
394 |
-
|
395 |
-
|
396 |
-
$email_body_final = convert_smilies( $email_body_final );
|
397 |
-
if ( isset( $is_wc_template ) && "1" == $is_wc_template ){
|
398 |
-
ob_start();
|
399 |
|
400 |
-
|
401 |
-
$email_body_template_header = ob_get_clean();
|
402 |
|
403 |
-
|
|
|
404 |
|
405 |
-
|
406 |
-
|
407 |
|
408 |
-
|
409 |
-
$email_body_template_footer = str_replace( '{site_title}', $site_title, $email_body_template_footer );
|
410 |
|
411 |
-
|
412 |
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
wp_mail( $user_email, $email_subject, __( $email_body_final, 'woocommerce-abandoned-cart' ), $headers );
|
417 |
}
|
418 |
}
|
419 |
}
|
@@ -483,7 +486,7 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
|
|
483 |
}
|
484 |
$cart_ignored = 0;
|
485 |
$unsubscribe = 0;
|
486 |
-
$query = "SELECT wpac . * , wpu.user_login, wpu.user_email
|
487 |
FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac
|
488 |
LEFT JOIN ".$wpdb->base_prefix."users AS wpu ON wpac.user_id = wpu.id
|
489 |
WHERE cart_ignored = %s AND unsubscribe_link = %s AND abandoned_cart_time < $cart_time
|
38 |
* It will send the automatic reminder emails to the customers
|
39 |
* @since 1.3
|
40 |
*/
|
41 |
+
class woocommerce_abandon_cart_cron {
|
42 |
+
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* It will send the reminder emails to the cutomers.
|
45 |
* It will also replace the merge code to its original data.
|
50 |
*/
|
51 |
function wcal_send_email_notification() {
|
52 |
global $wpdb, $woocommerce;
|
53 |
+
|
54 |
+
if( 'on' == get_option( 'wcal_enable_cart_emails' ) ) {
|
55 |
+
//Grab the cart abandoned cut-off time from database.
|
56 |
+
$cart_settings = get_option( 'ac_lite_cart_abandoned_time' );
|
57 |
+
|
58 |
+
if( $cart_settings == '' ) {
|
59 |
+
$cart_settings = 10;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
+
|
62 |
+
$cart_abandon_cut_off_time = $cart_settings * 60;
|
63 |
+
//Fetch all active templates present in the system
|
64 |
+
$query = "SELECT wpet . * FROM `".$wpdb->prefix."ac_email_templates_lite` AS wpet
|
65 |
+
WHERE wpet.is_active = '1' ORDER BY `day_or_hour` DESC, `frequency` ASC ";
|
66 |
+
$results = $wpdb->get_results( $query );
|
67 |
+
$hour_seconds = 3600; // 60 * 60
|
68 |
+
$day_seconds = 86400; // 24 * 60 * 60
|
69 |
+
foreach ( $results as $key => $value ) {
|
70 |
+
if ( $value->day_or_hour == 'Days' ) {
|
71 |
+
$time_to_send_template_after = $value->frequency * $day_seconds;
|
72 |
+
} elseif ( $value->day_or_hour == 'Hours' ) {
|
73 |
+
$time_to_send_template_after = $value->frequency * $hour_seconds;
|
74 |
+
}
|
75 |
+
|
76 |
+
$carts = $this->wcal_get_carts( $time_to_send_template_after, $cart_abandon_cut_off_time, $value->id );
|
77 |
+
$email_frequency = $value->frequency;
|
78 |
+
$email_body_template = $value->body;
|
79 |
+
$template_email_subject = stripslashes ( $value->subject );
|
80 |
+
$template_email_subject = convert_smilies ( $template_email_subject );
|
81 |
+
$wcal_from_name = get_option ( 'wcal_from_name' );
|
82 |
+
$wcal_from_email = get_option ( 'wcal_from_email' );
|
83 |
+
$wcal_reply_email = get_option ( 'wcal_reply_email' );
|
84 |
+
if ( class_exists( 'WP_Better_Emails' ) ) {
|
85 |
+
$headers = "From: " . $wcal_from_name . " <" . $wcal_from_email . ">" . "\r\n";
|
86 |
+
$headers .= "Content-Type: text/plain"."\r\n";
|
87 |
+
$headers .= "Reply-To: " . $wcal_reply_email . " " . "\r\n";
|
88 |
+
} else {
|
89 |
+
$headers = "From: " . $wcal_from_name . " <" . $wcal_from_email . ">" . "\r\n";
|
90 |
+
$headers .= "Content-Type: text/html"."\r\n";
|
91 |
+
$headers .= "Reply-To: " . $wcal_reply_email . " " . "\r\n";
|
92 |
+
}
|
93 |
+
$template_id = $value->id;
|
94 |
+
$is_wc_template = $value->is_wc_template;
|
95 |
+
$wc_template_header_text = $value->wc_email_header != '' ? $value->wc_email_header : __( 'Abandoned cart reminder', 'woocommerce-abandoned-cart');
|
96 |
+
$wc_template_header = stripslashes( $wc_template_header_text );
|
97 |
+
if ( '' != $email_body_template ) {
|
98 |
+
foreach ( $carts as $key => $value ) {
|
99 |
+
|
100 |
+
$wcal_is_guest_id_correct = $this->wcal_get_is_guest_valid ( $value->user_id, $value->user_type ) ;
|
101 |
+
if ( true === $wcal_is_guest_id_correct ) {
|
102 |
+
|
103 |
+
if ( $value->user_type == "GUEST" && $value->user_id != '0' ) {
|
104 |
+
$value->user_login = "";
|
105 |
+
$query_guest = "SELECT billing_first_name, billing_last_name, email_id FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite`
|
106 |
+
WHERE id = %d";
|
107 |
+
$results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $value->user_id ) );
|
108 |
+
if ( count( $results_guest ) > 0 && isset( $results_guest[0]->email_id ) ) {
|
109 |
+
$value->user_email = $results_guest[0]->email_id;
|
110 |
+
}
|
111 |
+
} else {
|
112 |
+
if( isset( $value->user_id ) ) {
|
113 |
+
$user_id = $value->user_id;
|
114 |
+
}
|
115 |
+
$key = 'billing_email';
|
116 |
+
$single = true;
|
117 |
+
$user_biiling_email = get_user_meta( $user_id, $key, $single );
|
118 |
+
if ( isset( $user_biiling_email ) && $user_biiling_email != '' ) {
|
119 |
+
$value->user_email = $user_biiling_email;
|
120 |
+
}
|
121 |
}
|
122 |
+
if( isset( $value->abandoned_cart_info ) ) {
|
123 |
+
$cart_info_db_field = json_decode( $value->abandoned_cart_info );
|
|
|
|
|
|
|
124 |
}
|
125 |
+
$cart = new stdClass();
|
126 |
+
if( !empty( $cart_info_db_field->cart ) ) {
|
127 |
+
$cart = $cart_info_db_field->cart;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
+
if( count( get_object_vars( $cart ) ) > 0 && isset( $value->user_id ) && '0' != $value->user_id && isset( $value->id ) ) {
|
130 |
+
$cart_update_time = $value->abandoned_cart_time;
|
131 |
+
$new_user = $this->wcal_check_sent_history( $value->user_id, $cart_update_time, $template_id, $value->id );
|
132 |
+
if ( $new_user == true ) {
|
133 |
+
|
134 |
+
/**
|
135 |
+
* When there are 3 templates and for cart id 1 all template time has been reached. BUt all templates
|
136 |
+
* are deactivated.
|
137 |
+
* If we activate all 3 template then at a 1 time all 3 email templates send to the users.
|
138 |
+
* So below function check that after first email is sent time and then from that time it will send the
|
139 |
+
* 2nd template time. ( It will not consider the cart abadoned time in this case. )
|
140 |
+
*/
|
141 |
+
|
142 |
+
$wcal_check_cart_needed_for_multiple_template = $this->wcal_remove_cart_for_mutiple_templates( $value->id, $time_to_send_template_after, $template_id );
|
143 |
+
|
144 |
+
/**
|
145 |
+
* When we click on the place order button, we check if the order is placed after the
|
146 |
+
* cut off time. And if yes then if the status of the order is pending or falied then
|
147 |
+
* we keep it as the abandonoed and we need to send reminder emails. So in below function
|
148 |
+
* we first check if any order is placed with todays date then we do not send the
|
149 |
+
* reminder email. But what if placed order status is pending or falied? So this
|
150 |
+
* condition will not call that function andthe reminder email will be sent.
|
151 |
+
*/
|
152 |
+
|
153 |
+
$wcal_check_if_cart_is_present_in_post_meta = "SELECT wpm.post_id, wpost.post_date, wpost.post_status FROM `" . $wpdb->prefix . "postmeta` AS wpm
|
154 |
+
LEFT JOIN `" . $wpdb->prefix . "posts` AS wpost
|
155 |
+
ON wpm.post_id = wpost.ID
|
156 |
+
WHERE wpm.meta_key = 'wcal_recover_order_placed' AND
|
157 |
+
wpm.meta_value = %s AND wpm.post_id = wpost.ID AND
|
158 |
+
wpost.post_type = 'shop_order'
|
159 |
+
ORDER BY wpm.post_id DESC LIMIT 1";
|
160 |
+
|
161 |
+
$results_wcal_check_if_cart_is_present_in_post_meta = $wpdb->get_results( $wpdb->prepare( $wcal_check_if_cart_is_present_in_post_meta, $value->id ) );
|
162 |
+
|
163 |
+
$wcap_check_cart_staus_need_to_update = false;
|
164 |
+
|
165 |
+
if ( empty ($results_wcal_check_if_cart_is_present_in_post_meta) ||
|
166 |
+
( isset( $results_wcal_check_if_cart_is_present_in_post_meta[0] ) &&
|
167 |
+
$results_wcal_check_if_cart_is_present_in_post_meta[0]->post_status != "wc-failed" &&
|
168 |
+
$results_wcal_check_if_cart_is_present_in_post_meta [0]->post_status != "wc-pending" ) ){
|
169 |
+
|
170 |
+
$wcap_check_cart_staus_need_to_update = woocommerce_abandon_cart_cron::wcal_update_abandoned_cart_status_for_placed_orders ( $time_to_send_template_after, $cart_update_time, $value->user_id, $value->user_type, $value->id, $value->user_email );
|
171 |
+
}
|
172 |
|
173 |
+
if ( false == $wcal_check_cart_needed_for_multiple_template &&
|
174 |
+
false == $wcap_check_cart_staus_need_to_update ) {
|
175 |
+
|
176 |
+
$cart_info_db = $value->abandoned_cart_info;
|
177 |
+
$email_subject = $template_email_subject;
|
178 |
+
$email_body = $email_body_template;
|
179 |
+
$wcal_check_cart_total = $this->wcal_check_cart_total( $cart );
|
180 |
+
if( true == $wcal_check_cart_total ) {
|
181 |
+
if ( $value->user_type == "GUEST" ) {
|
182 |
+
if ( isset( $results_guest[0]->billing_first_name ) ) {
|
183 |
+
$email_body = str_replace( "{{customer.firstname}}", $results_guest[0]->billing_first_name, $email_body );
|
184 |
+
$email_subject = str_replace( "{{customer.firstname}}", $results_guest[0]->billing_first_name, $email_subject );
|
185 |
+
}
|
186 |
+
if ( isset( $results_guest[0]->billing_last_name ) ) {
|
187 |
+
$email_body = str_replace( "{{customer.lastname}}", $results_guest[0]->billing_last_name, $email_body );
|
188 |
+
}
|
189 |
+
if ( isset( $results_guest[0]->billing_first_name ) && isset( $results_guest[0]->billing_last_name ) ) {
|
190 |
+
$email_body = str_replace( "{{customer.fullname}}", $results_guest[0]->billing_first_name." ".$results_guest[0]->billing_last_name, $email_body );
|
191 |
+
}
|
192 |
+
else if ( isset( $results_guest[0]->billing_first_name ) ) {
|
193 |
+
$email_body = str_replace( "{{customer.fullname}}", $results_guest[0]->billing_first_name, $email_body );
|
194 |
+
}
|
195 |
+
else if ( isset( $results_guest[0]->billing_last_name ) ) {
|
196 |
+
$email_body = str_replace( "{{customer.fullname}}", $results_guest[0]->billing_last_name, $email_body );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
}
|
198 |
} else {
|
199 |
+
$user_first_name = '';
|
200 |
+
$user_first_name_temp = get_user_meta( $value->user_id, 'billing_first_name', true );
|
201 |
+
if( isset( $user_first_name_temp ) && "" == $user_first_name_temp ) {
|
202 |
+
$user_data = get_userdata( $user_id );
|
203 |
+
if ( isset( $user_data->first_name ) ) {
|
204 |
+
$user_first_name = $user_data->first_name;
|
205 |
+
} else {
|
206 |
+
$user_first_name = '';
|
207 |
+
}
|
|
|
208 |
} else {
|
209 |
+
$user_first_name = $user_first_name_temp;
|
210 |
}
|
211 |
+
$email_body = str_replace( "{{customer.firstname}}", $user_first_name, $email_body );
|
212 |
+
$email_subject = str_replace( "{{customer.firstname}}", $user_first_name, $email_subject );
|
213 |
+
$user_last_name = '';
|
214 |
+
$user_last_name_temp = get_user_meta( $value->user_id, 'billing_last_name', true );
|
215 |
+
if( isset( $user_last_name_temp ) && "" == $user_last_name_temp ) {
|
216 |
+
$user_data = get_userdata( $user_id );
|
217 |
+
if ( isset( $user_data->last_name) ) {
|
218 |
+
$user_last_name = $user_data->last_name;
|
219 |
+
} else {
|
220 |
+
$user_last_name = '';
|
221 |
+
}
|
222 |
+
} else {
|
223 |
+
$user_last_name = $user_last_name_temp;
|
224 |
+
}
|
225 |
+
$email_body = str_replace( "{{customer.lastname}}", $user_last_name, $email_body );
|
226 |
+
$email_body = str_replace( "{{customer.fullname}}", $user_first_name." ".$user_last_name, $email_body );
|
227 |
}
|
228 |
+
$order_date = "";
|
229 |
+
if( $cart_update_time != "" && $cart_update_time != 0 ) {
|
230 |
+
$date_format = date_i18n( get_option( 'date_format' ), $cart_update_time );
|
231 |
+
$time_format = date_i18n( get_option( 'time_format' ), $cart_update_time );
|
232 |
+
$order_date = $date_format . ' ' . $time_format;
|
233 |
+
}
|
234 |
+
$email_body = str_replace( "{{cart.abandoned_date}}", $order_date, $email_body );
|
235 |
+
$query_sent = "INSERT INTO `".$wpdb->prefix."ac_sent_history_lite` ( template_id, abandoned_order_id, sent_time, sent_email_id )
|
236 |
+
VALUES ( %s, %s, '".current_time( 'mysql' )."', %s )";
|
237 |
+
|
238 |
+
$wpdb->query( $wpdb->prepare( $query_sent, $template_id, $value->id, $value->user_email ) );
|
239 |
+
|
240 |
+
$query_id = "SELECT * FROM `".$wpdb->prefix."ac_sent_history_lite`
|
241 |
+
WHERE template_id = %s AND abandoned_order_id = %s
|
242 |
+
ORDER BY id DESC
|
243 |
+
LIMIT 1 ";
|
244 |
+
$results_sent = $wpdb->get_results( $wpdb->prepare( $query_id, $template_id, $value->id ) );
|
245 |
+
if ( count( $results_sent ) > 0 ) {
|
246 |
+
$email_sent_id = $results_sent[0]->id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
} else {
|
248 |
+
$email_sent_id = '';
|
|
|
249 |
}
|
250 |
|
251 |
+
if ( '' != $email_sent_id ) {
|
|
|
|
|
|
|
252 |
|
253 |
+
if( $woocommerce->version < '2.3' ) {
|
254 |
+
$cart_page_link = $woocommerce->cart->get_cart_url();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
} else {
|
256 |
+
$cart_page_id = wc_get_page_id( 'cart' );
|
257 |
+
$cart_page_link = $cart_page_id ? get_permalink( $cart_page_id ) : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
|
260 |
+
$encoding_cart = $email_sent_id.'&url='.$cart_page_link;
|
261 |
+
$validate_cart = $this->wcal_encrypt_validate( $encoding_cart );
|
262 |
+
$cart_link_track = get_option('siteurl').'/?wcal_action=track_links&validate=' . $validate_cart;
|
263 |
+
$email_body = str_replace( "{{cart.link}}", $cart_link_track, $email_body );
|
264 |
|
265 |
+
$validate_unsubscribe = $this->wcal_encrypt_validate( $email_sent_id );
|
266 |
+
if ( count( $results_sent ) > 0 && isset( $results_sent[0]->sent_email_id ) ) {
|
267 |
+
$email_sent_id_address = $results_sent[0]->sent_email_id;
|
268 |
+
}
|
269 |
+
$encrypt_email_sent_id_address = hash( 'sha256', $email_sent_id_address );
|
270 |
+
$plugins_url = get_option( 'siteurl' ) . "/?wcal_track_unsubscribe=wcal_unsubscribe&validate=" . $validate_unsubscribe . "&track_email_id=" . $encrypt_email_sent_id_address;
|
271 |
+
$unsubscribe_link_track = $plugins_url;
|
272 |
+
$email_body = str_replace( "{{cart.unsubscribe}}" , $unsubscribe_link_track , $email_body );
|
273 |
+
$var = '';
|
274 |
+
if( preg_match( "{{products.cart}}", $email_body, $matched ) ) {
|
275 |
+
if ( class_exists( 'WP_Better_Emails' ) ) {
|
276 |
+
$var = '<table width = 100%>
|
277 |
+
<tr> <td colspan="5"> <h3>'.__( "Your Shopping Cart", "woocommerce-abandoned-cart" ).'</h3> </td></tr>
|
278 |
+
<tr>
|
279 |
+
<th>'.__( "Item", "woocommerce-abandoned-cart" ).'</th>
|
280 |
+
<th>'.__( "Name", "woocommerce-abandoned-cart" ).'</th>
|
281 |
+
<th>'.__( "Quantity", "woocommerce-abandoned-cart" ).'</th>
|
282 |
+
<th>'.__( "Price", "woocommerce-abandoned-cart" ).'</th>
|
283 |
+
<th>'.__( "Line Subtotal", "woocommerce-abandoned-cart" ).'</th>
|
284 |
+
</tr>';
|
285 |
+
} else {
|
286 |
+
$var = '<h3>'.__( "Your Shopping Cart", "woocommerce-abandoned-cart" ).'</h3>
|
287 |
+
<table border="0" cellpadding="10" cellspacing="0" class="templateDataTable">
|
288 |
+
<tr>
|
289 |
+
<th>'.__( "Item", 'woocommerce-abandoned-cart' ).'</th>
|
290 |
+
<th>'.__( "Name", 'woocommerce-abandoned-cart' ).'</th>
|
291 |
+
<th>'.__( "Quantity", 'woocommerce-abandoned-cart' ).'</th>
|
292 |
+
<th>'.__( "Price", 'woocommerce-abandoned-cart' ).'</th>
|
293 |
+
<th>'.__( "Line Subtotal", 'woocommerce-abandoned-cart' ).'</th>
|
294 |
+
</tr>';
|
295 |
+
}
|
296 |
+
$cart_details = $cart_info_db_field->cart;
|
297 |
+
$cart_total = $item_subtotal = $item_total = 0;
|
298 |
+
$sub_line_prod_name = '';
|
299 |
+
foreach ( $cart_details as $k => $v ) {
|
300 |
+
$quantity_total = $v->quantity;
|
301 |
+
$product_id = $v->product_id;
|
302 |
+
$product = wc_get_product( $product_id );
|
303 |
+
if ( $product ) {
|
304 |
+
$prod_name = get_post( $product_id );
|
305 |
+
$product_link_track = get_permalink( $product_id );
|
306 |
+
$product_name = $prod_name->post_title;
|
307 |
+
if( $sub_line_prod_name == '' ) {
|
308 |
+
$sub_line_prod_name = $product_name;
|
309 |
+
}
|
310 |
+
// Item subtotal is calculated as product total including taxes
|
311 |
+
if( $v->line_tax != 0 && $v->line_tax > 0 ) {
|
312 |
+
$item_subtotal = $item_subtotal + $v->line_total + $v->line_tax;
|
313 |
+
} else {
|
314 |
+
$item_subtotal = $item_subtotal + $v->line_total;
|
315 |
}
|
316 |
+
// Line total
|
317 |
+
$item_total = $item_subtotal;
|
318 |
+
$item_subtotal = $item_subtotal / $quantity_total;
|
319 |
+
$item_total_display = wc_price( $item_total );
|
320 |
+
$item_subtotal = wc_price( $item_subtotal );
|
321 |
+
//$product = wc_get_product( $product_id );
|
322 |
+
$prod_image = $product->get_image();
|
323 |
+
$image_url = wp_get_attachment_url( get_post_thumbnail_id( $product_id ) );
|
324 |
+
if ( strpos( $image_url, '/' ) === 0 ) {
|
325 |
+
$image_url = get_option('siteurl') . $image_url;
|
326 |
+
}
|
327 |
+
if ( isset( $v->variation_id ) && '' != $v->variation_id ) {
|
328 |
+
$variation_id = $v->variation_id;
|
329 |
+
$variation = wc_get_product( $variation_id );
|
330 |
+
$name = $variation->get_formatted_name() ;
|
331 |
+
$explode_all = explode ( "–", $name );
|
332 |
+
if( version_compare( $woocommerce->version, '3.0.0', ">=" ) ) {
|
333 |
+
$wcap_sku = '';
|
334 |
+
if ( $variation->get_sku() ) {
|
335 |
+
$wcap_sku = "SKU: " . $variation->get_sku() . "<br>";
|
336 |
+
}
|
337 |
+
$wcap_get_formatted_variation = wc_get_formatted_variation( $variation, true );
|
338 |
+
|
339 |
+
$add_product_name = $product_name . ' - ' . $wcap_sku . $wcap_get_formatted_variation;
|
340 |
+
|
341 |
+
$pro_name_variation = (array) $add_product_name;
|
342 |
+
}else{
|
343 |
+
$pro_name_variation = array_slice( $explode_all, 1, -1 );
|
344 |
+
}
|
345 |
+
$product_name_with_variable = '';
|
346 |
+
$explode_many_varaition = array();
|
347 |
+
foreach( $pro_name_variation as $pro_name_variation_key => $pro_name_variation_value ) {
|
348 |
+
$explode_many_varaition = explode ( ",", $pro_name_variation_value );
|
349 |
+
if( !empty( $explode_many_varaition ) ) {
|
350 |
+
foreach( $explode_many_varaition as $explode_many_varaition_key => $explode_many_varaition_value ) {
|
351 |
+
$product_name_with_variable = $product_name_with_variable . html_entity_decode ( $explode_many_varaition_value ) . "<br>";
|
352 |
+
}
|
353 |
+
} else {
|
354 |
$product_name_with_variable = $product_name_with_variable . html_entity_decode ( $explode_many_varaition_value ) . "<br>";
|
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.'</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 |
+
$p_exists = true;
|
369 |
+
}else {
|
370 |
+
$cart_total = 0;
|
371 |
+
$item_subtotal = $item_total = 0;
|
372 |
+
|
373 |
+
$p_exists = false;
|
374 |
}
|
375 |
+
}
|
376 |
+
|
377 |
+
if ( $p_exists ) {
|
378 |
+
$cart_total = wc_price( $cart_total );
|
379 |
+
$var .= '<tr align="center">
|
380 |
+
<td> </td>
|
381 |
+
<td> </td>
|
382 |
+
<td> </td>
|
383 |
+
<td>'.__( "Cart Total:", 'woocommerce-abandoned-cart' ).'</td>
|
384 |
+
<td> '.$cart_total.'</td>
|
385 |
</tr>';
|
386 |
+
$var .= '</table>
|
387 |
+
';
|
388 |
+
$email_body = str_replace( "{{products.cart}}", $var, $email_body );
|
389 |
+
$email_subject = str_replace( "{{product.name}}", $sub_line_prod_name, $email_subject );
|
390 |
}else {
|
391 |
+
$email_body = str_replace( "{{products.cart}}", __( 'Product no longer exists', 'woocommerce-abandoned-cart' ), $email_body );
|
392 |
+
$email_subject = str_replace( "{{product.name}}", $sub_line_prod_name, $email_subject );
|
|
|
|
|
393 |
}
|
394 |
}
|
395 |
|
396 |
+
$user_email = $value->user_email;
|
397 |
+
$email_body_final = stripslashes( $email_body );
|
398 |
+
$email_body_final = convert_smilies( $email_body_final );
|
399 |
+
if ( isset( $is_wc_template ) && "1" == $is_wc_template ){
|
400 |
+
ob_start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
|
402 |
+
wc_get_template( 'emails/email-header.php', array( 'email_heading' => $wc_template_header ) );
|
403 |
+
$email_body_template_header = ob_get_clean();
|
|
|
|
|
|
|
404 |
|
405 |
+
ob_start();
|
|
|
406 |
|
407 |
+
wc_get_template( 'emails/email-footer.php' );
|
408 |
+
$email_body_template_footer = ob_get_clean();
|
409 |
|
410 |
+
$site_title = get_bloginfo( 'name' );
|
411 |
+
$email_body_template_footer = str_replace( '{site_title}', $site_title, $email_body_template_footer );
|
412 |
|
413 |
+
$final_email_body = $email_body_template_header . $email_body_final . $email_body_template_footer;
|
|
|
414 |
|
415 |
+
wc_mail( $user_email, $email_subject, $final_email_body, $headers );
|
416 |
|
417 |
+
} else {
|
418 |
+
wp_mail( $user_email, $email_subject, $email_body_final, $headers );
|
419 |
+
}
|
|
|
420 |
}
|
421 |
}
|
422 |
}
|
486 |
}
|
487 |
$cart_ignored = 0;
|
488 |
$unsubscribe = 0;
|
489 |
+
$query = "SELECT wpac . * , wpu.user_login, wpu.user_email
|
490 |
FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` AS wpac
|
491 |
LEFT JOIN ".$wpdb->base_prefix."users AS wpu ON wpac.user_id = wpu.id
|
492 |
WHERE cart_ignored = %s AND unsubscribe_link = %s AND abandoned_cart_time < $cart_time
|
includes/admin/wcal_privacy_export.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Export Abandoned Carts data in
|
4 |
* Dashboard->Tools->Export Personal Data
|
5 |
-
*
|
6 |
* @since 4.9
|
7 |
*/
|
8 |
// Exit if accessed directly
|
@@ -15,107 +15,107 @@ if ( ! class_exists('Wcal_Personal_Data_Export' ) ) {
|
|
15 |
* Dashboard->Tools->Export Personal Data
|
16 |
*/
|
17 |
class Wcal_Personal_Data_Export {
|
18 |
-
|
19 |
/**
|
20 |
* Construct
|
21 |
* @since 7.8
|
22 |
-
*/
|
23 |
public function __construct() {
|
24 |
// Hook into the WP export process
|
25 |
add_filter( 'wp_privacy_personal_data_exporters', array( &$this, 'wcal_exporter_array' ), 6 );
|
26 |
}
|
27 |
-
|
28 |
/**
|
29 |
* Add our export and it's callback function
|
30 |
-
*
|
31 |
* @param array $exporters - Any exportes that need to be added by 3rd party plugins
|
32 |
* @param array $exporters - Exportes list containing our plugin details
|
33 |
-
*
|
34 |
* @since 4.9
|
35 |
-
*/
|
36 |
public static function wcal_exporter_array( $exporters = array() ) {
|
37 |
-
|
38 |
$exporter_list = array();
|
39 |
// Add our export and it's callback function
|
40 |
-
$exporter_list[ 'wcal_carts' ] = array(
|
41 |
'exporter_friendly_name' => __( 'Abandoned & Recovered Carts', 'woocommerce-abandoned-cart' ),
|
42 |
'callback' => array( 'Wcal_Personal_Data_Export', 'wcal_data_exporter' )
|
43 |
);
|
44 |
-
|
45 |
$exporters = array_merge( $exporters, $exporter_list );
|
46 |
|
47 |
return $exporters;
|
48 |
-
|
49 |
}
|
50 |
-
|
51 |
/**
|
52 |
-
* Returns data to be displayed for exporting the
|
53 |
* cart details
|
54 |
-
*
|
55 |
* @param string $email_address - EMail Address for which personal data is being exported
|
56 |
* @param integer $page - The Export page number
|
57 |
* @return array $data_to_export - Data to be exported
|
58 |
-
*
|
59 |
* @hook wp_privacy_personal_data_exporters
|
60 |
* @global $wpdb
|
61 |
* @since 4.9
|
62 |
*/
|
63 |
static function wcal_data_exporter( $email_address, $page ) {
|
64 |
-
|
65 |
global $wpdb;
|
66 |
-
|
67 |
$done = false;
|
68 |
$page = (int) $page;
|
69 |
$user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
|
70 |
$data_to_export = array();
|
71 |
$blank_cart_info = '{"cart":[]}';
|
72 |
$blank_cart_info_guest = '[]';
|
73 |
-
$blank_cart = '""';
|
74 |
-
|
75 |
$user_id = $user ? (int) $user->ID : 0;
|
76 |
-
|
77 |
if ( $user_id > 0 ) { // registered user
|
78 |
-
|
79 |
$cart_query = "SELECT id FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
|
80 |
WHERE user_id = %d AND
|
81 |
user_type = 'REGISTERED' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart'";
|
82 |
-
|
83 |
$cart_ids = $wpdb->get_results( $wpdb->prepare( $cart_query, $user_id ) );
|
84 |
} else { // guest carts
|
85 |
$guest_query = "SELECT id FROM `" . $wpdb->prefix . 'ac_guest_abandoned_cart_history_lite' . "`
|
86 |
WHERE email_id = %s";
|
87 |
-
|
88 |
$guest_user_ids = $wpdb->get_results( $wpdb->prepare( $guest_query, $email_address ) );
|
89 |
-
|
90 |
-
if ( 0 == count( $guest_user_ids ) )
|
91 |
return array(
|
92 |
'data' => array(),
|
93 |
'done' => true,
|
94 |
);
|
95 |
-
|
96 |
$cart_ids = array();
|
97 |
-
|
98 |
foreach ( $guest_user_ids as $ids ) {
|
99 |
// get the cart data
|
100 |
$cart_query = "SELECT id, abandoned_cart_info AS cart_info FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
|
101 |
WHERE user_id = %d AND
|
102 |
user_type = 'GUEST'";
|
103 |
-
|
104 |
$cart_data = $wpdb->get_results( $wpdb->prepare( $cart_query, $ids->id ) );
|
105 |
-
|
106 |
$cart_ids = array_merge( $cart_ids, $cart_data );
|
107 |
}
|
108 |
}
|
109 |
-
|
110 |
if ( 0 < count( $cart_ids ) ) {
|
111 |
-
|
112 |
$cart_chunks = array_chunk( $cart_ids, 10, true );
|
113 |
-
|
114 |
$cart_export = isset( $cart_chunks[ $page - 1 ] ) ? $cart_chunks[ $page - 1 ] : array();
|
115 |
if ( count( $cart_export ) > 0 ) {
|
116 |
-
|
117 |
foreach ( $cart_export as $abandoned_ids ) {
|
118 |
-
|
119 |
$cart_id = $abandoned_ids->id;
|
120 |
if ( count( $abandoned_ids->id ) > 0 ) {
|
121 |
$data_to_export[] = array(
|
@@ -133,17 +133,17 @@ if ( ! class_exists('Wcal_Personal_Data_Export' ) ) {
|
|
133 |
} else {
|
134 |
$done = true;
|
135 |
}
|
136 |
-
|
137 |
return array(
|
138 |
'data' => $data_to_export,
|
139 |
'done' => $done,
|
140 |
);
|
141 |
-
|
142 |
}
|
143 |
-
|
144 |
/**
|
145 |
* Returns the personal data for each abandoned cart
|
146 |
-
*
|
147 |
* @param integer $abandoned_id - Abandoned Cart ID
|
148 |
* @return array $personal_data - Personal data to be displayed
|
149 |
* @global $wpdb
|
@@ -151,9 +151,9 @@ if ( ! class_exists('Wcal_Personal_Data_Export' ) ) {
|
|
151 |
*/
|
152 |
static function get_cart_data( $abandoned_id ) {
|
153 |
$personal_data = array();
|
154 |
-
|
155 |
global $wpdb;
|
156 |
-
|
157 |
$cart_query = "SELECT * FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
|
158 |
WHERE id = %d";
|
159 |
$cart_details = $wpdb->get_results( $wpdb->prepare( $cart_query, $abandoned_id ) );
|
@@ -173,7 +173,7 @@ if ( ! class_exists('Wcal_Personal_Data_Export' ) ) {
|
|
173 |
'formatted_billing_address' => __( 'Billing Address', 'woocommerce-abandoned-cart' ),
|
174 |
'billing_email' => __( 'Email Address', 'woocommerce-abandoned-cart' ),
|
175 |
), $abandoned_id );
|
176 |
-
|
177 |
} else {
|
178 |
$cart_details_to_export = apply_filters( 'wcal_personal_export_cart_details_prop', array(
|
179 |
'cart_id' => __( 'Abandoned Cart ID', 'woocommerce-abandoned-cart' ),
|
@@ -184,21 +184,21 @@ if ( ! class_exists('Wcal_Personal_Data_Export' ) ) {
|
|
184 |
'formatted_billing_address' => __( 'Billing Address', 'woocommerce-abandoned-cart' ),
|
185 |
'billing_email' => __( 'Email Address', 'woocommerce-abandoned-cart' ),
|
186 |
), $abandoned_id );
|
187 |
-
|
188 |
-
}
|
189 |
-
|
190 |
$cart_data = json_decode( stripslashes( $cart_details->abandoned_cart_info ) );
|
191 |
$cart_info = $cart_data->cart;
|
192 |
-
|
193 |
if ( count( $cart_info ) > 0 ) {
|
194 |
$cart_details_formatted = self::wcal_get_cart_details_export( $cart_info );
|
195 |
}
|
196 |
-
|
197 |
if ( 'GUEST' == $user_type ) {
|
198 |
$guest_details = self::wcal_get_guest_personal_info( $user_id );
|
199 |
}
|
200 |
foreach ( $cart_details_to_export as $prop => $name ) {
|
201 |
-
|
202 |
switch ( $prop ) {
|
203 |
case 'cart_id':
|
204 |
$value = $cart_details->id;
|
@@ -207,9 +207,9 @@ if ( ! class_exists('Wcal_Personal_Data_Export' ) ) {
|
|
207 |
$value = date( 'Y-m-d H:i:s', $cart_details->abandoned_cart_time );
|
208 |
break;
|
209 |
case 'cart_status':
|
210 |
-
|
211 |
$cart_ignored = $cart_details->cart_ignored;
|
212 |
-
|
213 |
switch( $cart_ignored ) {
|
214 |
case '0':
|
215 |
$value = $cart_details->recovered_cart > 0 ? __( "Cart Recovered - Order #", 'woocommerce-abandoned-cart' ) . $cart_details->recovered_cart : __( 'Abandoned', 'woocommerce-abandoned-cart' );
|
@@ -218,16 +218,16 @@ if ( ! class_exists('Wcal_Personal_Data_Export' ) ) {
|
|
218 |
$value = $cart_details->recovered_cart > 0 ? __( "Cart Recovered - Order #", 'woocommerce-abandoned-cart' ) . $cart_details->recovered_cart : __( 'Abandoned but new cart created', 'woocommerce-abandoned-cart' );
|
219 |
break;
|
220 |
case '2':
|
221 |
-
$value = __( 'Abandoned -
|
222 |
break;
|
223 |
}
|
224 |
break;
|
225 |
case 'total':
|
226 |
$total = 0;
|
227 |
-
|
228 |
if ( count( $cart_info ) > 0 ) {
|
229 |
foreach ( $cart_info as $k => $v ) {
|
230 |
-
|
231 |
$total += $cart_details_formatted[$k][ 'item_total' ];
|
232 |
}
|
233 |
}
|
@@ -235,31 +235,31 @@ if ( ! class_exists('Wcal_Personal_Data_Export' ) ) {
|
|
235 |
break;
|
236 |
case 'items':
|
237 |
$value = '';
|
238 |
-
|
239 |
if ( count( $cart_info ) > 0 ) {
|
240 |
foreach ( $cart_info as $k => $v ) {
|
241 |
-
|
242 |
$product_name = $cart_details_formatted[$k][ 'product_name' ];
|
243 |
$qty = $cart_details_formatted[$k][ 'qty' ];
|
244 |
-
|
245 |
$value .= ( $value == '' ) ? "$product_name x $qty" : ", $product_name x $qty";
|
246 |
}
|
247 |
}
|
248 |
break;
|
249 |
case 'formatted_billing_address':
|
250 |
-
|
251 |
if ( $user_type == 'REGISTERED' ) { // registered user
|
252 |
-
|
253 |
$billing = wcal_common::wcal_get_billing_details( $user_id );
|
254 |
$value = get_user_meta( $user_id, 'billing_first_name', true ); // First Name
|
255 |
-
$value .= ' ' . get_user_meta( $user_id, 'billing_last_name', true ); // Last Name
|
256 |
if ( count( $billing ) > 0 ) {
|
257 |
foreach ( $billing as $details ) {
|
258 |
if ( '' != $details ) {
|
259 |
$value .= ",$details ";
|
260 |
-
}
|
261 |
}
|
262 |
-
|
263 |
}
|
264 |
} elseif ( 'GUEST' == $user_type ) {
|
265 |
if ( count( $guest_details ) > 0 ) {
|
@@ -268,13 +268,13 @@ if ( ! class_exists('Wcal_Personal_Data_Export' ) ) {
|
|
268 |
}
|
269 |
}
|
270 |
break;
|
271 |
-
|
272 |
case 'billing_email':
|
273 |
if ( 'REGISTERED' == $user_type ) { // registered user
|
274 |
$value = get_user_meta( $user_id, $prop, true );
|
275 |
} else if ( 'GUEST' == $user_type ) {
|
276 |
if ( count( $guest_details ) > 0 ) {
|
277 |
-
$value = $guest_details->$prop;
|
278 |
}
|
279 |
}
|
280 |
break;
|
@@ -282,24 +282,24 @@ if ( ! class_exists('Wcal_Personal_Data_Export' ) ) {
|
|
282 |
$value = ( isset( $cart_details->$prop ) ) ? $cart_details->$prop : '';
|
283 |
break;
|
284 |
}
|
285 |
-
|
286 |
$value = apply_filters( 'wcal_personal_export_cart_details_prop_value', $value, $prop, $cart_details );
|
287 |
-
|
288 |
-
$personal_data[] = array(
|
289 |
'name' => $name,
|
290 |
'value' => $value,
|
291 |
);
|
292 |
-
|
293 |
}
|
294 |
$personal_data = apply_filters( 'wcal_personal_data_cart_details_export', $personal_data, $cart_details );
|
295 |
-
|
296 |
return $personal_data;
|
297 |
}
|
298 |
-
|
299 |
/**
|
300 |
* Returns the personal data from the plugin guest cart table
|
301 |
* for guest abandoned carts
|
302 |
-
*
|
303 |
* @param integer $user_id - User ID
|
304 |
* @return array $guest_details - Guest personal details
|
305 |
* @global $wpdb
|
@@ -308,70 +308,70 @@ if ( ! class_exists('Wcal_Personal_Data_Export' ) ) {
|
|
308 |
static function wcal_get_guest_personal_info( $user_id ) {
|
309 |
global $wpdb;
|
310 |
$guest_details = array();
|
311 |
-
|
312 |
$guest_query = "SELECT billing_first_name, billing_last_name, email_id AS billing_email, phone AS billing_phone FROM `" . $wpdb->prefix . 'ac_guest_abandoned_cart_history_lite' . "`
|
313 |
WHERE id = %d";
|
314 |
-
|
315 |
$guest_details = $wpdb->get_results( $wpdb->prepare( $guest_query, $user_id ) );
|
316 |
-
|
317 |
if ( is_array( $guest_details ) && count( $guest_details ) > 0 ) {
|
318 |
$guest_details = $guest_details[0];
|
319 |
}
|
320 |
-
|
321 |
return $guest_details;
|
322 |
}
|
323 |
-
|
324 |
/**
|
325 |
* Returns the Cart Details such as quantity, product name
|
326 |
* etc.
|
327 |
-
*
|
328 |
* @param object $cart_info - Abandoned Cart Information
|
329 |
* @return array $cart_details - Array containing product, qty & total for each item
|
330 |
* @since 4.9
|
331 |
*/
|
332 |
static function wcal_get_cart_details_export( $cart_info ) {
|
333 |
-
|
334 |
$cart_details = array();
|
335 |
-
|
336 |
if ( count( $cart_info ) > 0 ) {
|
337 |
-
|
338 |
$cart_total = 0;
|
339 |
foreach ( $cart_info as $k => $item_detail ) {
|
340 |
-
|
341 |
// Qty
|
342 |
$qty = $item_detail->quantity;
|
343 |
-
|
344 |
//Product Name
|
345 |
$product_id = $item_detail->product_id;
|
346 |
$prod_obj = wc_get_product( $product_id );
|
347 |
$product_name = $prod_obj->get_name();
|
348 |
-
|
349 |
// Variation Name
|
350 |
if ( isset( $item_detail->variation_id ) && $item_detail->variation_id > 0 ) {
|
351 |
$variation_id = $item_detail->variation_id;
|
352 |
$variation = wc_get_product( $variation_id );
|
353 |
$variation_name = $variation->get_name();
|
354 |
-
|
355 |
$product_name = $variation_name;
|
356 |
}
|
357 |
-
|
358 |
// Total
|
359 |
$item_total = $item_detail->line_total;
|
360 |
if ( $item_detail->line_subtotal_tax > 0 ) {
|
361 |
$item_total += $item_detail->line_subtotal_tax;
|
362 |
-
}
|
363 |
-
|
364 |
// Populate the array
|
365 |
$cart_details[ $k ][ 'qty' ] = $qty;
|
366 |
$cart_details[ $k ][ 'product_name' ] = $product_name;
|
367 |
$cart_details[ $k ][ 'item_total' ] = $item_total;
|
368 |
-
|
369 |
$cart_total += $item_total;
|
370 |
}
|
371 |
-
|
372 |
$cart_details[ 'total' ] = $cart_total;
|
373 |
}
|
374 |
-
|
375 |
return $cart_details;
|
376 |
}
|
377 |
} // end of class
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Export Abandoned Carts data in
|
4 |
* Dashboard->Tools->Export Personal Data
|
5 |
+
*
|
6 |
* @since 4.9
|
7 |
*/
|
8 |
// Exit if accessed directly
|
15 |
* Dashboard->Tools->Export Personal Data
|
16 |
*/
|
17 |
class Wcal_Personal_Data_Export {
|
18 |
+
|
19 |
/**
|
20 |
* Construct
|
21 |
* @since 7.8
|
22 |
+
*/
|
23 |
public function __construct() {
|
24 |
// Hook into the WP export process
|
25 |
add_filter( 'wp_privacy_personal_data_exporters', array( &$this, 'wcal_exporter_array' ), 6 );
|
26 |
}
|
27 |
+
|
28 |
/**
|
29 |
* Add our export and it's callback function
|
30 |
+
*
|
31 |
* @param array $exporters - Any exportes that need to be added by 3rd party plugins
|
32 |
* @param array $exporters - Exportes list containing our plugin details
|
33 |
+
*
|
34 |
* @since 4.9
|
35 |
+
*/
|
36 |
public static function wcal_exporter_array( $exporters = array() ) {
|
37 |
+
|
38 |
$exporter_list = array();
|
39 |
// Add our export and it's callback function
|
40 |
+
$exporter_list[ 'wcal_carts' ] = array(
|
41 |
'exporter_friendly_name' => __( 'Abandoned & Recovered Carts', 'woocommerce-abandoned-cart' ),
|
42 |
'callback' => array( 'Wcal_Personal_Data_Export', 'wcal_data_exporter' )
|
43 |
);
|
44 |
+
|
45 |
$exporters = array_merge( $exporters, $exporter_list );
|
46 |
|
47 |
return $exporters;
|
48 |
+
|
49 |
}
|
50 |
+
|
51 |
/**
|
52 |
+
* Returns data to be displayed for exporting the
|
53 |
* cart details
|
54 |
+
*
|
55 |
* @param string $email_address - EMail Address for which personal data is being exported
|
56 |
* @param integer $page - The Export page number
|
57 |
* @return array $data_to_export - Data to be exported
|
58 |
+
*
|
59 |
* @hook wp_privacy_personal_data_exporters
|
60 |
* @global $wpdb
|
61 |
* @since 4.9
|
62 |
*/
|
63 |
static function wcal_data_exporter( $email_address, $page ) {
|
64 |
+
|
65 |
global $wpdb;
|
66 |
+
|
67 |
$done = false;
|
68 |
$page = (int) $page;
|
69 |
$user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
|
70 |
$data_to_export = array();
|
71 |
$blank_cart_info = '{"cart":[]}';
|
72 |
$blank_cart_info_guest = '[]';
|
73 |
+
$blank_cart = '""';
|
74 |
+
|
75 |
$user_id = $user ? (int) $user->ID : 0;
|
76 |
+
|
77 |
if ( $user_id > 0 ) { // registered user
|
78 |
+
|
79 |
$cart_query = "SELECT id FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
|
80 |
WHERE user_id = %d AND
|
81 |
user_type = 'REGISTERED' AND abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart'";
|
82 |
+
|
83 |
$cart_ids = $wpdb->get_results( $wpdb->prepare( $cart_query, $user_id ) );
|
84 |
} else { // guest carts
|
85 |
$guest_query = "SELECT id FROM `" . $wpdb->prefix . 'ac_guest_abandoned_cart_history_lite' . "`
|
86 |
WHERE email_id = %s";
|
87 |
+
|
88 |
$guest_user_ids = $wpdb->get_results( $wpdb->prepare( $guest_query, $email_address ) );
|
89 |
+
|
90 |
+
if ( 0 == count( $guest_user_ids ) )
|
91 |
return array(
|
92 |
'data' => array(),
|
93 |
'done' => true,
|
94 |
);
|
95 |
+
|
96 |
$cart_ids = array();
|
97 |
+
|
98 |
foreach ( $guest_user_ids as $ids ) {
|
99 |
// get the cart data
|
100 |
$cart_query = "SELECT id, abandoned_cart_info AS cart_info FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
|
101 |
WHERE user_id = %d AND
|
102 |
user_type = 'GUEST'";
|
103 |
+
|
104 |
$cart_data = $wpdb->get_results( $wpdb->prepare( $cart_query, $ids->id ) );
|
105 |
+
|
106 |
$cart_ids = array_merge( $cart_ids, $cart_data );
|
107 |
}
|
108 |
}
|
109 |
+
|
110 |
if ( 0 < count( $cart_ids ) ) {
|
111 |
+
|
112 |
$cart_chunks = array_chunk( $cart_ids, 10, true );
|
113 |
+
|
114 |
$cart_export = isset( $cart_chunks[ $page - 1 ] ) ? $cart_chunks[ $page - 1 ] : array();
|
115 |
if ( count( $cart_export ) > 0 ) {
|
116 |
+
|
117 |
foreach ( $cart_export as $abandoned_ids ) {
|
118 |
+
|
119 |
$cart_id = $abandoned_ids->id;
|
120 |
if ( count( $abandoned_ids->id ) > 0 ) {
|
121 |
$data_to_export[] = array(
|
133 |
} else {
|
134 |
$done = true;
|
135 |
}
|
136 |
+
|
137 |
return array(
|
138 |
'data' => $data_to_export,
|
139 |
'done' => $done,
|
140 |
);
|
141 |
+
|
142 |
}
|
143 |
+
|
144 |
/**
|
145 |
* Returns the personal data for each abandoned cart
|
146 |
+
*
|
147 |
* @param integer $abandoned_id - Abandoned Cart ID
|
148 |
* @return array $personal_data - Personal data to be displayed
|
149 |
* @global $wpdb
|
151 |
*/
|
152 |
static function get_cart_data( $abandoned_id ) {
|
153 |
$personal_data = array();
|
154 |
+
|
155 |
global $wpdb;
|
156 |
+
|
157 |
$cart_query = "SELECT * FROM `" . $wpdb->prefix . 'ac_abandoned_cart_history_lite' . "`
|
158 |
WHERE id = %d";
|
159 |
$cart_details = $wpdb->get_results( $wpdb->prepare( $cart_query, $abandoned_id ) );
|
173 |
'formatted_billing_address' => __( 'Billing Address', 'woocommerce-abandoned-cart' ),
|
174 |
'billing_email' => __( 'Email Address', 'woocommerce-abandoned-cart' ),
|
175 |
), $abandoned_id );
|
176 |
+
|
177 |
} else {
|
178 |
$cart_details_to_export = apply_filters( 'wcal_personal_export_cart_details_prop', array(
|
179 |
'cart_id' => __( 'Abandoned Cart ID', 'woocommerce-abandoned-cart' ),
|
184 |
'formatted_billing_address' => __( 'Billing Address', 'woocommerce-abandoned-cart' ),
|
185 |
'billing_email' => __( 'Email Address', 'woocommerce-abandoned-cart' ),
|
186 |
), $abandoned_id );
|
187 |
+
|
188 |
+
}
|
189 |
+
|
190 |
$cart_data = json_decode( stripslashes( $cart_details->abandoned_cart_info ) );
|
191 |
$cart_info = $cart_data->cart;
|
192 |
+
|
193 |
if ( count( $cart_info ) > 0 ) {
|
194 |
$cart_details_formatted = self::wcal_get_cart_details_export( $cart_info );
|
195 |
}
|
196 |
+
|
197 |
if ( 'GUEST' == $user_type ) {
|
198 |
$guest_details = self::wcal_get_guest_personal_info( $user_id );
|
199 |
}
|
200 |
foreach ( $cart_details_to_export as $prop => $name ) {
|
201 |
+
|
202 |
switch ( $prop ) {
|
203 |
case 'cart_id':
|
204 |
$value = $cart_details->id;
|
207 |
$value = date( 'Y-m-d H:i:s', $cart_details->abandoned_cart_time );
|
208 |
break;
|
209 |
case 'cart_status':
|
210 |
+
|
211 |
$cart_ignored = $cart_details->cart_ignored;
|
212 |
+
|
213 |
switch( $cart_ignored ) {
|
214 |
case '0':
|
215 |
$value = $cart_details->recovered_cart > 0 ? __( "Cart Recovered - Order #", 'woocommerce-abandoned-cart' ) . $cart_details->recovered_cart : __( 'Abandoned', 'woocommerce-abandoned-cart' );
|
218 |
$value = $cart_details->recovered_cart > 0 ? __( "Cart Recovered - Order #", 'woocommerce-abandoned-cart' ) . $cart_details->recovered_cart : __( 'Abandoned but new cart created', 'woocommerce-abandoned-cart' );
|
219 |
break;
|
220 |
case '2':
|
221 |
+
$value = __( 'Abandoned - Unpaid Order #', 'woocommerce-abandoned-cart') . $cart_details->recovered_cart;
|
222 |
break;
|
223 |
}
|
224 |
break;
|
225 |
case 'total':
|
226 |
$total = 0;
|
227 |
+
|
228 |
if ( count( $cart_info ) > 0 ) {
|
229 |
foreach ( $cart_info as $k => $v ) {
|
230 |
+
|
231 |
$total += $cart_details_formatted[$k][ 'item_total' ];
|
232 |
}
|
233 |
}
|
235 |
break;
|
236 |
case 'items':
|
237 |
$value = '';
|
238 |
+
|
239 |
if ( count( $cart_info ) > 0 ) {
|
240 |
foreach ( $cart_info as $k => $v ) {
|
241 |
+
|
242 |
$product_name = $cart_details_formatted[$k][ 'product_name' ];
|
243 |
$qty = $cart_details_formatted[$k][ 'qty' ];
|
244 |
+
|
245 |
$value .= ( $value == '' ) ? "$product_name x $qty" : ", $product_name x $qty";
|
246 |
}
|
247 |
}
|
248 |
break;
|
249 |
case 'formatted_billing_address':
|
250 |
+
|
251 |
if ( $user_type == 'REGISTERED' ) { // registered user
|
252 |
+
|
253 |
$billing = wcal_common::wcal_get_billing_details( $user_id );
|
254 |
$value = get_user_meta( $user_id, 'billing_first_name', true ); // First Name
|
255 |
+
$value .= ' ' . get_user_meta( $user_id, 'billing_last_name', true ); // Last Name
|
256 |
if ( count( $billing ) > 0 ) {
|
257 |
foreach ( $billing as $details ) {
|
258 |
if ( '' != $details ) {
|
259 |
$value .= ",$details ";
|
260 |
+
}
|
261 |
}
|
262 |
+
|
263 |
}
|
264 |
} elseif ( 'GUEST' == $user_type ) {
|
265 |
if ( count( $guest_details ) > 0 ) {
|
268 |
}
|
269 |
}
|
270 |
break;
|
271 |
+
|
272 |
case 'billing_email':
|
273 |
if ( 'REGISTERED' == $user_type ) { // registered user
|
274 |
$value = get_user_meta( $user_id, $prop, true );
|
275 |
} else if ( 'GUEST' == $user_type ) {
|
276 |
if ( count( $guest_details ) > 0 ) {
|
277 |
+
$value = $guest_details->$prop;
|
278 |
}
|
279 |
}
|
280 |
break;
|
282 |
$value = ( isset( $cart_details->$prop ) ) ? $cart_details->$prop : '';
|
283 |
break;
|
284 |
}
|
285 |
+
|
286 |
$value = apply_filters( 'wcal_personal_export_cart_details_prop_value', $value, $prop, $cart_details );
|
287 |
+
|
288 |
+
$personal_data[] = array(
|
289 |
'name' => $name,
|
290 |
'value' => $value,
|
291 |
);
|
292 |
+
|
293 |
}
|
294 |
$personal_data = apply_filters( 'wcal_personal_data_cart_details_export', $personal_data, $cart_details );
|
295 |
+
|
296 |
return $personal_data;
|
297 |
}
|
298 |
+
|
299 |
/**
|
300 |
* Returns the personal data from the plugin guest cart table
|
301 |
* for guest abandoned carts
|
302 |
+
*
|
303 |
* @param integer $user_id - User ID
|
304 |
* @return array $guest_details - Guest personal details
|
305 |
* @global $wpdb
|
308 |
static function wcal_get_guest_personal_info( $user_id ) {
|
309 |
global $wpdb;
|
310 |
$guest_details = array();
|
311 |
+
|
312 |
$guest_query = "SELECT billing_first_name, billing_last_name, email_id AS billing_email, phone AS billing_phone FROM `" . $wpdb->prefix . 'ac_guest_abandoned_cart_history_lite' . "`
|
313 |
WHERE id = %d";
|
314 |
+
|
315 |
$guest_details = $wpdb->get_results( $wpdb->prepare( $guest_query, $user_id ) );
|
316 |
+
|
317 |
if ( is_array( $guest_details ) && count( $guest_details ) > 0 ) {
|
318 |
$guest_details = $guest_details[0];
|
319 |
}
|
320 |
+
|
321 |
return $guest_details;
|
322 |
}
|
323 |
+
|
324 |
/**
|
325 |
* Returns the Cart Details such as quantity, product name
|
326 |
* etc.
|
327 |
+
*
|
328 |
* @param object $cart_info - Abandoned Cart Information
|
329 |
* @return array $cart_details - Array containing product, qty & total for each item
|
330 |
* @since 4.9
|
331 |
*/
|
332 |
static function wcal_get_cart_details_export( $cart_info ) {
|
333 |
+
|
334 |
$cart_details = array();
|
335 |
+
|
336 |
if ( count( $cart_info ) > 0 ) {
|
337 |
+
|
338 |
$cart_total = 0;
|
339 |
foreach ( $cart_info as $k => $item_detail ) {
|
340 |
+
|
341 |
// Qty
|
342 |
$qty = $item_detail->quantity;
|
343 |
+
|
344 |
//Product Name
|
345 |
$product_id = $item_detail->product_id;
|
346 |
$prod_obj = wc_get_product( $product_id );
|
347 |
$product_name = $prod_obj->get_name();
|
348 |
+
|
349 |
// Variation Name
|
350 |
if ( isset( $item_detail->variation_id ) && $item_detail->variation_id > 0 ) {
|
351 |
$variation_id = $item_detail->variation_id;
|
352 |
$variation = wc_get_product( $variation_id );
|
353 |
$variation_name = $variation->get_name();
|
354 |
+
|
355 |
$product_name = $variation_name;
|
356 |
}
|
357 |
+
|
358 |
// Total
|
359 |
$item_total = $item_detail->line_total;
|
360 |
if ( $item_detail->line_subtotal_tax > 0 ) {
|
361 |
$item_total += $item_detail->line_subtotal_tax;
|
362 |
+
}
|
363 |
+
|
364 |
// Populate the array
|
365 |
$cart_details[ $k ][ 'qty' ] = $qty;
|
366 |
$cart_details[ $k ][ 'product_name' ] = $product_name;
|
367 |
$cart_details[ $k ][ 'item_total' ] = $item_total;
|
368 |
+
|
369 |
$cart_total += $item_total;
|
370 |
}
|
371 |
+
|
372 |
$cart_details[ 'total' ] = $cart_total;
|
373 |
}
|
374 |
+
|
375 |
return $cart_details;
|
376 |
}
|
377 |
} // end of class
|
includes/admin/wcap_add_cart_popup_modal.php
CHANGED
@@ -1,398 +1,796 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* It will fetch the Add to cart data, generate and populate data in the modal.
|
|
|
4 |
* @author Tyche Softwares
|
|
|
5 |
* @package Abandoned-Cart-Pro-for-WooCommerce/Admin/Settings
|
|
|
6 |
* @since 6.0
|
|
|
7 |
*/
|
|
|
8 |
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
9 |
exit; // Exit if accessed directly.
|
|
|
10 |
}
|
|
|
11 |
if ( ! class_exists( 'Wcap_Add_Cart_Popup_Modal' ) ) {
|
12 |
-
|
|
|
|
|
13 |
/**
|
|
|
14 |
* It will fetch the Add to cart data, generate and populate data in the modal.
|
|
|
15 |
* @since 6.0
|
|
|
16 |
*/
|
|
|
17 |
class Wcap_Add_Cart_Popup_Modal {
|
18 |
|
|
|
|
|
19 |
/**
|
|
|
20 |
* This function will add the add to cart popup medal's settings.
|
|
|
21 |
* @since 6.0
|
|
|
22 |
*/
|
|
|
23 |
public static function wcap_add_to_cart_popup_settings() {
|
|
|
24 |
$wcap_atc_enabled = get_option( 'wcap_atc_enable_modal' );
|
|
|
25 |
$wcap_disabled_field = '';
|
|
|
26 |
if ( 'off' == $wcap_atc_enabled ) {
|
|
|
27 |
$wcap_disabled_field = 'disabled="disabled"';
|
28 |
-
|
|
|
|
|
29 |
?>
|
|
|
30 |
<div id = "wcap_popup_main_div" class = "wcap_popup_main_div ">
|
|
|
31 |
<table id = "wcap_popup_main_table" class = "wcap_popup_main_table test_borders">
|
|
|
32 |
<tr id = "wcap_popup_main_table_tr" class = "wcap_popup_main_table_tr test_borders">
|
33 |
-
|
|
|
|
|
34 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_enable_modal_section( $wcap_disabled_field ); ?>
|
|
|
35 |
<?php self::wcap_custom_pages_section( $wcap_disabled_field ); ?>
|
|
|
36 |
<div class = "wcap_atc_all_fields_container" >
|
|
|
37 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_add_heading_section( $wcap_disabled_field ); ?>
|
|
|
38 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_add_text_section( $wcap_disabled_field ); ?>
|
|
|
39 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_email_placeholder_section( $wcap_disabled_field ); ?>
|
|
|
40 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_button_section( $wcap_disabled_field ); ?>
|
|
|
41 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_mandatory_modal_section( $wcap_disabled_field ); ?>
|
|
|
42 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_non_mandatory_modal_section_field( $wcap_disabled_field ); ?>
|
|
|
43 |
</div>
|
|
|
44 |
</td>
|
|
|
45 |
<td id = "wcap_popup_main_table_td_preview" class = "wcap_popup_main_table_td_preview test_borders">
|
|
|
46 |
<div class = "wcap_atc_all_fields_container" >
|
|
|
47 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_add_to_cart_popup_modal_preview( $wcap_disabled_field ); ?>
|
|
|
48 |
</div>
|
|
|
49 |
</td>
|
|
|
50 |
</tr>
|
|
|
51 |
<tr>
|
|
|
52 |
<td>
|
|
|
53 |
<div class = "wcap_atc_all_fields_container" >
|
|
|
54 |
<p class = "submit">
|
55 |
-
|
56 |
-
<input type = "submit" name = "submit" id = "submit" class = "
|
|
|
|
|
|
|
57 |
</p>
|
|
|
58 |
</div>
|
|
|
59 |
</td>
|
|
|
60 |
</tr>
|
|
|
61 |
</table>
|
|
|
62 |
</div>
|
|
|
63 |
<?php
|
|
|
64 |
}
|
65 |
|
|
|
|
|
66 |
/**
|
|
|
67 |
* It will add the "Enable Add to cart popup modal" setting on the add to cart modal settings page.
|
|
|
68 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
|
|
69 |
* @since 6.0
|
|
|
70 |
*/
|
|
|
71 |
public static function wcap_enable_modal_section( $wcap_disabled_field ){
|
|
|
72 |
?>
|
|
|
73 |
<table class = "wcap_enable_atc wcap_atc_between_fields_space" id = "wcap_enable_atc" >
|
74 |
-
|
|
|
|
|
75 |
<tr>
|
|
|
76 |
<td>
|
77 |
-
|
|
|
|
|
78 |
$wcap_atc_enabled = get_option('wcap_atc_enable_modal');
|
79 |
-
|
|
|
|
|
80 |
?>
|
|
|
81 |
<button type = "button" class = "wcap-enable-atc-modal wcap-toggle-atc-modal-enable-status" wcap-atc-switch-modal-enable = 'off' ?> readonly>
|
82 |
-
|
|
|
|
|
83 |
</button>
|
|
|
84 |
</td>
|
|
|
85 |
</tr>
|
|
|
86 |
</table>
|
87 |
-
|
|
|
|
|
88 |
}
|
89 |
|
|
|
|
|
90 |
/**
|
|
|
91 |
* Adds a multi select searchable dropdown from where
|
|
|
92 |
* the admin can select custom pages on which the
|
93 |
-
|
94 |
-
*
|
|
|
|
|
|
|
95 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
|
|
96 |
* @since 7.10.0
|
|
|
97 |
*/
|
|
|
98 |
public static function wcap_custom_pages_section( $wcap_disabled_field ) {
|
|
|
99 |
global $woocommerce;
|
|
|
100 |
$post_title_array = array();
|
|
|
101 |
?>
|
|
|
102 |
<table class = "wcap_custom_pages wcap_atc_between_fields_space" id = "wcap_custom_pages" >
|
|
|
103 |
<tr>
|
|
|
104 |
<th id="wcap_button_section_table_heading" class="wcap_button_section_table_heading"> <?php _e( 'Custom pages to display the pop-up modal on', 'woocommerce-abandoned-cart' );?> </th>
|
|
|
105 |
</tr>
|
|
|
106 |
<tr>
|
|
|
107 |
<td>
|
|
|
108 |
<?php
|
|
|
109 |
$custom_pages = get_option('wcap_custom_pages_list');
|
|
|
110 |
?>
|
|
|
111 |
<?php if ( $woocommerce->version >= '3.0' ) { ?>
|
|
|
112 |
<select style="width:80%" multiple="multiple" class="wcap_page_select wc-product-search" name="wcap_page_select[]" data-placeholder='<?php esc_attr__( 'Search for a Page…', 'woocommerce-abandoned-cart' )?>' data-action='wcap_json_find_pages' disabled>
|
113 |
|
114 |
-
|
|
|
|
|
|
|
115 |
if( is_array( $custom_pages ) && count( $custom_pages ) > 0 ) {
|
|
|
116 |
foreach( $custom_pages as $page_ids ) {
|
|
|
117 |
$post_id = $page_ids;
|
|
|
118 |
$post_title = get_the_title( $post_id );
|
119 |
-
|
|
|
|
|
120 |
printf( "<option value='%s' selected>%s</option>\n", $post_id, $post_title );
|
|
|
121 |
}
|
|
|
122 |
}
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
126 |
if( is_array( $post_title_array ) && is_array( $custom_pages ) && count( $custom_pages ) > 0 ) {
|
|
|
127 |
foreach( $custom_pages as $page_ids ) {
|
|
|
128 |
$post_id = $page_ids;
|
|
|
129 |
$post_title = get_the_title( $post_id );
|
|
|
130 |
$post_title_array[$post_title] = $post_title;
|
131 |
-
|
|
|
|
|
132 |
}
|
|
|
133 |
}
|
|
|
134 |
?>
|
135 |
-
|
|
|
|
|
136 |
<input type="hidden" style="width:80%" id = "wcap_page_select" class="wc-product-search" name="wcap_page_select[]" data-placeholder='<?php esc_attr_e( 'Search for a Page…', 'woocommerce-abandoned-cart' )?>' data-multiple="true" data-action='wcap_json_find_pages' data-selected=" <?php echo esc_attr( json_encode( $post_title_array ) ); ?>" value="<?php echo implode( ',', array_keys( $post_title_array ) ); ?>" readonly/>
|
137 |
-
|
|
|
|
|
138 |
<?php } ?>
|
139 |
-
|
|
|
|
|
140 |
<?php $toolTip = __( 'Please add any custom pages (not created by WooCommerce) where you wish to display the Add to cart Pop-up Modal.', 'woocommerce-abandoned-cart' ); ?>
|
|
|
141 |
<?php echo wc_help_tip( $toolTip ); ?>
|
|
|
142 |
</td>
|
|
|
143 |
</tr>
|
|
|
144 |
<tr>
|
|
|
145 |
<td colspan="2" style="text-align: justify;">
|
|
|
146 |
<?php _e( "<b>Note:</b> Please ensure that the Add to Cart button links on these pages are added with the correct classes and attributes to ensure the plugin can capture the cart data correctly. For further guidance, please check the documentation.", 'woocommerce-abandoned-cart' );?>
|
|
|
147 |
</td>
|
|
|
148 |
</tr>
|
|
|
149 |
</table>
|
150 |
-
|
|
|
|
|
151 |
}
|
|
|
152 |
/**
|
|
|
153 |
* It will Save the setting on the add to cart modal settings page.
|
|
|
154 |
* @since 6.0
|
|
|
155 |
*/
|
|
|
156 |
public static function wcap_add_to_cart_popup_save_settings() {
|
|
|
157 |
if ( $_POST ['wcap_heading_section_text_email'] ) {
|
|
|
158 |
update_option ( 'wcap_heading_section_text_email', $_POST ['wcap_heading_section_text_email'] );
|
159 |
-
|
|
|
|
|
160 |
if ( $_POST ['wcap_popup_heading_color_picker'] ) {
|
|
|
161 |
update_option ( 'wcap_popup_heading_color_picker', $_POST ['wcap_popup_heading_color_picker'] );
|
162 |
-
|
|
|
|
|
163 |
if ( $_POST ['wcap_text_section_text'] ) {
|
|
|
164 |
update_option ( 'wcap_text_section_text', $_POST ['wcap_text_section_text'] );
|
165 |
-
|
|
|
|
|
166 |
if ( $_POST ['wcap_popup_text_color_picker'] ) {
|
|
|
167 |
update_option ( 'wcap_popup_text_color_picker', $_POST ['wcap_popup_text_color_picker'] );
|
168 |
-
|
|
|
|
|
169 |
if ( $_POST ['wcap_email_placeholder_section_input_text'] ) {
|
|
|
170 |
update_option ( 'wcap_email_placeholder_section_input_text', $_POST ['wcap_email_placeholder_section_input_text'] );
|
171 |
-
|
|
|
|
|
172 |
if ( $_POST ['wcap_button_section_input_text'] ) {
|
|
|
173 |
update_option ( 'wcap_button_section_input_text', $_POST ['wcap_button_section_input_text'] );
|
|
|
174 |
}
|
|
|
175 |
if ( $_POST ['wcap_button_color_picker'] ) {
|
|
|
176 |
update_option ( 'wcap_button_color_picker', $_POST ['wcap_button_color_picker'] );
|
|
|
177 |
}
|
|
|
178 |
if ( isset( $_POST ['wcap_button_text_color_picker'] ) ){
|
|
|
179 |
update_option ( 'wcap_button_text_color_picker', $_POST ['wcap_button_text_color_picker'] );
|
|
|
180 |
}
|
|
|
181 |
if ( isset( $_POST ['wcap_non_mandatory_modal_section_fields_input_text'] ) ) {
|
|
|
182 |
update_option( 'wcap_non_mandatory_text', $_POST ['wcap_non_mandatory_modal_section_fields_input_text'] );
|
|
|
183 |
}
|
184 |
-
|
|
|
|
|
185 |
$custom_pages = isset( $_POST[ 'wcap_page_select' ] ) ? $_POST[ 'wcap_page_select' ] : array();
|
|
|
186 |
update_option( 'wcap_custom_pages_list', $custom_pages );
|
187 |
-
|
|
|
|
|
188 |
}
|
189 |
|
|
|
|
|
190 |
/**
|
|
|
191 |
* It will add the setting for Heading section on the add to cart modal settings page.
|
|
|
192 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
|
|
193 |
* @since 6.0
|
|
|
194 |
*/
|
195 |
-
|
|
|
|
|
196 |
?>
|
|
|
197 |
<div id = "wcap_heading_section_div" class = "wcap_heading_section_div wcap_atc_between_fields_space">
|
|
|
198 |
<table id = "wcap_heading_section_table" class = "wcap_heading_section_table">
|
|
|
199 |
<th id = "wcap_heading_section_table_heading" class ="wcap_heading_section_table_heading"> Modal Heading </th>
|
|
|
200 |
<tr id = "wcap_heading_section_tr" class = "wcap_heading_section_tr" >
|
|
|
201 |
<td id = "wcap_heading_section_text_field" class = "wcap_heading_section_text_field test_borders">
|
|
|
202 |
<input id = "wcap_heading_section_text_email" v-model = "wcap_heading_section_text_email" name = "wcap_heading_section_text_email"class = "wcap_heading_section_text_email"
|
|
|
203 |
<?php echo $wcap_disabled_field; ?> readonly value="<?php _e( 'Please enter your email address', 'woocommerce-abandoned-cart' ); ?>">
|
204 |
-
|
|
|
|
|
205 |
<td id = "wcap_heading_section_text_field_color" class = "wcap_heading_section_text_field_color test_borders">
|
|
|
206 |
<?php $wcap_popup_heading_color_picker = get_option( 'wcap_popup_heading_color_picker' ); ?>
|
|
|
207 |
<span class = "colorpickpreview" style = "background:<?php echo $wcap_popup_heading_color_picker; ?>"></span>
|
|
|
208 |
<input class = "wcap_popup_heading_color_picker colorpick" name = "wcap_popup_heading_color_picker" value = "#737f97" v-model = "wcap_popup_heading_color" v-on:input = "wcap_atc_popup_heading.color = $event.target.value"
|
|
|
209 |
<?php echo $wcap_disabled_field; ?> readonly >
|
|
|
210 |
</td>
|
|
|
211 |
</tr>
|
|
|
212 |
</table>
|
|
|
213 |
</div>
|
|
|
214 |
<?php
|
|
|
215 |
}
|
216 |
|
|
|
|
|
217 |
/**
|
|
|
218 |
* It will add the setting for Text displayed below heading section on the add to cart modal settings page.
|
|
|
219 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
|
|
220 |
* @since 6.0
|
|
|
221 |
*/
|
|
|
222 |
public static function wcap_add_text_section( $wcap_disabled_field ) {
|
|
|
223 |
?>
|
|
|
224 |
<div id = "wcap_text_section_div" class = "wcap_text_section_div wcap_atc_between_fields_space">
|
|
|
225 |
<table id = "wcap_text_section_table" class = "wcap_text_section_table">
|
|
|
226 |
<th id = "wcap_text_section_table_heading" class = "wcap_text_section_table_heading"> Modal Text </th>
|
|
|
227 |
<tr id = "wcap_text_section_tr" class = "wcap_text_section_tr" >
|
|
|
228 |
<td id = "wcap_text_section_text_field" class = "wcap_text_section_text_field test_borders">
|
|
|
229 |
<input id = "wcap_text_section_text" v-model = "wcap_text_section_text_field" class="wcap_text_section_input_text" name = "wcap_text_section_text"
|
|
|
230 |
<?php echo $wcap_disabled_field; ?> readonly value="<?php _e( 'To add this item to your cart, please enter your email address.','woocommerce-abandoned-cart' ); ?>">
|
231 |
-
|
|
|
|
|
232 |
<td id = "wcap_text_section_field_color" class = "wcap_text_section_field_color test_borders">
|
|
|
233 |
<?php $wcap_atc_popup_text_color = get_option( 'wcap_popup_text_color_picker' ); ?>
|
|
|
234 |
<span class = "colorpickpreview" style = "background:<?php echo $wcap_atc_popup_text_color; ?>"></span>
|
|
|
235 |
<input class = "wcap_popup_text_color_picker colorpick" name = "wcap_popup_text_color_picker" value = "#bbc9d2" v-model = "wcap_popup_text_color" v-on:input = "wcap_atc_popup_text.color = $event.target.value"
|
|
|
236 |
<?php echo $wcap_disabled_field; ?> readonly>
|
|
|
237 |
</td>
|
|
|
238 |
</tr>
|
|
|
239 |
</table>
|
|
|
240 |
</div>
|
|
|
241 |
<?php
|
|
|
242 |
}
|
243 |
|
|
|
|
|
244 |
/**
|
|
|
245 |
* It will add the setting for email placeholder on the add to cart modal settings page.
|
|
|
246 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
|
|
247 |
* @since 6.0
|
|
|
248 |
*/
|
|
|
249 |
public static function wcap_email_placeholder_section( $wcap_disabled_field ) {
|
|
|
250 |
?>
|
|
|
251 |
<div id = "wcap_email_placeholder_section_div" class = "wcap_email_placeholder_section_div wcap_atc_between_fields_space">
|
|
|
252 |
<table id = "wcap_email_placeholder_section_table" class = "wcap_email_placeholder_section_table">
|
|
|
253 |
<th id = "wcap_email_placeholder_section_table_heading" class = "wcap_email_placeholder_section_table_heading"> Email placeholder </th>
|
|
|
254 |
<tr id = "wcap_email_placeholder_section_tr" class = "wcap_email_placeholder_section_tr" >
|
|
|
255 |
<td id = "wcap_email_placeholder_section_text_field" class = "wcap_email_placeholder_section_text_field test_borders">
|
256 |
-
|
|
|
|
|
257 |
<?php echo $wcap_disabled_field; ?> readonly value="<?php _e('Email address', 'woocommerce-abandoned-cart' ); ?>">
|
|
|
258 |
</td>
|
|
|
259 |
</tr>
|
|
|
260 |
</table>
|
|
|
261 |
</div>
|
|
|
262 |
<?php
|
|
|
263 |
}
|
264 |
|
|
|
|
|
265 |
/**
|
|
|
266 |
* It will add the setting for Add to cart button on the add to cart modal settings page.
|
|
|
267 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
|
|
268 |
* @since 6.0
|
|
|
269 |
*/
|
|
|
270 |
public static function wcap_button_section( $wcap_disabled_field ) {
|
|
|
271 |
?>
|
|
|
272 |
<div id = "wcap_button_section_div" class = "wcap_button_section_div wcap_atc_between_fields_space">
|
|
|
273 |
<table id = "wcap_button_section_table" class = "wcap_button_section_table">
|
|
|
274 |
<th id = "wcap_button_section_table_heading" class="wcap_button_section_table_heading"> Add to cart button text </th>
|
|
|
275 |
<tr>
|
|
|
276 |
<td id = "wcap_button_section_text_field" class = "wcap_button_section_text_field test_borders">
|
|
|
277 |
<input id = "wcap_button_section_input_text" v-model = "wcap_button_section_input_text" class="wcap_button_section_input_text" name = "wcap_button_section_input_text"
|
|
|
278 |
<?php echo $wcap_disabled_field ; ?> readonly value="<?php _e( 'Add to Cart', 'woocommerce-abandoned-cart' ); ?>">
|
|
|
279 |
</td>
|
|
|
280 |
</tr>
|
|
|
281 |
<tr id = "wcap_button_color_section_tr" class = "wcap_button_color_section_tr">
|
|
|
282 |
<td id = "wcap_button_color_section_text_field" class = "wcap_button_color_section_text_field test_borders">
|
|
|
283 |
<?php $wcap_atc_button_bg_color = get_option( 'wcap_button_color_picker' ); ?>
|
|
|
284 |
<span class = "colorpickpreview" style = "background:<?php echo $wcap_atc_button_bg_color; ?>"></span>
|
|
|
285 |
<input id = "wcap_button_color_picker" value = "#0085ba" v-model ="wcap_button_bg_color" v-on:input="wcap_atc_button.backgroundColor = $event.target.value" class="wcap_button_color_picker colorpick" name = "wcap_button_color_picker"
|
|
|
286 |
<?php echo $wcap_disabled_field; ?> readonly >
|
|
|
287 |
</td>
|
|
|
288 |
<td id = "wcap_button_text_color_section_text_field" class = "wcap_button_text_color_section_text_field test_borders">
|
|
|
289 |
<?php $wcap_button_text_color_picker = get_option('wcap_button_text_color_picker'); ?>
|
|
|
290 |
<span class = "colorpickpreview" style = "background:<?php echo $wcap_button_text_color_picker; ?>"></span>
|
291 |
-
|
|
|
|
|
292 |
<?php echo $wcap_disabled_field; ?> readonly>
|
|
|
293 |
</td>
|
|
|
294 |
</tr>
|
|
|
295 |
</table>
|
|
|
296 |
</div>
|
|
|
297 |
<?php
|
|
|
298 |
}
|
299 |
-
|
|
|
|
|
300 |
/**
|
|
|
301 |
* It will add the setting for Email address mandatory field on the add to cart modal settings page.
|
|
|
302 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
|
|
303 |
* @since 6.0
|
|
|
304 |
*/
|
|
|
305 |
public static function wcap_mandatory_modal_section( $wcap_disabled_field ) {
|
|
|
306 |
?>
|
|
|
307 |
<table class = "wcap_atc_between_fields_space">
|
|
|
308 |
<th id = "wcap_button_section_table_heading" class = "wcap_button_section_table_heading"> Email address is mandatory ? </th>
|
|
|
309 |
<tr>
|
|
|
310 |
<td>
|
311 |
-
|
|
|
|
|
312 |
$wcap_atc_email_mandatory = get_option( 'wcap_atc_mandatory_email' );
|
313 |
-
|
|
|
|
|
314 |
?>
|
315 |
-
|
|
|
|
|
316 |
<?php echo $wcap_disabled_field; ?> readonly >
|
|
|
317 |
<?php echo $active_text; ?> </button>
|
|
|
318 |
</td>
|
|
|
319 |
</tr>
|
|
|
320 |
</table>
|
|
|
321 |
<?php
|
|
|
322 |
}
|
323 |
|
|
|
|
|
324 |
/**
|
|
|
325 |
* It will add the setting for Email address non mandatory field on the add to cart modal settings page.
|
|
|
326 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
|
|
327 |
* @since 6.0
|
|
|
328 |
*/
|
|
|
329 |
public static function wcap_non_mandatory_modal_section_field( $wcap_disabled_field ) {
|
|
|
330 |
$wcap_get_mandatory_field = get_option( 'wcap_atc_mandatory_email' );
|
|
|
331 |
$wcap_disabled_email_field = '';
|
|
|
332 |
if ( 'on' == $wcap_get_mandatory_field ) {
|
|
|
333 |
$wcap_disabled_email_field = 'disabled="disabled"';
|
|
|
334 |
}
|
|
|
335 |
?>
|
|
|
336 |
<div id = "wcap_non_mandatory_modal_section_fields_div" class = "wcap_non_mandatory_modal_section_fields_div wcap_atc_between_fields_space">
|
|
|
337 |
<table id = "wcap_non_mandatory_modal_section_fields_div_table" class = "wcap_non_mandatory_modal_section_fields_div_table">
|
338 |
-
|
|
|
|
|
339 |
class="wcap_non_mandatory_modal_section_fields_table_heading"> Not mandatory text </th>
|
|
|
340 |
<tr id = "wcap_non_mandatory_modal_section_fields_tr" class = "wcap_non_mandatory_modal_section_fields_tr" >
|
|
|
341 |
<td id = "wcap_non_mandatory_modal_section_fields_text_field" class = "wcap_non_mandatory_modal_section_fields_text_field test_borders">
|
|
|
342 |
<input id = "wcap_non_mandatory_modal_section_fields_input_text" v-model = "wcap_non_mandatory_modal_input_text" class = "wcap_non_mandatory_modal_section_fields_input_text" name = "wcap_non_mandatory_modal_section_fields_input_text" readonly value="<?php _e( 'No Thanks', 'woocommerce-abandoned-cart' ); ?>"
|
343 |
-
|
|
|
|
|
344 |
echo $wcap_disabled_email_field;
|
|
|
345 |
?> >
|
|
|
346 |
</td>
|
|
|
347 |
</tr>
|
|
|
348 |
</table>
|
|
|
349 |
</div>
|
|
|
350 |
<?php
|
|
|
351 |
}
|
352 |
|
|
|
|
|
353 |
/**
|
|
|
354 |
* It will will show th preview of the Add To cart Popup modal with the changes made on any of the settings for it.
|
|
|
355 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
|
|
356 |
* @since 6.0
|
|
|
357 |
*/
|
|
|
358 |
public static function wcap_add_to_cart_popup_modal_preview( $wcap_disabled_field ) {
|
359 |
-
|
|
|
|
|
360 |
?>
|
|
|
361 |
<div class = "wcap_container">
|
|
|
362 |
<div class = "wcap_popup_wrapper">
|
|
|
363 |
<div class = "wcap_popup_content">
|
|
|
364 |
<div class = "wcap_popup_heading_container">
|
|
|
365 |
<div class = "wcap_popup_icon_container" >
|
|
|
366 |
<span class = "wcap_popup_icon" >
|
|
|
367 |
<span class = "wcap_popup_plus_sign" v-bind:style = "wcap_atc_button">
|
|
|
368 |
</span>
|
|
|
369 |
</span>
|
|
|
370 |
</div>
|
|
|
371 |
<div class = "wcap_popup_text_container">
|
|
|
372 |
<h2 class = "wcap_popup_heading" v-bind:style = "wcap_atc_popup_heading" ><?php _e( 'Please enter your email address.', 'woocommerce-abandoned-cart' ); ?></h2>
|
|
|
373 |
<div class = "wcap_popup_text" v-bind:style = "wcap_atc_popup_text" ><?php _e( 'To add this item to your cart, please enter your email address.', 'woocommerce-abandoned-cart' ); ?></div>
|
|
|
374 |
</div>
|
|
|
375 |
</div>
|
|
|
376 |
<div class = "wcap_popup_form">
|
|
|
377 |
<form action = "" name = "wcap_modal_form">
|
|
|
378 |
<div class = "wcap_popup_input_field_container" >
|
|
|
379 |
<input class = "wcap_popup_input" type = "text" value = "" name = "email" placeholder ="<?php _e( 'Email address', 'woocommerce-abandoned-cart' ); ?>"
|
|
|
380 |
<?php echo $wcap_disabled_field; ?> readonly >
|
|
|
381 |
</div>
|
|
|
382 |
<button class = "wcap_popup_button" v-bind:style = "wcap_atc_button"
|
|
|
383 |
<?php echo $wcap_disabled_field ; ?> ><?php _e( 'Add to Cart', 'woocommerce-abandoned-cart' ); ?></button>
|
|
|
384 |
<br>
|
|
|
385 |
<br>
|
|
|
386 |
<div id = "wcap_non_mandatory_text_wrapper" class = "wcap_non_mandatory_text_wrapper">
|
|
|
387 |
<a class = "wcap_popup_non_mandatory_button" href = "" > <?php _e( 'No Thanks', 'woocommerce-abandoned-cart' ); ?></a>
|
|
|
388 |
</div>
|
|
|
389 |
</form>
|
|
|
390 |
</div>
|
|
|
391 |
<div class = "wcap_popup_close" ></div>
|
|
|
392 |
</div>
|
|
|
393 |
</div>
|
|
|
394 |
</div>
|
|
|
395 |
<?php
|
|
|
396 |
}
|
|
|
397 |
}
|
|
|
398 |
}
|
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
+
|
5 |
* It will fetch the Add to cart data, generate and populate data in the modal.
|
6 |
+
|
7 |
* @author Tyche Softwares
|
8 |
+
|
9 |
* @package Abandoned-Cart-Pro-for-WooCommerce/Admin/Settings
|
10 |
+
|
11 |
* @since 6.0
|
12 |
+
|
13 |
*/
|
14 |
+
|
15 |
if ( ! defined( 'ABSPATH' ) ) {
|
16 |
+
|
17 |
exit; // Exit if accessed directly.
|
18 |
+
|
19 |
}
|
20 |
+
|
21 |
if ( ! class_exists( 'Wcap_Add_Cart_Popup_Modal' ) ) {
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
/**
|
26 |
+
|
27 |
* It will fetch the Add to cart data, generate and populate data in the modal.
|
28 |
+
|
29 |
* @since 6.0
|
30 |
+
|
31 |
*/
|
32 |
+
|
33 |
class Wcap_Add_Cart_Popup_Modal {
|
34 |
|
35 |
+
|
36 |
+
|
37 |
/**
|
38 |
+
|
39 |
* This function will add the add to cart popup medal's settings.
|
40 |
+
|
41 |
* @since 6.0
|
42 |
+
|
43 |
*/
|
44 |
+
|
45 |
public static function wcap_add_to_cart_popup_settings() {
|
46 |
+
|
47 |
$wcap_atc_enabled = get_option( 'wcap_atc_enable_modal' );
|
48 |
+
|
49 |
$wcap_disabled_field = '';
|
50 |
+
|
51 |
if ( 'off' == $wcap_atc_enabled ) {
|
52 |
+
|
53 |
$wcap_disabled_field = 'disabled="disabled"';
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
?>
|
58 |
+
|
59 |
<div id = "wcap_popup_main_div" class = "wcap_popup_main_div ">
|
60 |
+
|
61 |
<table id = "wcap_popup_main_table" class = "wcap_popup_main_table test_borders">
|
62 |
+
|
63 |
<tr id = "wcap_popup_main_table_tr" class = "wcap_popup_main_table_tr test_borders">
|
64 |
+
|
65 |
+
<td id = "wcap_popup_main_table_td_settings" class = "wcap_popup_main_table_td_settings test_borders">
|
66 |
+
|
67 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_enable_modal_section( $wcap_disabled_field ); ?>
|
68 |
+
|
69 |
<?php self::wcap_custom_pages_section( $wcap_disabled_field ); ?>
|
70 |
+
|
71 |
<div class = "wcap_atc_all_fields_container" >
|
72 |
+
|
73 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_add_heading_section( $wcap_disabled_field ); ?>
|
74 |
+
|
75 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_add_text_section( $wcap_disabled_field ); ?>
|
76 |
+
|
77 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_email_placeholder_section( $wcap_disabled_field ); ?>
|
78 |
+
|
79 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_button_section( $wcap_disabled_field ); ?>
|
80 |
+
|
81 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_mandatory_modal_section( $wcap_disabled_field ); ?>
|
82 |
+
|
83 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_non_mandatory_modal_section_field( $wcap_disabled_field ); ?>
|
84 |
+
|
85 |
</div>
|
86 |
+
|
87 |
</td>
|
88 |
+
|
89 |
<td id = "wcap_popup_main_table_td_preview" class = "wcap_popup_main_table_td_preview test_borders">
|
90 |
+
|
91 |
<div class = "wcap_atc_all_fields_container" >
|
92 |
+
|
93 |
<?php Wcap_Add_Cart_Popup_Modal::wcap_add_to_cart_popup_modal_preview( $wcap_disabled_field ); ?>
|
94 |
+
|
95 |
</div>
|
96 |
+
|
97 |
</td>
|
98 |
+
|
99 |
</tr>
|
100 |
+
|
101 |
<tr>
|
102 |
+
|
103 |
<td>
|
104 |
+
|
105 |
<div class = "wcap_atc_all_fields_container" >
|
106 |
+
|
107 |
<p class = "submit">
|
108 |
+
|
109 |
+
<input type = "submit" name = "submit" id = "submit" disabled class = "button button-primary" value = "Save Changes" <?php echo $wcap_disabled_field; ?> >
|
110 |
+
|
111 |
+
<input type = "submit" name = "submit" id = "submit" disabled class = "wcap_reset_button button button-primary" value = "Reset to default configuration" <?php echo $wcap_disabled_field; ?> >
|
112 |
+
|
113 |
</p>
|
114 |
+
|
115 |
</div>
|
116 |
+
|
117 |
</td>
|
118 |
+
|
119 |
</tr>
|
120 |
+
|
121 |
</table>
|
122 |
+
|
123 |
</div>
|
124 |
+
|
125 |
<?php
|
126 |
+
|
127 |
}
|
128 |
|
129 |
+
|
130 |
+
|
131 |
/**
|
132 |
+
|
133 |
* It will add the "Enable Add to cart popup modal" setting on the add to cart modal settings page.
|
134 |
+
|
135 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
136 |
+
|
137 |
* @since 6.0
|
138 |
+
|
139 |
*/
|
140 |
+
|
141 |
public static function wcap_enable_modal_section( $wcap_disabled_field ){
|
142 |
+
|
143 |
?>
|
144 |
+
|
145 |
<table class = "wcap_enable_atc wcap_atc_between_fields_space" id = "wcap_enable_atc" >
|
146 |
+
|
147 |
+
<th id = "wcap_button_section_table_heading" class = "wcap_button_section_table_heading"> <?php _e( 'Enable Add to cart popup modal', 'woocommerce-abandoned-cart' ); ?> </th>
|
148 |
+
|
149 |
<tr>
|
150 |
+
|
151 |
<td>
|
152 |
+
|
153 |
+
<?php
|
154 |
+
|
155 |
$wcap_atc_enabled = get_option('wcap_atc_enable_modal');
|
156 |
+
|
157 |
+
$active_text = $wcap_atc_enabled;
|
158 |
+
|
159 |
?>
|
160 |
+
|
161 |
<button type = "button" class = "wcap-enable-atc-modal wcap-toggle-atc-modal-enable-status" wcap-atc-switch-modal-enable = 'off' ?> readonly>
|
162 |
+
|
163 |
+
<?php echo $active_text; ?>
|
164 |
+
|
165 |
</button>
|
166 |
+
|
167 |
</td>
|
168 |
+
|
169 |
</tr>
|
170 |
+
|
171 |
</table>
|
172 |
+
|
173 |
+
<?php
|
174 |
+
|
175 |
}
|
176 |
|
177 |
+
|
178 |
+
|
179 |
/**
|
180 |
+
|
181 |
* Adds a multi select searchable dropdown from where
|
182 |
+
|
183 |
* the admin can select custom pages on which the
|
184 |
+
|
185 |
+
* Add to Cart Popup modal should be displayed.
|
186 |
+
|
187 |
+
*
|
188 |
+
|
189 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
190 |
+
|
191 |
* @since 7.10.0
|
192 |
+
|
193 |
*/
|
194 |
+
|
195 |
public static function wcap_custom_pages_section( $wcap_disabled_field ) {
|
196 |
+
|
197 |
global $woocommerce;
|
198 |
+
|
199 |
$post_title_array = array();
|
200 |
+
|
201 |
?>
|
202 |
+
|
203 |
<table class = "wcap_custom_pages wcap_atc_between_fields_space" id = "wcap_custom_pages" >
|
204 |
+
|
205 |
<tr>
|
206 |
+
|
207 |
<th id="wcap_button_section_table_heading" class="wcap_button_section_table_heading"> <?php _e( 'Custom pages to display the pop-up modal on', 'woocommerce-abandoned-cart' );?> </th>
|
208 |
+
|
209 |
</tr>
|
210 |
+
|
211 |
<tr>
|
212 |
+
|
213 |
<td>
|
214 |
+
|
215 |
<?php
|
216 |
+
|
217 |
$custom_pages = get_option('wcap_custom_pages_list');
|
218 |
+
|
219 |
?>
|
220 |
+
|
221 |
<?php if ( $woocommerce->version >= '3.0' ) { ?>
|
222 |
+
|
223 |
<select style="width:80%" multiple="multiple" class="wcap_page_select wc-product-search" name="wcap_page_select[]" data-placeholder='<?php esc_attr__( 'Search for a Page…', 'woocommerce-abandoned-cart' )?>' data-action='wcap_json_find_pages' disabled>
|
224 |
|
225 |
+
|
226 |
+
|
227 |
+
<?php
|
228 |
+
|
229 |
if( is_array( $custom_pages ) && count( $custom_pages ) > 0 ) {
|
230 |
+
|
231 |
foreach( $custom_pages as $page_ids ) {
|
232 |
+
|
233 |
$post_id = $page_ids;
|
234 |
+
|
235 |
$post_title = get_the_title( $post_id );
|
236 |
+
|
237 |
+
|
238 |
+
|
239 |
printf( "<option value='%s' selected>%s</option>\n", $post_id, $post_title );
|
240 |
+
|
241 |
}
|
242 |
+
|
243 |
}
|
244 |
+
|
245 |
+
?>
|
246 |
+
|
247 |
+
</select>
|
248 |
+
|
249 |
+
<?php } else {
|
250 |
+
|
251 |
if( is_array( $post_title_array ) && is_array( $custom_pages ) && count( $custom_pages ) > 0 ) {
|
252 |
+
|
253 |
foreach( $custom_pages as $page_ids ) {
|
254 |
+
|
255 |
$post_id = $page_ids;
|
256 |
+
|
257 |
$post_title = get_the_title( $post_id );
|
258 |
+
|
259 |
$post_title_array[$post_title] = $post_title;
|
260 |
+
|
261 |
+
|
262 |
+
|
263 |
}
|
264 |
+
|
265 |
}
|
266 |
+
|
267 |
?>
|
268 |
+
|
269 |
+
|
270 |
+
|
271 |
<input type="hidden" style="width:80%" id = "wcap_page_select" class="wc-product-search" name="wcap_page_select[]" data-placeholder='<?php esc_attr_e( 'Search for a Page…', 'woocommerce-abandoned-cart' )?>' data-multiple="true" data-action='wcap_json_find_pages' data-selected=" <?php echo esc_attr( json_encode( $post_title_array ) ); ?>" value="<?php echo implode( ',', array_keys( $post_title_array ) ); ?>" readonly/>
|
272 |
+
|
273 |
+
|
274 |
+
|
275 |
<?php } ?>
|
276 |
+
|
277 |
+
|
278 |
+
|
279 |
<?php $toolTip = __( 'Please add any custom pages (not created by WooCommerce) where you wish to display the Add to cart Pop-up Modal.', 'woocommerce-abandoned-cart' ); ?>
|
280 |
+
|
281 |
<?php echo wc_help_tip( $toolTip ); ?>
|
282 |
+
|
283 |
</td>
|
284 |
+
|
285 |
</tr>
|
286 |
+
|
287 |
<tr>
|
288 |
+
|
289 |
<td colspan="2" style="text-align: justify;">
|
290 |
+
|
291 |
<?php _e( "<b>Note:</b> Please ensure that the Add to Cart button links on these pages are added with the correct classes and attributes to ensure the plugin can capture the cart data correctly. For further guidance, please check the documentation.", 'woocommerce-abandoned-cart' );?>
|
292 |
+
|
293 |
</td>
|
294 |
+
|
295 |
</tr>
|
296 |
+
|
297 |
</table>
|
298 |
+
|
299 |
+
<?php
|
300 |
+
|
301 |
}
|
302 |
+
|
303 |
/**
|
304 |
+
|
305 |
* It will Save the setting on the add to cart modal settings page.
|
306 |
+
|
307 |
* @since 6.0
|
308 |
+
|
309 |
*/
|
310 |
+
|
311 |
public static function wcap_add_to_cart_popup_save_settings() {
|
312 |
+
|
313 |
if ( $_POST ['wcap_heading_section_text_email'] ) {
|
314 |
+
|
315 |
update_option ( 'wcap_heading_section_text_email', $_POST ['wcap_heading_section_text_email'] );
|
316 |
+
|
317 |
+
}
|
318 |
+
|
319 |
if ( $_POST ['wcap_popup_heading_color_picker'] ) {
|
320 |
+
|
321 |
update_option ( 'wcap_popup_heading_color_picker', $_POST ['wcap_popup_heading_color_picker'] );
|
322 |
+
|
323 |
+
}
|
324 |
+
|
325 |
if ( $_POST ['wcap_text_section_text'] ) {
|
326 |
+
|
327 |
update_option ( 'wcap_text_section_text', $_POST ['wcap_text_section_text'] );
|
328 |
+
|
329 |
+
}
|
330 |
+
|
331 |
if ( $_POST ['wcap_popup_text_color_picker'] ) {
|
332 |
+
|
333 |
update_option ( 'wcap_popup_text_color_picker', $_POST ['wcap_popup_text_color_picker'] );
|
334 |
+
|
335 |
+
}
|
336 |
+
|
337 |
if ( $_POST ['wcap_email_placeholder_section_input_text'] ) {
|
338 |
+
|
339 |
update_option ( 'wcap_email_placeholder_section_input_text', $_POST ['wcap_email_placeholder_section_input_text'] );
|
340 |
+
|
341 |
+
}
|
342 |
+
|
343 |
if ( $_POST ['wcap_button_section_input_text'] ) {
|
344 |
+
|
345 |
update_option ( 'wcap_button_section_input_text', $_POST ['wcap_button_section_input_text'] );
|
346 |
+
|
347 |
}
|
348 |
+
|
349 |
if ( $_POST ['wcap_button_color_picker'] ) {
|
350 |
+
|
351 |
update_option ( 'wcap_button_color_picker', $_POST ['wcap_button_color_picker'] );
|
352 |
+
|
353 |
}
|
354 |
+
|
355 |
if ( isset( $_POST ['wcap_button_text_color_picker'] ) ){
|
356 |
+
|
357 |
update_option ( 'wcap_button_text_color_picker', $_POST ['wcap_button_text_color_picker'] );
|
358 |
+
|
359 |
}
|
360 |
+
|
361 |
if ( isset( $_POST ['wcap_non_mandatory_modal_section_fields_input_text'] ) ) {
|
362 |
+
|
363 |
update_option( 'wcap_non_mandatory_text', $_POST ['wcap_non_mandatory_modal_section_fields_input_text'] );
|
364 |
+
|
365 |
}
|
366 |
+
|
367 |
+
|
368 |
+
|
369 |
$custom_pages = isset( $_POST[ 'wcap_page_select' ] ) ? $_POST[ 'wcap_page_select' ] : array();
|
370 |
+
|
371 |
update_option( 'wcap_custom_pages_list', $custom_pages );
|
372 |
+
|
373 |
+
|
374 |
+
|
375 |
}
|
376 |
|
377 |
+
|
378 |
+
|
379 |
/**
|
380 |
+
|
381 |
* It will add the setting for Heading section on the add to cart modal settings page.
|
382 |
+
|
383 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
384 |
+
|
385 |
* @since 6.0
|
386 |
+
|
387 |
*/
|
388 |
+
|
389 |
+
public static function wcap_add_heading_section( $wcap_disabled_field ) {
|
390 |
+
|
391 |
?>
|
392 |
+
|
393 |
<div id = "wcap_heading_section_div" class = "wcap_heading_section_div wcap_atc_between_fields_space">
|
394 |
+
|
395 |
<table id = "wcap_heading_section_table" class = "wcap_heading_section_table">
|
396 |
+
|
397 |
<th id = "wcap_heading_section_table_heading" class ="wcap_heading_section_table_heading"> Modal Heading </th>
|
398 |
+
|
399 |
<tr id = "wcap_heading_section_tr" class = "wcap_heading_section_tr" >
|
400 |
+
|
401 |
<td id = "wcap_heading_section_text_field" class = "wcap_heading_section_text_field test_borders">
|
402 |
+
|
403 |
<input id = "wcap_heading_section_text_email" v-model = "wcap_heading_section_text_email" name = "wcap_heading_section_text_email"class = "wcap_heading_section_text_email"
|
404 |
+
|
405 |
<?php echo $wcap_disabled_field; ?> readonly value="<?php _e( 'Please enter your email address', 'woocommerce-abandoned-cart' ); ?>">
|
406 |
+
|
407 |
+
</td>
|
408 |
+
|
409 |
<td id = "wcap_heading_section_text_field_color" class = "wcap_heading_section_text_field_color test_borders">
|
410 |
+
|
411 |
<?php $wcap_popup_heading_color_picker = get_option( 'wcap_popup_heading_color_picker' ); ?>
|
412 |
+
|
413 |
<span class = "colorpickpreview" style = "background:<?php echo $wcap_popup_heading_color_picker; ?>"></span>
|
414 |
+
|
415 |
<input class = "wcap_popup_heading_color_picker colorpick" name = "wcap_popup_heading_color_picker" value = "#737f97" v-model = "wcap_popup_heading_color" v-on:input = "wcap_atc_popup_heading.color = $event.target.value"
|
416 |
+
|
417 |
<?php echo $wcap_disabled_field; ?> readonly >
|
418 |
+
|
419 |
</td>
|
420 |
+
|
421 |
</tr>
|
422 |
+
|
423 |
</table>
|
424 |
+
|
425 |
</div>
|
426 |
+
|
427 |
<?php
|
428 |
+
|
429 |
}
|
430 |
|
431 |
+
|
432 |
+
|
433 |
/**
|
434 |
+
|
435 |
* It will add the setting for Text displayed below heading section on the add to cart modal settings page.
|
436 |
+
|
437 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
438 |
+
|
439 |
* @since 6.0
|
440 |
+
|
441 |
*/
|
442 |
+
|
443 |
public static function wcap_add_text_section( $wcap_disabled_field ) {
|
444 |
+
|
445 |
?>
|
446 |
+
|
447 |
<div id = "wcap_text_section_div" class = "wcap_text_section_div wcap_atc_between_fields_space">
|
448 |
+
|
449 |
<table id = "wcap_text_section_table" class = "wcap_text_section_table">
|
450 |
+
|
451 |
<th id = "wcap_text_section_table_heading" class = "wcap_text_section_table_heading"> Modal Text </th>
|
452 |
+
|
453 |
<tr id = "wcap_text_section_tr" class = "wcap_text_section_tr" >
|
454 |
+
|
455 |
<td id = "wcap_text_section_text_field" class = "wcap_text_section_text_field test_borders">
|
456 |
+
|
457 |
<input id = "wcap_text_section_text" v-model = "wcap_text_section_text_field" class="wcap_text_section_input_text" name = "wcap_text_section_text"
|
458 |
+
|
459 |
<?php echo $wcap_disabled_field; ?> readonly value="<?php _e( 'To add this item to your cart, please enter your email address.','woocommerce-abandoned-cart' ); ?>">
|
460 |
+
|
461 |
+
</td>
|
462 |
+
|
463 |
<td id = "wcap_text_section_field_color" class = "wcap_text_section_field_color test_borders">
|
464 |
+
|
465 |
<?php $wcap_atc_popup_text_color = get_option( 'wcap_popup_text_color_picker' ); ?>
|
466 |
+
|
467 |
<span class = "colorpickpreview" style = "background:<?php echo $wcap_atc_popup_text_color; ?>"></span>
|
468 |
+
|
469 |
<input class = "wcap_popup_text_color_picker colorpick" name = "wcap_popup_text_color_picker" value = "#bbc9d2" v-model = "wcap_popup_text_color" v-on:input = "wcap_atc_popup_text.color = $event.target.value"
|
470 |
+
|
471 |
<?php echo $wcap_disabled_field; ?> readonly>
|
472 |
+
|
473 |
</td>
|
474 |
+
|
475 |
</tr>
|
476 |
+
|
477 |
</table>
|
478 |
+
|
479 |
</div>
|
480 |
+
|
481 |
<?php
|
482 |
+
|
483 |
}
|
484 |
|
485 |
+
|
486 |
+
|
487 |
/**
|
488 |
+
|
489 |
* It will add the setting for email placeholder on the add to cart modal settings page.
|
490 |
+
|
491 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
492 |
+
|
493 |
* @since 6.0
|
494 |
+
|
495 |
*/
|
496 |
+
|
497 |
public static function wcap_email_placeholder_section( $wcap_disabled_field ) {
|
498 |
+
|
499 |
?>
|
500 |
+
|
501 |
<div id = "wcap_email_placeholder_section_div" class = "wcap_email_placeholder_section_div wcap_atc_between_fields_space">
|
502 |
+
|
503 |
<table id = "wcap_email_placeholder_section_table" class = "wcap_email_placeholder_section_table">
|
504 |
+
|
505 |
<th id = "wcap_email_placeholder_section_table_heading" class = "wcap_email_placeholder_section_table_heading"> Email placeholder </th>
|
506 |
+
|
507 |
<tr id = "wcap_email_placeholder_section_tr" class = "wcap_email_placeholder_section_tr" >
|
508 |
+
|
509 |
<td id = "wcap_email_placeholder_section_text_field" class = "wcap_email_placeholder_section_text_field test_borders">
|
510 |
+
|
511 |
+
<input id = "wcap_email_placeholder_section_input_text" v-model = "wcap_email_placeholder_section_input_text" class="wcap_email_placeholder_section_input_text" name = "wcap_email_placeholder_section_input_text"
|
512 |
+
|
513 |
<?php echo $wcap_disabled_field; ?> readonly value="<?php _e('Email address', 'woocommerce-abandoned-cart' ); ?>">
|
514 |
+
|
515 |
</td>
|
516 |
+
|
517 |
</tr>
|
518 |
+
|
519 |
</table>
|
520 |
+
|
521 |
</div>
|
522 |
+
|
523 |
<?php
|
524 |
+
|
525 |
}
|
526 |
|
527 |
+
|
528 |
+
|
529 |
/**
|
530 |
+
|
531 |
* It will add the setting for Add to cart button on the add to cart modal settings page.
|
532 |
+
|
533 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
534 |
+
|
535 |
* @since 6.0
|
536 |
+
|
537 |
*/
|
538 |
+
|
539 |
public static function wcap_button_section( $wcap_disabled_field ) {
|
540 |
+
|
541 |
?>
|
542 |
+
|
543 |
<div id = "wcap_button_section_div" class = "wcap_button_section_div wcap_atc_between_fields_space">
|
544 |
+
|
545 |
<table id = "wcap_button_section_table" class = "wcap_button_section_table">
|
546 |
+
|
547 |
<th id = "wcap_button_section_table_heading" class="wcap_button_section_table_heading"> Add to cart button text </th>
|
548 |
+
|
549 |
<tr>
|
550 |
+
|
551 |
<td id = "wcap_button_section_text_field" class = "wcap_button_section_text_field test_borders">
|
552 |
+
|
553 |
<input id = "wcap_button_section_input_text" v-model = "wcap_button_section_input_text" class="wcap_button_section_input_text" name = "wcap_button_section_input_text"
|
554 |
+
|
555 |
<?php echo $wcap_disabled_field ; ?> readonly value="<?php _e( 'Add to Cart', 'woocommerce-abandoned-cart' ); ?>">
|
556 |
+
|
557 |
</td>
|
558 |
+
|
559 |
</tr>
|
560 |
+
|
561 |
<tr id = "wcap_button_color_section_tr" class = "wcap_button_color_section_tr">
|
562 |
+
|
563 |
<td id = "wcap_button_color_section_text_field" class = "wcap_button_color_section_text_field test_borders">
|
564 |
+
|
565 |
<?php $wcap_atc_button_bg_color = get_option( 'wcap_button_color_picker' ); ?>
|
566 |
+
|
567 |
<span class = "colorpickpreview" style = "background:<?php echo $wcap_atc_button_bg_color; ?>"></span>
|
568 |
+
|
569 |
<input id = "wcap_button_color_picker" value = "#0085ba" v-model ="wcap_button_bg_color" v-on:input="wcap_atc_button.backgroundColor = $event.target.value" class="wcap_button_color_picker colorpick" name = "wcap_button_color_picker"
|
570 |
+
|
571 |
<?php echo $wcap_disabled_field; ?> readonly >
|
572 |
+
|
573 |
</td>
|
574 |
+
|
575 |
<td id = "wcap_button_text_color_section_text_field" class = "wcap_button_text_color_section_text_field test_borders">
|
576 |
+
|
577 |
<?php $wcap_button_text_color_picker = get_option('wcap_button_text_color_picker'); ?>
|
578 |
+
|
579 |
<span class = "colorpickpreview" style = "background:<?php echo $wcap_button_text_color_picker; ?>"></span>
|
580 |
+
|
581 |
+
<input id = "wcap_button_text_color_picker" value = "#ffffff" v-model = "wcap_button_text_color" v-on:input = "wcap_atc_button.color = $event.target.value" class="wcap_button_text_color_picker colorpick" name = "wcap_button_text_color_picker"
|
582 |
+
|
583 |
<?php echo $wcap_disabled_field; ?> readonly>
|
584 |
+
|
585 |
</td>
|
586 |
+
|
587 |
</tr>
|
588 |
+
|
589 |
</table>
|
590 |
+
|
591 |
</div>
|
592 |
+
|
593 |
<?php
|
594 |
+
|
595 |
}
|
596 |
+
|
597 |
+
|
598 |
+
|
599 |
/**
|
600 |
+
|
601 |
* It will add the setting for Email address mandatory field on the add to cart modal settings page.
|
602 |
+
|
603 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
604 |
+
|
605 |
* @since 6.0
|
606 |
+
|
607 |
*/
|
608 |
+
|
609 |
public static function wcap_mandatory_modal_section( $wcap_disabled_field ) {
|
610 |
+
|
611 |
?>
|
612 |
+
|
613 |
<table class = "wcap_atc_between_fields_space">
|
614 |
+
|
615 |
<th id = "wcap_button_section_table_heading" class = "wcap_button_section_table_heading"> Email address is mandatory ? </th>
|
616 |
+
|
617 |
<tr>
|
618 |
+
|
619 |
<td>
|
620 |
+
|
621 |
+
<?php
|
622 |
+
|
623 |
$wcap_atc_email_mandatory = get_option( 'wcap_atc_mandatory_email' );
|
624 |
+
|
625 |
+
$active_text = $wcap_atc_email_mandatory;
|
626 |
+
|
627 |
?>
|
628 |
+
|
629 |
+
<button type = "button" class = "wcap-switch-atc-modal-mandatory wcap-toggle-atc-modal-mandatory" wcap-atc-switch-modal-mandatory = <?php echo $wcap_atc_email_mandatory; ?>
|
630 |
+
|
631 |
<?php echo $wcap_disabled_field; ?> readonly >
|
632 |
+
|
633 |
<?php echo $active_text; ?> </button>
|
634 |
+
|
635 |
</td>
|
636 |
+
|
637 |
</tr>
|
638 |
+
|
639 |
</table>
|
640 |
+
|
641 |
<?php
|
642 |
+
|
643 |
}
|
644 |
|
645 |
+
|
646 |
+
|
647 |
/**
|
648 |
+
|
649 |
* It will add the setting for Email address non mandatory field on the add to cart modal settings page.
|
650 |
+
|
651 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
652 |
+
|
653 |
* @since 6.0
|
654 |
+
|
655 |
*/
|
656 |
+
|
657 |
public static function wcap_non_mandatory_modal_section_field( $wcap_disabled_field ) {
|
658 |
+
|
659 |
$wcap_get_mandatory_field = get_option( 'wcap_atc_mandatory_email' );
|
660 |
+
|
661 |
$wcap_disabled_email_field = '';
|
662 |
+
|
663 |
if ( 'on' == $wcap_get_mandatory_field ) {
|
664 |
+
|
665 |
$wcap_disabled_email_field = 'disabled="disabled"';
|
666 |
+
|
667 |
}
|
668 |
+
|
669 |
?>
|
670 |
+
|
671 |
<div id = "wcap_non_mandatory_modal_section_fields_div" class = "wcap_non_mandatory_modal_section_fields_div wcap_atc_between_fields_space">
|
672 |
+
|
673 |
<table id = "wcap_non_mandatory_modal_section_fields_div_table" class = "wcap_non_mandatory_modal_section_fields_div_table">
|
674 |
+
|
675 |
+
<th id = "wcap_non_mandatory_modal_section_fields_table_heading"
|
676 |
+
|
677 |
class="wcap_non_mandatory_modal_section_fields_table_heading"> Not mandatory text </th>
|
678 |
+
|
679 |
<tr id = "wcap_non_mandatory_modal_section_fields_tr" class = "wcap_non_mandatory_modal_section_fields_tr" >
|
680 |
+
|
681 |
<td id = "wcap_non_mandatory_modal_section_fields_text_field" class = "wcap_non_mandatory_modal_section_fields_text_field test_borders">
|
682 |
+
|
683 |
<input id = "wcap_non_mandatory_modal_section_fields_input_text" v-model = "wcap_non_mandatory_modal_input_text" class = "wcap_non_mandatory_modal_section_fields_input_text" name = "wcap_non_mandatory_modal_section_fields_input_text" readonly value="<?php _e( 'No Thanks', 'woocommerce-abandoned-cart' ); ?>"
|
684 |
+
|
685 |
+
<?php echo $wcap_disabled_field;
|
686 |
+
|
687 |
echo $wcap_disabled_email_field;
|
688 |
+
|
689 |
?> >
|
690 |
+
|
691 |
</td>
|
692 |
+
|
693 |
</tr>
|
694 |
+
|
695 |
</table>
|
696 |
+
|
697 |
</div>
|
698 |
+
|
699 |
<?php
|
700 |
+
|
701 |
}
|
702 |
|
703 |
+
|
704 |
+
|
705 |
/**
|
706 |
+
|
707 |
* It will will show th preview of the Add To cart Popup modal with the changes made on any of the settings for it.
|
708 |
+
|
709 |
* @param string $wcap_disabled_field It will indicate if field need to be disabled or not.
|
710 |
+
|
711 |
* @since 6.0
|
712 |
+
|
713 |
*/
|
714 |
+
|
715 |
public static function wcap_add_to_cart_popup_modal_preview( $wcap_disabled_field ) {
|
716 |
+
|
717 |
+
|
718 |
+
|
719 |
?>
|
720 |
+
|
721 |
<div class = "wcap_container">
|
722 |
+
|
723 |
<div class = "wcap_popup_wrapper">
|
724 |
+
|
725 |
<div class = "wcap_popup_content">
|
726 |
+
|
727 |
<div class = "wcap_popup_heading_container">
|
728 |
+
|
729 |
<div class = "wcap_popup_icon_container" >
|
730 |
+
|
731 |
<span class = "wcap_popup_icon" >
|
732 |
+
|
733 |
<span class = "wcap_popup_plus_sign" v-bind:style = "wcap_atc_button">
|
734 |
+
|
735 |
</span>
|
736 |
+
|
737 |
</span>
|
738 |
+
|
739 |
</div>
|
740 |
+
|
741 |
<div class = "wcap_popup_text_container">
|
742 |
+
|
743 |
<h2 class = "wcap_popup_heading" v-bind:style = "wcap_atc_popup_heading" ><?php _e( 'Please enter your email address.', 'woocommerce-abandoned-cart' ); ?></h2>
|
744 |
+
|
745 |
<div class = "wcap_popup_text" v-bind:style = "wcap_atc_popup_text" ><?php _e( 'To add this item to your cart, please enter your email address.', 'woocommerce-abandoned-cart' ); ?></div>
|
746 |
+
|
747 |
</div>
|
748 |
+
|
749 |
</div>
|
750 |
+
|
751 |
<div class = "wcap_popup_form">
|
752 |
+
|
753 |
<form action = "" name = "wcap_modal_form">
|
754 |
+
|
755 |
<div class = "wcap_popup_input_field_container" >
|
756 |
+
|
757 |
<input class = "wcap_popup_input" type = "text" value = "" name = "email" placeholder ="<?php _e( 'Email address', 'woocommerce-abandoned-cart' ); ?>"
|
758 |
+
|
759 |
<?php echo $wcap_disabled_field; ?> readonly >
|
760 |
+
|
761 |
</div>
|
762 |
+
|
763 |
<button class = "wcap_popup_button" v-bind:style = "wcap_atc_button"
|
764 |
+
|
765 |
<?php echo $wcap_disabled_field ; ?> ><?php _e( 'Add to Cart', 'woocommerce-abandoned-cart' ); ?></button>
|
766 |
+
|
767 |
<br>
|
768 |
+
|
769 |
<br>
|
770 |
+
|
771 |
<div id = "wcap_non_mandatory_text_wrapper" class = "wcap_non_mandatory_text_wrapper">
|
772 |
+
|
773 |
<a class = "wcap_popup_non_mandatory_button" href = "" > <?php _e( 'No Thanks', 'woocommerce-abandoned-cart' ); ?></a>
|
774 |
+
|
775 |
</div>
|
776 |
+
|
777 |
</form>
|
778 |
+
|
779 |
</div>
|
780 |
+
|
781 |
<div class = "wcap_popup_close" ></div>
|
782 |
+
|
783 |
</div>
|
784 |
+
|
785 |
</div>
|
786 |
+
|
787 |
</div>
|
788 |
+
|
789 |
<?php
|
790 |
+
|
791 |
}
|
792 |
+
|
793 |
}
|
794 |
+
|
795 |
}
|
796 |
+
|
includes/admin/wcap_pro_settings.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
* Display all the settings in PRO
|
6 |
|
7 |
-
*
|
8 |
|
9 |
* @since 2.4
|
10 |
|
@@ -22,7 +22,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
22 |
|
23 |
class WCAP_Pro_Settings {
|
24 |
|
25 |
-
|
26 |
|
27 |
/**
|
28 |
|
@@ -36,13 +36,13 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
36 |
|
37 |
|
38 |
|
39 |
-
add_action( 'admin_init', array( &$this, 'wcal_pro_settings' ) );
|
40 |
|
41 |
add_action( 'wcal_add_new_settings', array(&$this, 'wcap_pro_general_settings' ) );
|
42 |
|
43 |
}
|
44 |
|
45 |
-
|
46 |
|
47 |
static function wcap_atc_settings() {
|
48 |
|
@@ -53,7 +53,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
53 |
wp_enqueue_style( 'wcap_add_to_cart_popup_modal', WCAL_PLUGIN_URL . '/assets/css/admin/wcap_add_to_cart_popup_modal.min.css' );
|
54 |
|
55 |
|
56 |
-
$purchase_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro
|
57 |
|
58 |
?>
|
59 |
|
@@ -61,7 +61,10 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
61 |
|
62 |
<p style="font-size:15px;">
|
63 |
|
64 |
-
<b><i><?php
|
|
|
|
|
|
|
65 |
|
66 |
</p>
|
67 |
|
@@ -76,12 +79,12 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
76 |
|
77 |
|
78 |
static function wcap_fb_settings() {
|
79 |
-
|
80 |
?>
|
81 |
|
82 |
<form method="post" action="options.php">
|
83 |
|
84 |
-
<?php
|
85 |
|
86 |
//settings_errors();
|
87 |
|
@@ -89,7 +92,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
89 |
|
90 |
do_settings_sections( 'woocommerce_ac_fb_page' );
|
91 |
|
92 |
-
submit_button();
|
93 |
|
94 |
?>
|
95 |
|
@@ -105,25 +108,8 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
105 |
|
106 |
|
107 |
|
108 |
-
$upgrade_pro_msg = '<br><b><i>Upgrade to <a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/" target="_blank">Abandoned Cart Pro for WooCommerce</a> to enable the setting.</i></b>';
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
add_settings_field(
|
113 |
-
|
114 |
-
'ac_enable_cart_emails',
|
115 |
-
|
116 |
-
__( 'Enable abandoned cart emails', 'woocommerce-abandoned-cart' ),
|
117 |
-
|
118 |
-
array( 'WCAP_Pro_Settings_Callbacks', 'wcap_enable_cart_emails_callback' ),
|
119 |
-
|
120 |
-
'woocommerce_ac_page',
|
121 |
-
|
122 |
-
'ac_lite_general_settings_section',
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
);
|
127 |
|
128 |
add_settings_field(
|
129 |
|
@@ -137,7 +123,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
137 |
|
138 |
'ac_lite_general_settings_section',
|
139 |
|
140 |
-
array( __( "For guest users & visitors consider cart abandoned after X minutes of item being added to cart & order not placed
|
141 |
|
142 |
);
|
143 |
|
@@ -155,7 +141,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
155 |
|
156 |
'ac_lite_general_settings_section',
|
157 |
|
158 |
-
array( __( "Abandoned carts of guest users will not be tracked
|
159 |
|
160 |
);
|
161 |
|
@@ -173,7 +159,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
173 |
|
174 |
'ac_lite_general_settings_section',
|
175 |
|
176 |
-
array( __( "Abandoned carts of logged-in users will not be tracked
|
177 |
|
178 |
);
|
179 |
|
@@ -191,7 +177,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
191 |
|
192 |
'ac_lite_general_settings_section',
|
193 |
|
194 |
-
array( __( "If your site URL contain the same key, then it will capture it as an email address of customer
|
195 |
|
196 |
);
|
197 |
|
@@ -205,7 +191,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
205 |
|
206 |
);
|
207 |
|
208 |
-
|
209 |
|
210 |
register_setting(
|
211 |
|
@@ -243,7 +229,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
243 |
|
244 |
);
|
245 |
|
246 |
-
|
247 |
|
248 |
add_settings_field(
|
249 |
|
@@ -257,11 +243,11 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
257 |
|
258 |
'ac_email_settings_section',
|
259 |
|
260 |
-
array( "This setting affects the dimension of the product image in the abandoned cart reminder email
|
261 |
|
262 |
);
|
263 |
|
264 |
-
|
265 |
|
266 |
register_setting(
|
267 |
|
@@ -299,7 +285,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
299 |
|
300 |
'ac_cron_job_settings_section',
|
301 |
|
302 |
-
array( "Enabling this setting will send the abandoned cart reminder emails to the customer after the set time. If disabled, abandoned cart reminder emails will not be sent using WP Cron. You will need to set cron job manually from cPanel. If you are unsure how to set the cron job, please <a href= mailto:support@tychesoftwares.com>contact us</a> for it
|
303 |
|
304 |
);
|
305 |
|
@@ -317,7 +303,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
317 |
|
318 |
'ac_cron_job_settings_section',
|
319 |
|
320 |
-
array( "The duration in minutes after which a WP Cron job will run automatically for sending the abandoned cart reminder emails & SMS to the customers
|
321 |
|
322 |
);
|
323 |
|
@@ -349,7 +335,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
349 |
|
350 |
'ac_restrict_settings_section',
|
351 |
|
352 |
-
array( "The carts abandoned from these IP addresses will not be tracked by the plugin. Accepts wildcards, e.g <code>192.168.*</code> will block all IP addresses which starts from \"192.168\". <i>Separate IP addresses with commas.</i
|
353 |
|
354 |
);
|
355 |
|
@@ -367,7 +353,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
367 |
|
368 |
'ac_restrict_settings_section',
|
369 |
|
370 |
-
array( "The carts abandoned using these email addresses will not be tracked by the plugin. <i>Separate email addresses with commas.</i
|
371 |
|
372 |
);
|
373 |
|
@@ -385,7 +371,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
385 |
|
386 |
'ac_restrict_settings_section',
|
387 |
|
388 |
-
array( "The carts abandoned from email addresses with these domains will not be tracked by the plugin. <i>Separate email address domains with commas.</i
|
389 |
|
390 |
);
|
391 |
|
@@ -399,14 +385,14 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
399 |
?>
|
400 |
|
401 |
<form method="post" action="options.php">
|
402 |
-
|
403 |
-
<?php
|
404 |
|
405 |
settings_fields ( 'woocommerce_sms_settings' );
|
406 |
|
407 |
do_settings_sections( 'woocommerce_ac_sms_page' );
|
408 |
|
409 |
-
submit_button();
|
410 |
|
411 |
?>
|
412 |
|
@@ -452,17 +438,17 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
452 |
|
453 |
</div>
|
454 |
|
455 |
-
<?php
|
456 |
|
457 |
}
|
458 |
|
459 |
-
|
460 |
|
461 |
function wcal_pro_settings() {
|
462 |
|
463 |
|
464 |
|
465 |
-
$upgrade_pro_msg = '<br><b><i>Upgrade to <a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro
|
466 |
|
467 |
/**
|
468 |
|
@@ -482,7 +468,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
482 |
|
483 |
);
|
484 |
|
485 |
-
|
486 |
|
487 |
add_settings_field(
|
488 |
|
@@ -496,11 +482,11 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
496 |
|
497 |
'wcap_sms_settings_section',
|
498 |
|
499 |
-
array( "<i>Enable the ability to send reminder SMS for abandoned carts.</i
|
500 |
|
501 |
);
|
502 |
|
503 |
-
|
504 |
|
505 |
add_settings_field(
|
506 |
|
@@ -514,11 +500,11 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
514 |
|
515 |
'wcap_sms_settings_section',
|
516 |
|
517 |
-
array( "<i>Must be a Twilio phone number (in E.164 format) or alphanumeric sender ID.</i
|
518 |
|
519 |
);
|
520 |
|
521 |
-
|
522 |
|
523 |
add_settings_field(
|
524 |
|
@@ -532,11 +518,11 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
532 |
|
533 |
'wcap_sms_settings_section',
|
534 |
|
535 |
-
array(
|
536 |
|
537 |
);
|
538 |
|
539 |
-
|
540 |
|
541 |
add_settings_field(
|
542 |
|
@@ -550,7 +536,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
550 |
|
551 |
'wcap_sms_settings_section',
|
552 |
|
553 |
-
array(
|
554 |
|
555 |
);
|
556 |
|
@@ -566,7 +552,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
566 |
|
567 |
);
|
568 |
|
569 |
-
|
570 |
|
571 |
register_setting(
|
572 |
|
@@ -576,7 +562,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
576 |
|
577 |
);
|
578 |
|
579 |
-
|
580 |
|
581 |
register_setting(
|
582 |
|
@@ -586,7 +572,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
586 |
|
587 |
);
|
588 |
|
589 |
-
|
590 |
|
591 |
register_setting(
|
592 |
|
@@ -624,7 +610,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
624 |
|
625 |
'wcap_fb_settings_section',
|
626 |
|
627 |
-
array( "<i>This option will display a checkbox after the Add to cart button for user consent to connect with Facebook.</i
|
628 |
|
629 |
);
|
630 |
|
@@ -642,7 +628,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
642 |
|
643 |
'wcap_fb_settings_section',
|
644 |
|
645 |
-
array( "<i>This option will display a checkbox on the pop-up modal to connect with Facebook.</i
|
646 |
|
647 |
);
|
648 |
|
@@ -660,15 +646,13 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
660 |
|
661 |
'wcap_fb_settings_section',
|
662 |
|
663 |
-
array(
|
664 |
|
665 |
-
"<i>Select the size of user icon which shall be displayed below the checkbox in case the user is logged in.</i
|
666 |
-
|
667 |
-
'woocommerce-abandoned-cart',
|
668 |
|
669 |
'wcap_fb_user_icon',
|
670 |
|
671 |
-
array(
|
672 |
|
673 |
'small' => __( 'Small', 'woocommerce-abandoned-cart' ),
|
674 |
|
@@ -680,7 +664,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
680 |
|
681 |
'xlarge' => __( 'Extra Large', 'woocommerce-abandoned-cart' )
|
682 |
|
683 |
-
)
|
684 |
|
685 |
)
|
686 |
|
@@ -700,7 +684,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
700 |
|
701 |
'wcap_fb_settings_section',
|
702 |
|
703 |
-
array( "<i>Text that will appear above the consent checkbox. HTML tags are also allowed.</i
|
704 |
|
705 |
);
|
706 |
|
@@ -718,7 +702,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
718 |
|
719 |
'wcap_fb_settings_section',
|
720 |
|
721 |
-
array( "<i>Facebook Page ID in numberic format. You can find your page ID from <a href='https://www.tychesoftwares.com/docs/docs/abandoned-cart-pro-for-woocommerce/send-abandoned-cart-reminder-notifications-using-facebook-messenger#fbpageid' target='_blank'>here</a></i
|
722 |
|
723 |
);
|
724 |
|
@@ -736,7 +720,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
736 |
|
737 |
'wcap_fb_settings_section',
|
738 |
|
739 |
-
array( "<i>Enter your Messenger App ID</i
|
740 |
|
741 |
);
|
742 |
|
@@ -754,7 +738,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
754 |
|
755 |
'wcap_fb_settings_section',
|
756 |
|
757 |
-
array( "<i>Enter your Facebook Page Token</i
|
758 |
|
759 |
);
|
760 |
|
@@ -772,7 +756,7 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
772 |
|
773 |
'wcap_fb_settings_section',
|
774 |
|
775 |
-
array( "<i>Enter your Verify Token</i
|
776 |
|
777 |
);
|
778 |
|
@@ -858,94 +842,6 @@ if ( ! class_exists('WCAP_Pro_Settings' ) ) {
|
|
858 |
|
859 |
}
|
860 |
|
861 |
-
|
862 |
-
|
863 |
-
public static function wcap_add_to_cart_popup_settings() {
|
864 |
-
|
865 |
-
$wcap_atc_enabled = get_option( 'wcap_atc_enable_modal' );
|
866 |
-
|
867 |
-
$wcap_disabled_field = '';
|
868 |
-
|
869 |
-
if ( 'off' == $wcap_atc_enabled ) {
|
870 |
-
|
871 |
-
$wcap_disabled_field = 'disabled="disabled"';
|
872 |
-
|
873 |
-
}
|
874 |
-
|
875 |
-
?>
|
876 |
-
|
877 |
-
<div id = "wcap_popup_main_div" class = "wcap_popup_main_div ">
|
878 |
-
|
879 |
-
<table id = "wcap_popup_main_table" class = "wcap_popup_main_table test_borders">
|
880 |
-
|
881 |
-
<tr id = "wcap_popup_main_table_tr" class = "wcap_popup_main_table_tr test_borders">
|
882 |
-
|
883 |
-
<td id = "wcap_popup_main_table_td_settings" class = "wcap_popup_main_table_td_settings test_borders">
|
884 |
-
|
885 |
-
<?php Wcap_Add_Cart_Popup_Modal::wcap_enable_modal_section( $wcap_disabled_field ); ?>
|
886 |
-
|
887 |
-
<?php self::wcap_custom_pages_section( $wcap_disabled_field ); ?>
|
888 |
-
|
889 |
-
<div class = "wcap_atc_all_fields_container" >
|
890 |
-
|
891 |
-
<?php Wcap_Add_Cart_Popup_Modal::wcap_add_heading_section( $wcap_disabled_field ); ?>
|
892 |
-
|
893 |
-
<?php Wcap_Add_Cart_Popup_Modal::wcap_add_text_section( $wcap_disabled_field ); ?>
|
894 |
-
|
895 |
-
<?php Wcap_Add_Cart_Popup_Modal::wcap_email_placeholder_section( $wcap_disabled_field ); ?>
|
896 |
-
|
897 |
-
<?php Wcap_Add_Cart_Popup_Modal::wcap_button_section( $wcap_disabled_field ); ?>
|
898 |
-
|
899 |
-
<?php Wcap_Add_Cart_Popup_Modal::wcap_mandatory_modal_section( $wcap_disabled_field ); ?>
|
900 |
-
|
901 |
-
<?php Wcap_Add_Cart_Popup_Modal::wcap_non_mandatory_modal_section_field( $wcap_disabled_field ); ?>
|
902 |
-
|
903 |
-
</div>
|
904 |
-
|
905 |
-
</td>
|
906 |
-
|
907 |
-
<td id = "wcap_popup_main_table_td_preview" class = "wcap_popup_main_table_td_preview test_borders">
|
908 |
-
|
909 |
-
<div class = "wcap_atc_all_fields_container" >
|
910 |
-
|
911 |
-
<?php Wcap_Add_Cart_Popup_Modal::wcap_add_to_cart_popup_modal_preview( $wcap_disabled_field ); ?>
|
912 |
-
|
913 |
-
</div>
|
914 |
-
|
915 |
-
</td>
|
916 |
-
|
917 |
-
</tr>
|
918 |
-
|
919 |
-
<tr>
|
920 |
-
|
921 |
-
<td>
|
922 |
-
|
923 |
-
<div class = "wcap_atc_all_fields_container" >
|
924 |
-
|
925 |
-
<p class = "submit">
|
926 |
-
|
927 |
-
<input type = "submit" name = "submit" id = "submit" class = "button button-primary" value = "Save Changes" <?php echo $wcap_disabled_field; ?> >
|
928 |
-
|
929 |
-
<input type = "submit" name = "submit" id = "submit" class = "wcap_reset_button button button-primary" value = "Reset to default configuration" <?php echo $wcap_disabled_field; ?> >
|
930 |
-
|
931 |
-
</p>
|
932 |
-
|
933 |
-
</div>
|
934 |
-
|
935 |
-
</td>
|
936 |
-
|
937 |
-
</tr>
|
938 |
-
|
939 |
-
</table>
|
940 |
-
|
941 |
-
</div>
|
942 |
-
|
943 |
-
<?php
|
944 |
-
|
945 |
-
}
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
} // end of class
|
950 |
|
951 |
$WCAP_Pro_Settings = new WCAP_Pro_Settings();
|
4 |
|
5 |
* Display all the settings in PRO
|
6 |
|
7 |
+
*
|
8 |
|
9 |
* @since 2.4
|
10 |
|
22 |
|
23 |
class WCAP_Pro_Settings {
|
24 |
|
25 |
+
|
26 |
|
27 |
/**
|
28 |
|
36 |
|
37 |
|
38 |
|
39 |
+
add_action( 'admin_init', array( &$this, 'wcal_pro_settings' ) );
|
40 |
|
41 |
add_action( 'wcal_add_new_settings', array(&$this, 'wcap_pro_general_settings' ) );
|
42 |
|
43 |
}
|
44 |
|
45 |
+
|
46 |
|
47 |
static function wcap_atc_settings() {
|
48 |
|
53 |
wp_enqueue_style( 'wcap_add_to_cart_popup_modal', WCAL_PLUGIN_URL . '/assets/css/admin/wcap_add_to_cart_popup_modal.min.css' );
|
54 |
|
55 |
|
56 |
+
$purchase_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=acupgradetopro&utm_medium=link&utm_campaign=AbandonCartLite';
|
57 |
|
58 |
?>
|
59 |
|
61 |
|
62 |
<p style="font-size:15px;">
|
63 |
|
64 |
+
<b><i><?php
|
65 |
+
/* translators: %s Purchase Link */
|
66 |
+
printf( __( "Upgrade to <a href='%s' target='_blank'>Abandoned Cart Pro for WooCommerce</a> to enable the feature.", 'woocommerce-abandoned-cart' ), $purchase_link);
|
67 |
+
?></i></b>
|
68 |
|
69 |
</p>
|
70 |
|
79 |
|
80 |
|
81 |
static function wcap_fb_settings() {
|
82 |
+
|
83 |
?>
|
84 |
|
85 |
<form method="post" action="options.php">
|
86 |
|
87 |
+
<?php
|
88 |
|
89 |
//settings_errors();
|
90 |
|
92 |
|
93 |
do_settings_sections( 'woocommerce_ac_fb_page' );
|
94 |
|
95 |
+
submit_button( __( 'Save Changes', 'woocommerce-abandoned-cart' ), 'primary', 'submit', true, array( 'disabled' => 'disabled' ) );
|
96 |
|
97 |
?>
|
98 |
|
108 |
|
109 |
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
+
$upgrade_pro_msg = '<br><b><i>Upgrade to <a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=acupgradetopro&utm_medium=link&utm_campaign=AbandonCartLite" target="_blank">Abandoned Cart Pro for WooCommerce</a> to enable the setting.</i></b>';
|
|
|
|
|
113 |
|
114 |
add_settings_field(
|
115 |
|
123 |
|
124 |
'ac_lite_general_settings_section',
|
125 |
|
126 |
+
array( __( "For guest users & visitors consider cart abandoned after X minutes of item being added to cart & order not placed.", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
127 |
|
128 |
);
|
129 |
|
141 |
|
142 |
'ac_lite_general_settings_section',
|
143 |
|
144 |
+
array( __( "Abandoned carts of guest users will not be tracked.", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
145 |
|
146 |
);
|
147 |
|
159 |
|
160 |
'ac_lite_general_settings_section',
|
161 |
|
162 |
+
array( __( "Abandoned carts of logged-in users will not be tracked.", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
163 |
|
164 |
);
|
165 |
|
177 |
|
178 |
'ac_lite_general_settings_section',
|
179 |
|
180 |
+
array( __( "If your site URL contain the same key, then it will capture it as an email address of customer.", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
181 |
|
182 |
);
|
183 |
|
191 |
|
192 |
);
|
193 |
|
194 |
+
|
195 |
|
196 |
register_setting(
|
197 |
|
229 |
|
230 |
);
|
231 |
|
232 |
+
|
233 |
|
234 |
add_settings_field(
|
235 |
|
243 |
|
244 |
'ac_email_settings_section',
|
245 |
|
246 |
+
array( __( "This setting affects the dimension of the product image in the abandoned cart reminder email.", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
247 |
|
248 |
);
|
249 |
|
250 |
+
|
251 |
|
252 |
register_setting(
|
253 |
|
285 |
|
286 |
'ac_cron_job_settings_section',
|
287 |
|
288 |
+
array( __( "Enabling this setting will send the abandoned cart reminder emails to the customer after the set time. If disabled, abandoned cart reminder emails will not be sent using WP Cron. You will need to set cron job manually from cPanel. If you are unsure how to set the cron job, please <a href= mailto:support@tychesoftwares.com>contact us</a> for it.", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
289 |
|
290 |
);
|
291 |
|
303 |
|
304 |
'ac_cron_job_settings_section',
|
305 |
|
306 |
+
array( __( "The duration in minutes after which a WP Cron job will run automatically for sending the abandoned cart reminder emails & SMS to the customers.", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
307 |
|
308 |
);
|
309 |
|
335 |
|
336 |
'ac_restrict_settings_section',
|
337 |
|
338 |
+
array( __( "The carts abandoned from these IP addresses will not be tracked by the plugin. Accepts wildcards, e.g <code>192.168.*</code> will block all IP addresses which starts from \"192.168\". <i>Separate IP addresses with commas.</i>", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
339 |
|
340 |
);
|
341 |
|
353 |
|
354 |
'ac_restrict_settings_section',
|
355 |
|
356 |
+
array( __( "The carts abandoned using these email addresses will not be tracked by the plugin. <i>Separate email addresses with commas.</i>", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
357 |
|
358 |
);
|
359 |
|
371 |
|
372 |
'ac_restrict_settings_section',
|
373 |
|
374 |
+
array( __( "The carts abandoned from email addresses with these domains will not be tracked by the plugin. <i>Separate email address domains with commas.</i>", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
375 |
|
376 |
);
|
377 |
|
385 |
?>
|
386 |
|
387 |
<form method="post" action="options.php">
|
388 |
+
|
389 |
+
<?php
|
390 |
|
391 |
settings_fields ( 'woocommerce_sms_settings' );
|
392 |
|
393 |
do_settings_sections( 'woocommerce_ac_sms_page' );
|
394 |
|
395 |
+
submit_button( __( 'Save Changes', 'woocommerce-abandoned-cart' ), 'primary', 'submit', true, array( 'disabled' => 'disabled' ) );
|
396 |
|
397 |
?>
|
398 |
|
438 |
|
439 |
</div>
|
440 |
|
441 |
+
<?php
|
442 |
|
443 |
}
|
444 |
|
445 |
+
|
446 |
|
447 |
function wcal_pro_settings() {
|
448 |
|
449 |
|
450 |
|
451 |
+
$upgrade_pro_msg = '<br><b><i>Upgrade to <a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=acupgradetopro&utm_medium=link&utm_campaign=AbandonCartLite" target="_blank">Abandoned Cart Pro for WooCommerce</a> to enable the setting.</i></b>';
|
452 |
|
453 |
/**
|
454 |
|
468 |
|
469 |
);
|
470 |
|
471 |
+
|
472 |
|
473 |
add_settings_field(
|
474 |
|
482 |
|
483 |
'wcap_sms_settings_section',
|
484 |
|
485 |
+
array( __( "<i>Enable the ability to send reminder SMS for abandoned carts.</i>", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
486 |
|
487 |
);
|
488 |
|
489 |
+
|
490 |
|
491 |
add_settings_field(
|
492 |
|
500 |
|
501 |
'wcap_sms_settings_section',
|
502 |
|
503 |
+
array( __( "<i>Must be a Twilio phone number (in E.164 format) or alphanumeric sender ID.</i>", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg )
|
504 |
|
505 |
);
|
506 |
|
507 |
+
|
508 |
|
509 |
add_settings_field(
|
510 |
|
518 |
|
519 |
'wcap_sms_settings_section',
|
520 |
|
521 |
+
array( $upgrade_pro_msg )
|
522 |
|
523 |
);
|
524 |
|
525 |
+
|
526 |
|
527 |
add_settings_field(
|
528 |
|
536 |
|
537 |
'wcap_sms_settings_section',
|
538 |
|
539 |
+
array( $upgrade_pro_msg )
|
540 |
|
541 |
);
|
542 |
|
552 |
|
553 |
);
|
554 |
|
555 |
+
|
556 |
|
557 |
register_setting(
|
558 |
|
562 |
|
563 |
);
|
564 |
|
565 |
+
|
566 |
|
567 |
register_setting(
|
568 |
|
572 |
|
573 |
);
|
574 |
|
575 |
+
|
576 |
|
577 |
register_setting(
|
578 |
|
610 |
|
611 |
'wcap_fb_settings_section',
|
612 |
|
613 |
+
array( __( "<i>This option will display a checkbox after the Add to cart button for user consent to connect with Facebook.</i>", 'woocommerce-abandoned-cart', 'wcap_enable_fb_reminders' ) . $upgrade_pro_msg )
|
614 |
|
615 |
);
|
616 |
|
628 |
|
629 |
'wcap_fb_settings_section',
|
630 |
|
631 |
+
array( __( "<i>This option will display a checkbox on the pop-up modal to connect with Facebook.</i>", 'woocommerce-abandoned-cart', 'wcap_enable_fb_reminders_popup' ) . $upgrade_pro_msg )
|
632 |
|
633 |
);
|
634 |
|
646 |
|
647 |
'wcap_fb_settings_section',
|
648 |
|
649 |
+
array(
|
650 |
|
651 |
+
__( "<i>Select the size of user icon which shall be displayed below the checkbox in case the user is logged in.</i>", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg,
|
|
|
|
|
652 |
|
653 |
'wcap_fb_user_icon',
|
654 |
|
655 |
+
array(
|
656 |
|
657 |
'small' => __( 'Small', 'woocommerce-abandoned-cart' ),
|
658 |
|
664 |
|
665 |
'xlarge' => __( 'Extra Large', 'woocommerce-abandoned-cart' )
|
666 |
|
667 |
+
)
|
668 |
|
669 |
)
|
670 |
|
684 |
|
685 |
'wcap_fb_settings_section',
|
686 |
|
687 |
+
array( __( "<i>Text that will appear above the consent checkbox. HTML tags are also allowed.</i>", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg, 'wcap_fb_consent_text' )
|
688 |
|
689 |
);
|
690 |
|
702 |
|
703 |
'wcap_fb_settings_section',
|
704 |
|
705 |
+
array( __( "<i>Facebook Page ID in numberic format. You can find your page ID from <a href='https://www.tychesoftwares.com/docs/docs/abandoned-cart-pro-for-woocommerce/send-abandoned-cart-reminder-notifications-using-facebook-messenger#fbpageid' target='_blank'>here</a></i>", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg, 'wcap_fb_page_id' )
|
706 |
|
707 |
);
|
708 |
|
720 |
|
721 |
'wcap_fb_settings_section',
|
722 |
|
723 |
+
array( __( "<i>Enter your Messenger App ID</i>", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg, 'wcap_fb_app_id' )
|
724 |
|
725 |
);
|
726 |
|
738 |
|
739 |
'wcap_fb_settings_section',
|
740 |
|
741 |
+
array( __( "<i>Enter your Facebook Page Token</i>", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg, 'wcap_fb_page_token' )
|
742 |
|
743 |
);
|
744 |
|
756 |
|
757 |
'wcap_fb_settings_section',
|
758 |
|
759 |
+
array( __( "<i>Enter your Verify Token</i>", 'woocommerce-abandoned-cart' ) . $upgrade_pro_msg, 'wcap_fb_verify_token' )
|
760 |
|
761 |
);
|
762 |
|
842 |
|
843 |
}
|
844 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
845 |
} // end of class
|
846 |
|
847 |
$WCAP_Pro_Settings = new WCAP_Pro_Settings();
|
includes/admin/wcap_pro_settings_callbacks.php
CHANGED
@@ -189,7 +189,13 @@ if ( ! class_exists('WCAP_Pro_Settings_Callbacks' ) ) {
|
|
189 |
|
190 |
|
191 |
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
|
195 |
|
@@ -200,12 +206,11 @@ if ( ! class_exists('WCAP_Pro_Settings_Callbacks' ) ) {
|
|
200 |
}
|
201 |
|
202 |
|
203 |
-
|
204 |
-
$html = "<input type='checkbox' id='$args[2]' name='$args[2]' value='on' " . checked( 'on', $checkbox_value, false ) . " readonly disabled/>";
|
205 |
|
206 |
|
207 |
|
208 |
-
$html .= '<label for="$
|
209 |
|
210 |
|
211 |
|
@@ -219,11 +224,14 @@ if ( ! class_exists('WCAP_Pro_Settings_Callbacks' ) ) {
|
|
219 |
|
220 |
|
221 |
|
222 |
-
$saved_value = get_option( $args[2] );
|
223 |
|
224 |
|
225 |
-
|
226 |
-
|
|
|
|
|
|
|
227 |
|
228 |
|
229 |
|
@@ -239,17 +247,20 @@ if ( ! class_exists('WCAP_Pro_Settings_Callbacks' ) ) {
|
|
239 |
|
240 |
|
241 |
|
242 |
-
$selected_value = get_option( $args[2] );
|
243 |
|
244 |
$selected = '';
|
245 |
|
246 |
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
|
|
|
|
|
|
253 |
|
254 |
$selected = $selected_value === $key ? 'selected="selected"' : '';
|
255 |
|
@@ -257,8 +268,6 @@ if ( ! class_exists('WCAP_Pro_Settings_Callbacks' ) ) {
|
|
257 |
|
258 |
}
|
259 |
|
260 |
-
|
261 |
-
|
262 |
$html .= "</select>";
|
263 |
|
264 |
$html .= '<label for="$args[2]"> ' . $args[0] . '</label>';
|
@@ -267,36 +276,6 @@ if ( ! class_exists('WCAP_Pro_Settings_Callbacks' ) ) {
|
|
267 |
|
268 |
}
|
269 |
|
270 |
-
|
271 |
-
|
272 |
-
public static function wcap_enable_cart_emails_callback( $args ) {
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
$enable_cart_emails = get_option( 'ac_enable_cart_emails' );
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
if (isset( $enable_cart_emails ) && $enable_cart_emails == "" ) {
|
281 |
-
|
282 |
-
$enable_cart_emails = 'off';
|
283 |
-
|
284 |
-
}
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
$html = '<input type="checkbox" id="ac_enable_cart_emails" name="ac_enable_cart_emails" value="on" ' . checked( 'on', $enable_cart_emails, false ) . ' readonly disabled/>';
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
$html .= '<label for="ac_enable_cart_emails"> ' . $args[0] . '</label>';
|
293 |
-
|
294 |
-
echo $html;
|
295 |
-
|
296 |
-
}
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
public static function wcap_cart_abandoned_time_guest_callback($args) {
|
301 |
|
302 |
|
189 |
|
190 |
|
191 |
|
192 |
+
if( isset( $args[2]) ) {
|
193 |
+
$checkbox_value = get_option( $args[2] );
|
194 |
+
$args_2 = $args[2];
|
195 |
+
} else {
|
196 |
+
$checkbox_value = '';
|
197 |
+
$args_2 = 'wcap_fb_check';
|
198 |
+
}
|
199 |
|
200 |
|
201 |
|
206 |
}
|
207 |
|
208 |
|
209 |
+
$html = "<input type='checkbox' id='$args_2' name='$args_2' value='on' " . checked( 'on', $checkbox_value, false ) . " readonly disabled/>";
|
|
|
210 |
|
211 |
|
212 |
|
213 |
+
$html .= '<label for="$args_2"> ' . $args[0] . '</label>';
|
214 |
|
215 |
|
216 |
|
224 |
|
225 |
|
226 |
|
227 |
+
$saved_value = isset( $args[2] ) ? get_option( $args[2] ) : '';
|
228 |
|
229 |
|
230 |
+
if( isset( $args[2] ) ) {
|
231 |
+
$html = "<input type='text' id='$args[2]' name='$args[2]' value='$saved_value' readonly />";
|
232 |
+
} else {
|
233 |
+
$html = "<input type='text' id='wcap_fb' name='wcap_fb' readonly />";
|
234 |
+
}
|
235 |
|
236 |
|
237 |
|
247 |
|
248 |
|
249 |
|
250 |
+
$selected_value = isset( $args[2] ) ? get_option( $args[2] ) : '';
|
251 |
|
252 |
$selected = '';
|
253 |
|
254 |
|
255 |
+
if( is_array( $args ) && isset( $args[2] ) && isset( $args[3] ) ) {
|
256 |
+
$html = "<select name='$args[2]' id='$args[2]' disabled>";
|
257 |
+
$icon_array = $args[3];
|
258 |
+
} else {
|
259 |
+
$html = "<select name='wcap_fb_user_icon' id='wcap_fb_user_icon' disabled>";
|
260 |
+
$icon_array = array( 'small' => 'Small', 'medium' => 'Medium' );
|
261 |
+
}
|
262 |
+
|
263 |
+
foreach ( $icon_array as $key => $value ) {
|
264 |
|
265 |
$selected = $selected_value === $key ? 'selected="selected"' : '';
|
266 |
|
268 |
|
269 |
}
|
270 |
|
|
|
|
|
271 |
$html .= "</select>";
|
272 |
|
273 |
$html .= '<label for="$args[2]"> ' . $args[0] . '</label>';
|
276 |
|
277 |
}
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
public static function wcap_cart_abandoned_time_guest_callback($args) {
|
280 |
|
281 |
|
includes/classes/class-wcal-templates-table.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
|
3 |
// Load WP_List_Table if not loaded
|
4 |
if ( ! class_exists( 'WP_List_Table' ) ) {
|
@@ -39,7 +39,7 @@ class WCAL_Templates_Table extends WP_List_Table {
|
|
39 |
* @since 2.5.3
|
40 |
*/
|
41 |
public $total_count;
|
42 |
-
|
43 |
/**
|
44 |
* It will add the bulk action function and other variable needed for the class.
|
45 |
*
|
@@ -57,7 +57,7 @@ class WCAL_Templates_Table extends WP_List_Table {
|
|
57 |
$this->process_bulk_action();
|
58 |
$this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=emailtemplates' );
|
59 |
}
|
60 |
-
|
61 |
/**
|
62 |
* It will prepare the list of the templates, like columns, pagination, sortable column, all data.
|
63 |
* @since 2.5.2
|
@@ -67,11 +67,11 @@ class WCAL_Templates_Table extends WP_List_Table {
|
|
67 |
$hidden = array(); // No hidden columns
|
68 |
$sortable = $this->templates_get_sortable_columns();
|
69 |
$data = $this->wcal_templates_data();
|
70 |
-
|
71 |
$this->_column_headers = array( $columns, $hidden, $sortable );
|
72 |
$total_items = $this->total_count;
|
73 |
$this->items = $data;
|
74 |
-
|
75 |
$this->set_pagination_args( array(
|
76 |
'total_items' => $total_items, // WE have to calculate the total number of items
|
77 |
'per_page' => $this->per_page, // WE have to determine how many items to show on a page
|
@@ -79,32 +79,32 @@ class WCAL_Templates_Table extends WP_List_Table {
|
|
79 |
)
|
80 |
);
|
81 |
}
|
82 |
-
|
83 |
/**
|
84 |
* It will add the columns templates list.
|
85 |
* @return array $columns All columns name.
|
86 |
* @since 2.5.2
|
87 |
*/
|
88 |
-
public function get_columns() {
|
89 |
$columns = array(
|
90 |
'cb' => '<input type="checkbox" />',
|
91 |
'sr' => __( 'Sr', 'woocommerce-abandoned-cart' ),
|
92 |
'template_name' => __( 'Name Of Template', 'woocommerce-abandoned-cart' ),
|
93 |
'sent_time' => __( 'Sent After Set Time', 'woocommerce-abandoned-cart' ),
|
94 |
-
'activate' => __( 'Active ?', 'woocommerce-abandoned-cart' )
|
95 |
-
);
|
96 |
return apply_filters( 'wcal_templates_columns', $columns );
|
97 |
-
}
|
98 |
/**
|
99 |
* It is used to add the check box for the items.
|
100 |
-
* @param string $item
|
101 |
-
* @return string
|
102 |
* @since 2.5.2
|
103 |
*/
|
104 |
-
function column_cb( $item ) {
|
105 |
$template_id = '';
|
106 |
if( isset( $item->id ) && "" != $item->id ) {
|
107 |
-
$template_id = $item->id;
|
108 |
}
|
109 |
return sprintf(
|
110 |
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
|
@@ -112,7 +112,7 @@ class WCAL_Templates_Table extends WP_List_Table {
|
|
112 |
$template_id
|
113 |
);
|
114 |
}
|
115 |
-
|
116 |
/**
|
117 |
* We can mention on which column we need the sorting. Here we have template name, email sent time
|
118 |
* @return array $columns Name of the column
|
@@ -125,75 +125,75 @@ class WCAL_Templates_Table extends WP_List_Table {
|
|
125 |
);
|
126 |
return apply_filters( 'wcal_templates_sortable_columns', $columns );
|
127 |
}
|
128 |
-
|
129 |
/**
|
130 |
-
* It will add the hover link on the template name.
|
131 |
* This function used for individual delete, edit of row.
|
132 |
* @since 2.5.2
|
133 |
-
* @param array $template_row_info Contains all the data of the template row
|
134 |
* @return string $value All hover links, here we have edit and delete
|
135 |
-
*
|
136 |
*/
|
137 |
-
public function column_template_name( $template_row_info ) {
|
138 |
$row_actions = array();
|
139 |
$value = '';
|
140 |
$template_id = 0;
|
141 |
-
if( isset( $template_row_info->template_name ) ) {
|
142 |
-
$template_id = $template_row_info->id ;
|
143 |
-
|
144 |
$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-abandoned-cart' ) . '</a>';
|
145 |
$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-abandoned-cart' ) . '</a>';
|
146 |
-
|
147 |
$email = $template_row_info->template_name;
|
148 |
-
$value = $email . $this->row_actions( $row_actions );
|
149 |
-
}
|
150 |
return apply_filters( 'wcal_template_single_column', $value, $template_id, 'email' );
|
151 |
}
|
152 |
-
|
153 |
/**
|
154 |
* It will generate the templates list data.
|
155 |
* @globals mixed $wpdb
|
156 |
* @return array $return_templates_data_display Key and value of all the columns
|
157 |
* @since 2.5.2
|
158 |
*/
|
159 |
-
public function wcal_templates_data() {
|
160 |
-
global $wpdb;
|
161 |
$return_templates_data = array();
|
162 |
$per_page = $this->per_page;
|
163 |
-
$results = array();
|
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 |
-
$i = 0;
|
167 |
-
|
168 |
-
foreach ( $results as $key => $value ) {
|
169 |
-
$return_templates_data[$i] = new stdClass();
|
170 |
-
$id = $value->id;
|
171 |
$query_no_emails = "SELECT * FROM " . $wpdb->prefix . "ac_sent_history_lite WHERE template_id= %d";
|
172 |
$subject = $value->subject;
|
173 |
$body = $value->body;
|
174 |
$is_active = $value->is_active;
|
175 |
-
|
176 |
if ( $is_active == '1' ) {
|
177 |
$active = "Deactivate";
|
178 |
} else {
|
179 |
$active = "Activate";
|
180 |
}
|
181 |
$frequency = $value->frequency;
|
182 |
-
$day_or_hour = $value->day_or_hour;
|
183 |
$return_templates_data[ $i ]->sr = $i+1;
|
184 |
$return_templates_data[ $i ]->id = $id;
|
185 |
$return_templates_data[ $i ]->template_name = $value->template_name;
|
186 |
$return_templates_data[ $i ]->sent_time = __( $frequency . " " . $day_or_hour . "After Abandonment", 'woocommerce-abandoned-cart' );
|
187 |
$return_templates_data[ $i ]->activate = $active;
|
188 |
$return_templates_data[ $i ]->is_active = $is_active;
|
189 |
-
$i++;
|
190 |
}
|
191 |
$templates_count = count( $return_templates_data );
|
192 |
$this->total_count = $templates_count;
|
193 |
// sort for order date
|
194 |
if( isset( $_GET['orderby'] ) && $_GET['orderby'] == 'template_name' ) {
|
195 |
if( isset($_GET['order'] ) && $_GET['order'] == 'asc' ) {
|
196 |
-
usort( $return_templates_data, array( __CLASS__ , "wcal_class_template_name_asc" ) );
|
197 |
} else {
|
198 |
usort( $return_templates_data, array( __CLASS__ , "wcal_class_template_name_dsc") );
|
199 |
}
|
@@ -221,54 +221,54 @@ class WCAL_Templates_Table extends WP_List_Table {
|
|
221 |
break;
|
222 |
}
|
223 |
}
|
224 |
-
|
225 |
return apply_filters( 'wcal_templates_table_data', $return_templates_data_display );
|
226 |
}
|
227 |
-
|
228 |
/**
|
229 |
* It will sort the data alphabetally ascending on the template name.
|
230 |
* @param array | object $value1 All data of the list
|
231 |
* @param array | object $value2 All data of the list
|
232 |
-
* @return sorted array
|
233 |
* @since 2.5.2
|
234 |
*/
|
235 |
function wcal_class_template_name_asc( $value1,$value2 ) {
|
236 |
return strcasecmp( $value1->template_name,$value2->template_name );
|
237 |
}
|
238 |
-
|
239 |
/**
|
240 |
* It will sort the data alphabetally descending on the template name.
|
241 |
* @param array | object $value1 All data of the list
|
242 |
* @param array | object $value2 All data of the list
|
243 |
-
* @return sorted array
|
244 |
* @since 2.5.2
|
245 |
*/
|
246 |
function wcal_class_template_name_dsc( $value1,$value2 ) {
|
247 |
return strcasecmp( $value2->template_name,$value1->template_name );
|
248 |
}
|
249 |
-
|
250 |
/**
|
251 |
* It will sort the data alphanumeric ascending on the template time.
|
252 |
* @param array | object $value1 All data of the list
|
253 |
* @param array | object $value2 All data of the list
|
254 |
-
* @return sorted array
|
255 |
* @since 2.5.2
|
256 |
*/
|
257 |
function wcal_class_sent_time_asc( $value1,$value2 ) {
|
258 |
return strnatcasecmp( $value1->sent_time,$value2->sent_time );
|
259 |
}
|
260 |
-
|
261 |
/**
|
262 |
* It will sort the data alphanumeric descending on the template time.
|
263 |
* @param array | object $value1 All data of the list
|
264 |
* @param array | object $value2 All data of the list
|
265 |
-
* @return sorted array
|
266 |
* @since 2.5.2
|
267 |
*/
|
268 |
function wcal_class_sent_time_dsc( $value1,$value2 ) {
|
269 |
return strnatcasecmp( $value2->sent_time,$value1->sent_time );
|
270 |
}
|
271 |
-
|
272 |
/**
|
273 |
* It will display the data for the templates list
|
274 |
* @param array | object $wcal_abandoned_orders All data of the list
|
@@ -278,48 +278,50 @@ class WCAL_Templates_Table extends WP_List_Table {
|
|
278 |
*/
|
279 |
public function column_default( $wcal_abandoned_orders, $column_name ) {
|
280 |
$value = '';
|
281 |
-
switch ( $column_name ) {
|
282 |
case 'sr' :
|
283 |
if( isset( $wcal_abandoned_orders->sr ) ) {
|
284 |
$value = $wcal_abandoned_orders->sr;
|
285 |
}
|
286 |
-
break;
|
287 |
case 'template_name' :
|
288 |
if( isset( $wcal_abandoned_orders->template_name ) ) {
|
289 |
$value = $wcal_abandoned_orders->template_name;
|
290 |
}
|
291 |
-
break;
|
292 |
case 'sent_time' :
|
293 |
if( isset( $wcal_abandoned_orders->sent_time ) ) {
|
294 |
$value = $wcal_abandoned_orders->sent_time;
|
295 |
}
|
296 |
-
break;
|
297 |
case 'activate' :
|
298 |
-
if( isset( $wcal_abandoned_orders->activate ) ) {
|
299 |
-
$active
|
300 |
-
$id
|
301 |
-
$is_active
|
302 |
-
$active
|
|
|
303 |
if ( $is_active == '1' ) {
|
304 |
$active = "on";
|
|
|
305 |
} else {
|
306 |
$active = "off";
|
|
|
307 |
}
|
308 |
-
|
309 |
-
//$value = '<a href="#" onclick="wcal_activate_email_template('. $id.', '.$is_active.' )"> '.$active_text.'</a>';
|
310 |
$value = '<button type="button" class="wcal-switch wcal-toggle-template-status" '
|
311 |
. 'wcal-template-id="'. $id .'" '
|
312 |
. 'wcal-template-switch="'. ( $active ) . '">'
|
313 |
-
. $active_text . '</button>';
|
314 |
}
|
315 |
-
break;
|
316 |
-
default:
|
317 |
$value = isset( $wcal_abandoned_orders->$column_name ) ? $wcal_abandoned_orders->$column_name : '';
|
318 |
break;
|
319 |
-
}
|
320 |
return apply_filters( 'wcal_template_column_default', $value, $wcal_abandoned_orders, $column_name );
|
321 |
}
|
322 |
-
|
323 |
/**
|
324 |
* It will add the bulk action, here Delete
|
325 |
* @return array
|
1 |
+
<?php
|
2 |
|
3 |
// Load WP_List_Table if not loaded
|
4 |
if ( ! class_exists( 'WP_List_Table' ) ) {
|
39 |
* @since 2.5.3
|
40 |
*/
|
41 |
public $total_count;
|
42 |
+
|
43 |
/**
|
44 |
* It will add the bulk action function and other variable needed for the class.
|
45 |
*
|
57 |
$this->process_bulk_action();
|
58 |
$this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=emailtemplates' );
|
59 |
}
|
60 |
+
|
61 |
/**
|
62 |
* It will prepare the list of the templates, like columns, pagination, sortable column, all data.
|
63 |
* @since 2.5.2
|
67 |
$hidden = array(); // No hidden columns
|
68 |
$sortable = $this->templates_get_sortable_columns();
|
69 |
$data = $this->wcal_templates_data();
|
70 |
+
|
71 |
$this->_column_headers = array( $columns, $hidden, $sortable );
|
72 |
$total_items = $this->total_count;
|
73 |
$this->items = $data;
|
74 |
+
|
75 |
$this->set_pagination_args( array(
|
76 |
'total_items' => $total_items, // WE have to calculate the total number of items
|
77 |
'per_page' => $this->per_page, // WE have to determine how many items to show on a page
|
79 |
)
|
80 |
);
|
81 |
}
|
82 |
+
|
83 |
/**
|
84 |
* It will add the columns templates list.
|
85 |
* @return array $columns All columns name.
|
86 |
* @since 2.5.2
|
87 |
*/
|
88 |
+
public function get_columns() {
|
89 |
$columns = array(
|
90 |
'cb' => '<input type="checkbox" />',
|
91 |
'sr' => __( 'Sr', 'woocommerce-abandoned-cart' ),
|
92 |
'template_name' => __( 'Name Of Template', 'woocommerce-abandoned-cart' ),
|
93 |
'sent_time' => __( 'Sent After Set Time', 'woocommerce-abandoned-cart' ),
|
94 |
+
'activate' => __( 'Active ?', 'woocommerce-abandoned-cart' )
|
95 |
+
);
|
96 |
return apply_filters( 'wcal_templates_columns', $columns );
|
97 |
+
}
|
98 |
/**
|
99 |
* It is used to add the check box for the items.
|
100 |
+
* @param string $item
|
101 |
+
* @return string
|
102 |
* @since 2.5.2
|
103 |
*/
|
104 |
+
function column_cb( $item ) {
|
105 |
$template_id = '';
|
106 |
if( isset( $item->id ) && "" != $item->id ) {
|
107 |
+
$template_id = $item->id;
|
108 |
}
|
109 |
return sprintf(
|
110 |
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
|
112 |
$template_id
|
113 |
);
|
114 |
}
|
115 |
+
|
116 |
/**
|
117 |
* We can mention on which column we need the sorting. Here we have template name, email sent time
|
118 |
* @return array $columns Name of the column
|
125 |
);
|
126 |
return apply_filters( 'wcal_templates_sortable_columns', $columns );
|
127 |
}
|
128 |
+
|
129 |
/**
|
130 |
+
* It will add the hover link on the template name.
|
131 |
* This function used for individual delete, edit of row.
|
132 |
* @since 2.5.2
|
133 |
+
* @param array $template_row_info Contains all the data of the template row
|
134 |
* @return string $value All hover links, here we have edit and delete
|
135 |
+
*
|
136 |
*/
|
137 |
+
public function column_template_name( $template_row_info ) {
|
138 |
$row_actions = array();
|
139 |
$value = '';
|
140 |
$template_id = 0;
|
141 |
+
if( isset( $template_row_info->template_name ) ) {
|
142 |
+
$template_id = $template_row_info->id ;
|
143 |
+
|
144 |
$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-abandoned-cart' ) . '</a>';
|
145 |
$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-abandoned-cart' ) . '</a>';
|
146 |
+
|
147 |
$email = $template_row_info->template_name;
|
148 |
+
$value = $email . $this->row_actions( $row_actions );
|
149 |
+
}
|
150 |
return apply_filters( 'wcal_template_single_column', $value, $template_id, 'email' );
|
151 |
}
|
152 |
+
|
153 |
/**
|
154 |
* It will generate the templates list data.
|
155 |
* @globals mixed $wpdb
|
156 |
* @return array $return_templates_data_display Key and value of all the columns
|
157 |
* @since 2.5.2
|
158 |
*/
|
159 |
+
public function wcal_templates_data() {
|
160 |
+
global $wpdb;
|
161 |
$return_templates_data = array();
|
162 |
$per_page = $this->per_page;
|
163 |
+
$results = array();
|
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 |
+
$i = 0;
|
167 |
+
|
168 |
+
foreach ( $results as $key => $value ) {
|
169 |
+
$return_templates_data[$i] = new stdClass();
|
170 |
+
$id = $value->id;
|
171 |
$query_no_emails = "SELECT * FROM " . $wpdb->prefix . "ac_sent_history_lite WHERE template_id= %d";
|
172 |
$subject = $value->subject;
|
173 |
$body = $value->body;
|
174 |
$is_active = $value->is_active;
|
175 |
+
|
176 |
if ( $is_active == '1' ) {
|
177 |
$active = "Deactivate";
|
178 |
} else {
|
179 |
$active = "Activate";
|
180 |
}
|
181 |
$frequency = $value->frequency;
|
182 |
+
$day_or_hour = $value->day_or_hour;
|
183 |
$return_templates_data[ $i ]->sr = $i+1;
|
184 |
$return_templates_data[ $i ]->id = $id;
|
185 |
$return_templates_data[ $i ]->template_name = $value->template_name;
|
186 |
$return_templates_data[ $i ]->sent_time = __( $frequency . " " . $day_or_hour . "After Abandonment", 'woocommerce-abandoned-cart' );
|
187 |
$return_templates_data[ $i ]->activate = $active;
|
188 |
$return_templates_data[ $i ]->is_active = $is_active;
|
189 |
+
$i++;
|
190 |
}
|
191 |
$templates_count = count( $return_templates_data );
|
192 |
$this->total_count = $templates_count;
|
193 |
// sort for order date
|
194 |
if( isset( $_GET['orderby'] ) && $_GET['orderby'] == 'template_name' ) {
|
195 |
if( isset($_GET['order'] ) && $_GET['order'] == 'asc' ) {
|
196 |
+
usort( $return_templates_data, array( __CLASS__ , "wcal_class_template_name_asc" ) );
|
197 |
} else {
|
198 |
usort( $return_templates_data, array( __CLASS__ , "wcal_class_template_name_dsc") );
|
199 |
}
|
221 |
break;
|
222 |
}
|
223 |
}
|
224 |
+
|
225 |
return apply_filters( 'wcal_templates_table_data', $return_templates_data_display );
|
226 |
}
|
227 |
+
|
228 |
/**
|
229 |
* It will sort the data alphabetally ascending on the template name.
|
230 |
* @param array | object $value1 All data of the list
|
231 |
* @param array | object $value2 All data of the list
|
232 |
+
* @return sorted array
|
233 |
* @since 2.5.2
|
234 |
*/
|
235 |
function wcal_class_template_name_asc( $value1,$value2 ) {
|
236 |
return strcasecmp( $value1->template_name,$value2->template_name );
|
237 |
}
|
238 |
+
|
239 |
/**
|
240 |
* It will sort the data alphabetally descending on the template name.
|
241 |
* @param array | object $value1 All data of the list
|
242 |
* @param array | object $value2 All data of the list
|
243 |
+
* @return sorted array
|
244 |
* @since 2.5.2
|
245 |
*/
|
246 |
function wcal_class_template_name_dsc( $value1,$value2 ) {
|
247 |
return strcasecmp( $value2->template_name,$value1->template_name );
|
248 |
}
|
249 |
+
|
250 |
/**
|
251 |
* It will sort the data alphanumeric ascending on the template time.
|
252 |
* @param array | object $value1 All data of the list
|
253 |
* @param array | object $value2 All data of the list
|
254 |
+
* @return sorted array
|
255 |
* @since 2.5.2
|
256 |
*/
|
257 |
function wcal_class_sent_time_asc( $value1,$value2 ) {
|
258 |
return strnatcasecmp( $value1->sent_time,$value2->sent_time );
|
259 |
}
|
260 |
+
|
261 |
/**
|
262 |
* It will sort the data alphanumeric descending on the template time.
|
263 |
* @param array | object $value1 All data of the list
|
264 |
* @param array | object $value2 All data of the list
|
265 |
+
* @return sorted array
|
266 |
* @since 2.5.2
|
267 |
*/
|
268 |
function wcal_class_sent_time_dsc( $value1,$value2 ) {
|
269 |
return strnatcasecmp( $value2->sent_time,$value1->sent_time );
|
270 |
}
|
271 |
+
|
272 |
/**
|
273 |
* It will display the data for the templates list
|
274 |
* @param array | object $wcal_abandoned_orders All data of the list
|
278 |
*/
|
279 |
public function column_default( $wcal_abandoned_orders, $column_name ) {
|
280 |
$value = '';
|
281 |
+
switch ( $column_name ) {
|
282 |
case 'sr' :
|
283 |
if( isset( $wcal_abandoned_orders->sr ) ) {
|
284 |
$value = $wcal_abandoned_orders->sr;
|
285 |
}
|
286 |
+
break;
|
287 |
case 'template_name' :
|
288 |
if( isset( $wcal_abandoned_orders->template_name ) ) {
|
289 |
$value = $wcal_abandoned_orders->template_name;
|
290 |
}
|
291 |
+
break;
|
292 |
case 'sent_time' :
|
293 |
if( isset( $wcal_abandoned_orders->sent_time ) ) {
|
294 |
$value = $wcal_abandoned_orders->sent_time;
|
295 |
}
|
296 |
+
break;
|
297 |
case 'activate' :
|
298 |
+
if( isset( $wcal_abandoned_orders->activate ) ) {
|
299 |
+
$active = $wcal_abandoned_orders->activate;
|
300 |
+
$id = $wcal_abandoned_orders->id;
|
301 |
+
$is_active = $wcal_abandoned_orders->is_active;
|
302 |
+
$active = '';
|
303 |
+
$active_text = '';
|
304 |
if ( $is_active == '1' ) {
|
305 |
$active = "on";
|
306 |
+
$active_text = __( "on", 'woocommerce-abandoned-cart' );
|
307 |
} else {
|
308 |
$active = "off";
|
309 |
+
$active_text = __( "off", 'woocommerce-abandoned-cart' );
|
310 |
}
|
311 |
+
//$value = '<a href="#" onclick="wcal_activate_email_template('. $id.', '.$is_active.' )"> '.$active_text.'</a>';
|
|
|
312 |
$value = '<button type="button" class="wcal-switch wcal-toggle-template-status" '
|
313 |
. 'wcal-template-id="'. $id .'" '
|
314 |
. 'wcal-template-switch="'. ( $active ) . '">'
|
315 |
+
. $active_text . '</button>';
|
316 |
}
|
317 |
+
break;
|
318 |
+
default:
|
319 |
$value = isset( $wcal_abandoned_orders->$column_name ) ? $wcal_abandoned_orders->$column_name : '';
|
320 |
break;
|
321 |
+
}
|
322 |
return apply_filters( 'wcal_template_column_default', $value, $wcal_abandoned_orders, $column_name );
|
323 |
}
|
324 |
+
|
325 |
/**
|
326 |
* It will add the bulk action, here Delete
|
327 |
* @return array
|
includes/wcal-common.php
CHANGED
@@ -783,5 +783,36 @@ class wcal_common {
|
|
783 |
public static function wcal_unset_cart_session( $session_key ) {
|
784 |
WC()->session->__unset( $session_key );
|
785 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
786 |
}
|
787 |
?>
|
783 |
public static function wcal_unset_cart_session( $session_key ) {
|
784 |
WC()->session->__unset( $session_key );
|
785 |
}
|
786 |
+
|
787 |
+
/**
|
788 |
+
* Delete the AC record and create a user meta record (for registered users)
|
789 |
+
* when the user chooses to opt out of cart tracking
|
790 |
+
* @since 5.5
|
791 |
+
*/
|
792 |
+
public static function wcal_gdpr_refused() {
|
793 |
+
|
794 |
+
$abandoned_cart_id = wcal_common::wcal_get_cart_session( 'abandoned_cart_id_lite' );
|
795 |
+
|
796 |
+
global $wpdb;
|
797 |
+
|
798 |
+
if( isset( $abandoned_cart_id ) && $abandoned_cart_id > 0 ) {
|
799 |
+
// fetch the user ID - if greater than 0, we need to check & delete guest table record is applicable.
|
800 |
+
$query_user = "SELECT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE id = %d";
|
801 |
+
$user_id = $wpdb->get_var( $wpdb->prepare( $query_user, $abandoned_cart_id ) );
|
802 |
+
|
803 |
+
if( $user_id >= 63000000 ) { // guest user
|
804 |
+
// delete the guest record
|
805 |
+
$wpdb->delete( $wpdb->prefix . "ac_guest_abandoned_cart_history_lite", array( 'id' => $user_id ) );
|
806 |
+
} else { // registered cart
|
807 |
+
// save the user choice of not being tracked
|
808 |
+
add_user_meta( $user_id, 'wcal_gdpr_tracking_choice', 0 );
|
809 |
+
}
|
810 |
+
// add in the session, that the user has refused tracking
|
811 |
+
wcal_common::wcal_set_cart_session( 'wcal_cart_tracking_refused', 'yes' );
|
812 |
+
|
813 |
+
// finally delete the cart history record
|
814 |
+
$wpdb->delete( $wpdb->prefix . "ac_abandoned_cart_history_lite", array( 'id' => $abandoned_cart_id ) );
|
815 |
+
}
|
816 |
+
}
|
817 |
}
|
818 |
?>
|
includes/wcal_all_component.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* It will Add all the Boilerplate component when we activate the plugin.
|
4 |
* @author Tyche Softwares
|
5 |
* @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Component
|
6 |
-
*
|
7 |
*/
|
8 |
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
exit; // Exit if accessed directly.
|
@@ -12,10 +12,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
12 |
if ( ! class_exists( 'Wcal_All_Component' ) ) {
|
13 |
/**
|
14 |
* It will Add all the Boilerplate component when we activate the plugin.
|
15 |
-
*
|
16 |
*/
|
17 |
class Wcal_All_Component {
|
18 |
-
|
19 |
/**
|
20 |
* It will Add all the Boilerplate component when we activate the plugin.
|
21 |
*/
|
@@ -33,7 +33,7 @@ if ( ! class_exists( 'Wcal_All_Component' ) ) {
|
|
33 |
require_once( "component/welcome-page/ts-welcome.php" );
|
34 |
require_once( "component/faq-support/ts-faq-support.php" );
|
35 |
require_once( "component/pro-notices-in-lite/ts-pro-notices.php" );
|
36 |
-
|
37 |
$wcal_plugin_name = 'Abandoned Cart Lite for WooCommerce';
|
38 |
$wcal_locale = 'woocommerce-abandoned-cart';
|
39 |
$wcal_file_name = 'woocommerce-abandoned-cart/woocommerce-ac.php';
|
@@ -66,16 +66,16 @@ if ( ! class_exists( 'Wcal_All_Component' ) ) {
|
|
66 |
$wcal_deativate->init ( $wcal_file_name, $wcal_plugin_name );
|
67 |
|
68 |
/*new Wcal_TS_Welcome ( $wcal_plugin_name, $wcal_plugin_prefix, $wcal_locale, $wcal_plugin_folder_name, $wcal_plugin_dir_name, $wcal_get_previous_version );*/
|
69 |
-
|
70 |
$ts_pro_faq = self::wcal_get_faq ();
|
71 |
new Wcal_TS_Faq_Support( $wcal_plugin_name, $wcal_plugin_prefix, $wcal_plugins_page, $wcal_locale, $wcal_plugin_folder_name, $wcal_plugin_slug, $ts_pro_faq );
|
72 |
-
|
73 |
/*$ts_pro_notices = self::wcal_get_notice_text ();
|
74 |
new Wcal_ts_pro_notices( $wcal_plugin_name, $wcal_lite_plugin_prefix, $wcal_plugin_prefix, $ts_pro_notices, $wcal_file_name, $wcal_pro_file_name );*/
|
75 |
|
76 |
}
|
77 |
}
|
78 |
-
|
79 |
/**
|
80 |
* It will Display the notices in the admin dashboard for the pro vesion of the plugin.
|
81 |
* @return array $ts_pro_notices All text of the notices
|
@@ -85,35 +85,44 @@ if ( ! class_exists( 'Wcal_All_Component' ) ) {
|
|
85 |
|
86 |
$wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=first&utm_campaign=AbandonedCartLitePlugin';
|
87 |
$wcal_pro_diff = 'https://www.tychesoftwares.com/differences-between-pro-and-lite-versions-of-abandoned-cart-for-woocommerce-plugin/';
|
88 |
-
|
|
|
89 |
|
90 |
$wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=second&utm_campaign=AbandonedCartLitePlugin';
|
91 |
-
|
|
|
92 |
|
93 |
$wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=third&utm_campaign=AbandonedCartLitePlugin';
|
94 |
-
|
|
|
95 |
|
96 |
$wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=fourth&utm_campaign=AbandonedCartLitePlugin';
|
97 |
-
|
|
|
98 |
|
99 |
$wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=fifth&utm_campaign=AbandonedCartLitePlugin';
|
100 |
-
|
101 |
-
|
|
|
102 |
|
103 |
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/?utm_source=wpnotice&utm_medium=sixth&utm_campaign=AbandonedCartLitePlugin';
|
104 |
-
|
|
|
105 |
|
106 |
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/?utm_source=wpnotice&utm_medium=seventh&utm_campaign=AbandonedCartLitePlugin';
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
110 |
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-booking-plugin/?utm_source=wpnotice&utm_medium=eight&utm_campaign=AbandonedCartLitePlugin';
|
111 |
-
|
112 |
-
|
|
|
113 |
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/deposits-for-woocommerce/?utm_source=wpnotice&utm_medium=eight&utm_campaign=AbandonedCartLitePlugin';
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
117 |
$ts_pro_notices = array (
|
118 |
1 => $message_first,
|
119 |
2 => $message_two,
|
@@ -128,11 +137,11 @@ if ( ! class_exists( 'Wcal_All_Component' ) ) {
|
|
128 |
|
129 |
return $ts_pro_notices;
|
130 |
}
|
131 |
-
|
132 |
/**
|
133 |
* It will contain all the FAQ which need to be display on the FAQ page.
|
134 |
* @return array $ts_faq All questions and answers.
|
135 |
-
*
|
136 |
*/
|
137 |
public static function wcal_get_faq () {
|
138 |
|
@@ -144,7 +153,7 @@ if ( ! class_exists( 'Wcal_All_Component' ) ) {
|
|
144 |
'answer' => 'Please ensure you have at least one Email template "Active". As only active email templates are sent to recover the abandoned carts.
|
145 |
<br/><br/>
|
146 |
For sending the abandoned cart notification emails automatically, we use WP-Cron. If you have Email templates activated and still notification are not sent, then you can debug the issue by following this <a href = "https://www.tychesoftwares.com/docs/docs/abandoned-cart-pro-for-woocommerce/wp_alternate_cron/?utm_source=userwebsite&utm_medium=link&utm_campaign=AbandonedCartProFAQTab" target="_blank" >post</a>.'
|
147 |
-
),
|
148 |
2 => array (
|
149 |
'question' => 'How is the email address of the customers captured?',
|
150 |
'answer' => 'Our plugin captures visitor emails in real-time as they are typing it in to the email address field on the checkout page, so you don\'t need to worry about them changing their mind at the last second.
|
@@ -188,7 +197,7 @@ if ( ! class_exists( 'Wcal_All_Component' ) ) {
|
|
188 |
10 => array (
|
189 |
'question' => 'There was a problem creating an email template on Multisite.',
|
190 |
'answer' => 'On Multisite, if you have activated the plugin from Network site then please deactivate it and activate the Abandoned Cart Lite plugin from an Individual site. So, one default email template will be created on the activation of the plugin and you can create new email template.'
|
191 |
-
)
|
192 |
);
|
193 |
|
194 |
return $ts_faq;
|
3 |
* It will Add all the Boilerplate component when we activate the plugin.
|
4 |
* @author Tyche Softwares
|
5 |
* @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Component
|
6 |
+
*
|
7 |
*/
|
8 |
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
exit; // Exit if accessed directly.
|
12 |
if ( ! class_exists( 'Wcal_All_Component' ) ) {
|
13 |
/**
|
14 |
* It will Add all the Boilerplate component when we activate the plugin.
|
15 |
+
*
|
16 |
*/
|
17 |
class Wcal_All_Component {
|
18 |
+
|
19 |
/**
|
20 |
* It will Add all the Boilerplate component when we activate the plugin.
|
21 |
*/
|
33 |
require_once( "component/welcome-page/ts-welcome.php" );
|
34 |
require_once( "component/faq-support/ts-faq-support.php" );
|
35 |
require_once( "component/pro-notices-in-lite/ts-pro-notices.php" );
|
36 |
+
|
37 |
$wcal_plugin_name = 'Abandoned Cart Lite for WooCommerce';
|
38 |
$wcal_locale = 'woocommerce-abandoned-cart';
|
39 |
$wcal_file_name = 'woocommerce-abandoned-cart/woocommerce-ac.php';
|
66 |
$wcal_deativate->init ( $wcal_file_name, $wcal_plugin_name );
|
67 |
|
68 |
/*new Wcal_TS_Welcome ( $wcal_plugin_name, $wcal_plugin_prefix, $wcal_locale, $wcal_plugin_folder_name, $wcal_plugin_dir_name, $wcal_get_previous_version );*/
|
69 |
+
|
70 |
$ts_pro_faq = self::wcal_get_faq ();
|
71 |
new Wcal_TS_Faq_Support( $wcal_plugin_name, $wcal_plugin_prefix, $wcal_plugins_page, $wcal_locale, $wcal_plugin_folder_name, $wcal_plugin_slug, $ts_pro_faq );
|
72 |
+
|
73 |
/*$ts_pro_notices = self::wcal_get_notice_text ();
|
74 |
new Wcal_ts_pro_notices( $wcal_plugin_name, $wcal_lite_plugin_prefix, $wcal_plugin_prefix, $ts_pro_notices, $wcal_file_name, $wcal_pro_file_name );*/
|
75 |
|
76 |
}
|
77 |
}
|
78 |
+
|
79 |
/**
|
80 |
* It will Display the notices in the admin dashboard for the pro vesion of the plugin.
|
81 |
* @return array $ts_pro_notices All text of the notices
|
85 |
|
86 |
$wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=first&utm_campaign=AbandonedCartLitePlugin';
|
87 |
$wcal_pro_diff = 'https://www.tychesoftwares.com/differences-between-pro-and-lite-versions-of-abandoned-cart-for-woocommerce-plugin/';
|
88 |
+
/* translators: %1$s Link to Differences article, %2$s link to pro version */
|
89 |
+
$message_first = wp_kses_post( sprintf( __( 'Now that you are all set with the Lite version, you can upgrade to Pro version to take your abandoned cart recovery to the next level. You can capture customer’s email address when they click Add to Cart, get access to 11 unique, fully responsive email templates, send text messages for recovery & <strong><a target="_blank" href= "%1$s">much more</a></strong>. <strong><a target="_blank" href= "%2$s">Purchase now</a></strong>.', 'woocommerce-abandoned-cart' ), $wcal_pro_diff, $wcal_ac_pro_link ) );
|
90 |
|
91 |
$wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=second&utm_campaign=AbandonedCartLitePlugin';
|
92 |
+
/* translators: %s Link to Abandoned Cart Pro */
|
93 |
+
$message_two = wp_kses_post( sprintf( __( 'Boost your sales by recovering up to 60% of the abandoned carts with our Abandoned Cart Pro for WooCommerce plugin. You can capture customer email addresses right when they click the Add To Cart button. <strong><a target="_blank" href= "%s"> Grab your copy of Abandon Cart Pro plugin now!</a></strong>', 'woocommerce-abandoned-cart' ), $wcal_ac_pro_link ) );
|
94 |
|
95 |
$wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=third&utm_campaign=AbandonedCartLitePlugin';
|
96 |
+
/* translators: %s Link to Abandoned Cart Pro */
|
97 |
+
$message_three = wp_kses_post( sprintf( __( 'Don\'t loose your sales to abandoned carts. Use our Abandon Cart Pro plugin & start recovering your lost sales in less then 60 seconds. <strong><a target="_blank" href= "%s">Grab it now!</a></strong>.', 'woocommerce-abandoned-cart' ), $wcal_ac_pro_link ) );
|
98 |
|
99 |
$wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=fourth&utm_campaign=AbandonedCartLitePlugin';
|
100 |
+
/* translators: %s Link to Abandoned Cart Pro */
|
101 |
+
$message_four = wp_kses_post( sprintf( __( 'Send Abandoned Cart reminders that actually convert. Take advantage of our fully responsive email templates designed specially with an intent to trigger conversion. <strong><a target="_blank" href= "%s">Purchase now</a></strong>.', 'woocommerce-abandoned-cart' ), $wcal_ac_pro_link ) );
|
102 |
|
103 |
$wcal_ac_pro_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpnotice&utm_medium=fifth&utm_campaign=AbandonedCartLitePlugin';
|
104 |
+
/* translators: %s Link to Abandoned Cart Pro */
|
105 |
+
$message_five = wp_kses_post( sprintf( __( 'Increase your store sales by recovering your abandoned carts for just $119. No profit sharing, no monthly fees. Our Abandoned Cart Pro plugin comes with a 30 day money back guarantee as well. :) Use coupon code ACPRO20 & save $24!<br>
|
106 |
+
<strong><a target="_blank" href= "%s">Grab your copy now!</a></strong>', 'woocommerce-abandoned-cart' ), $wcal_ac_pro_link ) );
|
107 |
|
108 |
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/?utm_source=wpnotice&utm_medium=sixth&utm_campaign=AbandonedCartLitePlugin';
|
109 |
+
/* translators: %s Link to Order Delivery Date Pro */
|
110 |
+
$message_six = wp_kses_post( sprintf( __( 'Reduce cart abandonment rate by 57% with our Order Delivery Date Pro WooCommerce plugin. You can Create Delivery Settings by Shipping Zones & Shipping Classes. <br>Use discount code "ORDPRO20" and grab 20% discount on the purchase of the plugin. The discount code is valid only for the first 20 customers. <strong><a target="_blank" href= "%s">Purchase now</a></strong>', 'woocommerce-abandoned-cart' ), $_link ) );
|
111 |
|
112 |
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/?utm_source=wpnotice&utm_medium=seventh&utm_campaign=AbandonedCartLitePlugin';
|
113 |
+
/* translators: %s Link to Order Delivery Date Pro */
|
114 |
+
$message_seven = wp_kses_post( sprintf( __( 'Allow your customers to select the Delivery Date on Single Product Page using our Product Delivery Date pro for WooCommerce Plugin. <br>
|
115 |
+
<strong><a target="_blank" href= "%s">Shop now</a></strong> & be one of the 20 customers to get 20% discount on the plugin price. Use the code "PRDPRO20". Hurry!!', 'woocommerce-abandoned-cart' ), $_link ) );
|
116 |
+
|
117 |
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/woocommerce-booking-plugin/?utm_source=wpnotice&utm_medium=eight&utm_campaign=AbandonedCartLitePlugin';
|
118 |
+
/* translators: %s Link to WooCommerce Booking Plugin */
|
119 |
+
$message_eight = wp_kses_post( sprintf( __( 'Allow your customers to book an appointment or rent an apartment with our Booking and Appointment for WooCommerce plugin. You can also sell your product as a resource or integrate with a few Vendor plugins. <br>Shop now & Save 20% on the plugin with the code "BKAP20". Only for first 20 customers. <strong><a target="_blank" href= "%s">Have it now!</a></strong>', 'woocommerce-abandoned-cart' ), $_link ) );
|
120 |
+
|
121 |
$_link = 'https://www.tychesoftwares.com/store/premium-plugins/deposits-for-woocommerce/?utm_source=wpnotice&utm_medium=eight&utm_campaign=AbandonedCartLitePlugin';
|
122 |
+
/* translators: %s Link to Deposits for WooCommerce */
|
123 |
+
$message_nine = wp_kses_post( sprintf( __( ' Allow your customers to pay deposits on products using our Deposits for WooCommerce plugin. <br>
|
124 |
+
<strong><a target="_blank" href= "%s">Purchase now</a></strong> & Grab 20% discount with the code "DFWP20". The discount code is valid only for the first 20 customers.', 'woocommerce-abandoned-cart' ), $_link ) );
|
125 |
+
|
126 |
$ts_pro_notices = array (
|
127 |
1 => $message_first,
|
128 |
2 => $message_two,
|
137 |
|
138 |
return $ts_pro_notices;
|
139 |
}
|
140 |
+
|
141 |
/**
|
142 |
* It will contain all the FAQ which need to be display on the FAQ page.
|
143 |
* @return array $ts_faq All questions and answers.
|
144 |
+
*
|
145 |
*/
|
146 |
public static function wcal_get_faq () {
|
147 |
|
153 |
'answer' => 'Please ensure you have at least one Email template "Active". As only active email templates are sent to recover the abandoned carts.
|
154 |
<br/><br/>
|
155 |
For sending the abandoned cart notification emails automatically, we use WP-Cron. If you have Email templates activated and still notification are not sent, then you can debug the issue by following this <a href = "https://www.tychesoftwares.com/docs/docs/abandoned-cart-pro-for-woocommerce/wp_alternate_cron/?utm_source=userwebsite&utm_medium=link&utm_campaign=AbandonedCartProFAQTab" target="_blank" >post</a>.'
|
156 |
+
),
|
157 |
2 => array (
|
158 |
'question' => 'How is the email address of the customers captured?',
|
159 |
'answer' => 'Our plugin captures visitor emails in real-time as they are typing it in to the email address field on the checkout page, so you don\'t need to worry about them changing their mind at the last second.
|
197 |
10 => array (
|
198 |
'question' => 'There was a problem creating an email template on Multisite.',
|
199 |
'answer' => 'On Multisite, if you have activated the plugin from Network site then please deactivate it and activate the Abandoned Cart Lite plugin from an Individual site. So, one default email template will be created on the activation of the plugin and you can create new email template.'
|
200 |
+
)
|
201 |
);
|
202 |
|
203 |
return $ts_faq;
|
includes/wcal_class-guest.php
CHANGED
@@ -21,6 +21,7 @@ if ( ! class_exists( 'woocommerce_guest_ac' ) ) {
|
|
21 |
add_action( 'woocommerce_after_checkout_billing_form', 'user_side_js' );
|
22 |
add_action( 'wfacp_footer_before_print_scripts', 'user_side_js' ); //Compatibility with Aero Checkout
|
23 |
add_action( 'init','load_ac_ajax' );
|
|
|
24 |
add_filter( 'woocommerce_checkout_fields', 'guest_checkout_fields' );
|
25 |
}
|
26 |
}
|
@@ -51,12 +52,28 @@ if ( ! class_exists( 'woocommerce_guest_ac' ) ) {
|
|
51 |
true
|
52 |
);
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
wp_localize_script(
|
55 |
'wcal_guest_capture',
|
56 |
'wcal_guest_capture_params',
|
57 |
-
|
58 |
-
'ajax_url' => admin_url( 'admin-ajax.php' )
|
59 |
-
)
|
60 |
);
|
61 |
}
|
62 |
|
21 |
add_action( 'woocommerce_after_checkout_billing_form', 'user_side_js' );
|
22 |
add_action( 'wfacp_footer_before_print_scripts', 'user_side_js' ); //Compatibility with Aero Checkout
|
23 |
add_action( 'init','load_ac_ajax' );
|
24 |
+
add_action( 'wp_ajax_nopriv_wcal_gdpr_refused', array( 'wcal_common', 'wcal_gdpr_refused' ) );
|
25 |
add_filter( 'woocommerce_checkout_fields', 'guest_checkout_fields' );
|
26 |
}
|
27 |
}
|
52 |
true
|
53 |
);
|
54 |
|
55 |
+
$guest_msg = get_option( 'wcal_guest_cart_capture_msg' );
|
56 |
+
|
57 |
+
$session_gdpr = wcal_common::wcal_get_cart_session( 'wcal_cart_tracking_refused' );
|
58 |
+
$show_gdpr = isset( $session_gdpr ) && 'yes' == $session_gdpr ? false : true;
|
59 |
+
|
60 |
+
$vars = array();
|
61 |
+
if ( isset( $guest_msg ) && '' != $guest_msg ) {
|
62 |
+
$vars = array(
|
63 |
+
'_show_gdpr_message' => $show_gdpr,
|
64 |
+
'_gdpr_message' => htmlspecialchars( get_option( 'wcal_guest_cart_capture_msg' ), ENT_QUOTES ),
|
65 |
+
'_gdpr_nothanks_msg' => htmlspecialchars( get_option( 'wcal_gdpr_allow_opt_out'), ENT_QUOTES ),
|
66 |
+
'_gdpr_after_no_thanks_msg' => htmlspecialchars( get_option( 'wcal_gdpr_opt_out_message' ), ENT_QUOTES ),
|
67 |
+
'enable_ca_tracking' => true,
|
68 |
+
);
|
69 |
+
}
|
70 |
+
|
71 |
+
$vars[ 'ajax_url' ] = admin_url( 'admin-ajax.php' );
|
72 |
+
|
73 |
wp_localize_script(
|
74 |
'wcal_guest_capture',
|
75 |
'wcal_guest_capture_params',
|
76 |
+
$vars
|
|
|
|
|
77 |
);
|
78 |
}
|
79 |
|
includes/wcal_data_tracking_message.php
CHANGED
@@ -15,60 +15,57 @@ if ( ! class_exists( 'Wcal_Tracking_msg' ) ) {
|
|
15 |
* @since 4.9
|
16 |
*/
|
17 |
class Wcal_Tracking_msg {
|
18 |
-
|
19 |
public function __construct() {
|
20 |
-
// Checkout page notice for guest users
|
21 |
-
add_filter( 'woocommerce_checkout_fields' , array( &$this, 'wcal_add_gdpr_msg' ), 10, 1 );
|
22 |
// Product page notice for logged in users
|
23 |
add_action( 'woocommerce_after_add_to_cart_button', array( &$this, 'wcal_add_logged_msg' ), 10 );
|
24 |
-
|
25 |
-
add_action( 'woocommerce_before_shop_loop', array( &$this, 'wcal_add_logged_msg' ), 10 );
|
26 |
-
//add_action( 'woocommerce_after_shop_loop_item', array( &$this, 'wcal_add_logged_msg' ), 10 );
|
27 |
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Adds a message to be displayed above Billing_email
|
31 |
-
* field on Checkout page for guest users.
|
32 |
-
*
|
33 |
-
* @param array $fields - List of fields on Checkout page
|
34 |
-
* @return array $fields - List of fields on Checkout page
|
35 |
-
*
|
36 |
-
* @hook woocommerce_checkout_fields
|
37 |
-
* @since 4.9
|
38 |
-
*/
|
39 |
-
static function wcal_add_gdpr_msg( $fields ) {
|
40 |
-
|
41 |
-
if ( ! is_user_logged_in() ) {
|
42 |
-
// check if any message is present in the settings
|
43 |
-
$guest_msg = get_option( 'wcal_guest_cart_capture_msg' );
|
44 |
-
|
45 |
-
if ( isset( $guest_msg ) && '' != $guest_msg ) {
|
46 |
-
$existing_label = $fields[ 'billing' ][ 'billing_email' ][ 'label' ];
|
47 |
-
$fields[ 'billing' ][ 'billing_email' ][ 'label' ] = $existing_label . "<br><small>$guest_msg</small>";
|
48 |
-
}
|
49 |
-
}
|
50 |
-
return $fields;
|
51 |
-
}
|
52 |
-
|
53 |
/**
|
54 |
* Adds a message to be displayed for logged in users
|
55 |
* Called on Shop & Product page
|
56 |
-
*
|
57 |
* @hook woocommerce_after_add_to_cart_button
|
58 |
* woocommerce_before_shop_loop
|
59 |
-
* @since 4.9
|
60 |
*/
|
61 |
static function wcal_add_logged_msg() {
|
62 |
if ( is_user_logged_in() ) {
|
63 |
-
|
64 |
$registered_msg = get_option( 'wcal_logged_cart_capture_msg' );
|
|
|
65 |
|
66 |
-
if
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
}
|
70 |
}
|
71 |
-
|
72 |
} // end of class
|
73 |
$Wcal_Tracking_msg = new Wcal_Tracking_msg();
|
74 |
} // end IF
|
15 |
* @since 4.9
|
16 |
*/
|
17 |
class Wcal_Tracking_msg {
|
18 |
+
|
19 |
public function __construct() {
|
|
|
|
|
20 |
// Product page notice for logged in users
|
21 |
add_action( 'woocommerce_after_add_to_cart_button', array( &$this, 'wcal_add_logged_msg' ), 10 );
|
22 |
+
add_action( 'wp_ajax_wcal_gdpr_refused', array( 'wcal_common', 'wcal_gdpr_refused' ) );
|
|
|
|
|
23 |
}
|
24 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Adds a message to be displayed for logged in users
|
27 |
* Called on Shop & Product page
|
28 |
+
*
|
29 |
* @hook woocommerce_after_add_to_cart_button
|
30 |
* woocommerce_before_shop_loop
|
31 |
+
* @since 4.9
|
32 |
*/
|
33 |
static function wcal_add_logged_msg() {
|
34 |
if ( is_user_logged_in() ) {
|
35 |
+
|
36 |
$registered_msg = get_option( 'wcal_logged_cart_capture_msg' );
|
37 |
+
$gdpr_consent = get_user_meta( get_current_user_id(), 'wcal_gdpr_tracking_choice', true );
|
38 |
|
39 |
+
if( $gdpr_consent === '' ) {
|
40 |
+
$gdpr_consent = true;
|
41 |
+
}
|
42 |
+
|
43 |
+
if ( isset( $registered_msg ) && '' != $registered_msg && $gdpr_consent ) {
|
44 |
+
wp_enqueue_script(
|
45 |
+
'wcal_registered_capture',
|
46 |
+
plugins_url( '../assets/js/wcal_registered_user_capture.js', __FILE__ ),
|
47 |
+
'',
|
48 |
+
'',
|
49 |
+
true
|
50 |
+
);
|
51 |
+
|
52 |
+
$vars = array(
|
53 |
+
'_gdpr_after_no_thanks_msg' => htmlspecialchars( get_option( 'wcal_gdpr_opt_out_message' ), ENT_QUOTES ),
|
54 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
55 |
+
);
|
56 |
+
|
57 |
+
wp_localize_script(
|
58 |
+
'wcal_registered_capture',
|
59 |
+
'wcal_registered_capture_params',
|
60 |
+
$vars
|
61 |
+
);
|
62 |
+
|
63 |
+
$registered_msg .= " <span id='wcal_gdpr_no_thanks'><a style='cursor: pointer' id='wcal_gdpr_no_thanks'>" . htmlspecialchars( get_option( 'wcal_gdpr_allow_opt_out' ), ENT_QUOTES ) . "</a></span>";
|
64 |
+
echo "<span id='wcal_gdpr_message_block'><p><small>" . $registered_msg . "</small></p></span>";
|
65 |
}
|
66 |
}
|
67 |
}
|
68 |
+
|
69 |
} // end of class
|
70 |
$Wcal_Tracking_msg = new Wcal_Tracking_msg();
|
71 |
} // end IF
|
readme.txt
CHANGED
@@ -193,6 +193,13 @@ You can refer **[here](https://www.tychesoftwares.com/differences-between-pro-an
|
|
193 |
|
194 |
== Changelog ==
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
= 5.4 (10.07.2019) =
|
197 |
|
198 |
* Bug - Fixed an issue where carts were being marked as abandoned even after they have been successfully recovered.
|
193 |
|
194 |
== Changelog ==
|
195 |
|
196 |
+
= 5.5 (12.08.2019) =
|
197 |
+
|
198 |
+
* Enhancement - Added a setting to allow the admin the ability to enable/disable the sending of reminder emails.
|
199 |
+
* Tweak - Added a setting to allow the admin to add text for GDPR messages which will be displayed as links and allows the end user to opt out of cart tracking.
|
200 |
+
* Bug - Fixed some warnings displayed from the plugin.
|
201 |
+
* Bug - Carts were not accessible for guest users from links in the reminder emails.
|
202 |
+
|
203 |
= 5.4 (10.07.2019) =
|
204 |
|
205 |
* Bug - Fixed an issue where carts were being marked as abandoned even after they have been successfully recovered.
|
uninstall.php
CHANGED
@@ -106,4 +106,5 @@ delete_option( 'wcal_logged_cart_capture_msg' );
|
|
106 |
delete_option( 'ac_lite_delete_abandoned_order_days' );
|
107 |
delete_option( 'wcal_new_default_templates' );
|
108 |
|
109 |
-
delete_option( 'ac_lite_delete_redundant_queries' );
|
|
106 |
delete_option( 'ac_lite_delete_abandoned_order_days' );
|
107 |
delete_option( 'wcal_new_default_templates' );
|
108 |
|
109 |
+
delete_option( 'ac_lite_delete_redundant_queries' );
|
110 |
+
delete_option( 'wcal_enable_cart_emails' );
|
woocommerce-ac.php
CHANGED
@@ -1,11 +1,11 @@
|
|
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.
|
6 |
-
* <strong><a href="http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro">Click here to get the
|
7 |
* PRO Version.</a></strong>
|
8 |
-
* Version: 5.
|
9 |
* Author: Tyche Softwares
|
10 |
* Author URI: http://www.tychesoftwares.com/
|
11 |
* Text Domain: woocommerce-abandoned-cart
|
@@ -44,7 +44,7 @@ add_filter( 'cron_schedules', 'wcal_add_cron_schedule' );
|
|
44 |
* @since 1.3
|
45 |
* @package Abandoned-Cart-Lite-for-WooCommerce/Cron
|
46 |
*/
|
47 |
-
function wcal_add_cron_schedule( $schedules ) {
|
48 |
$schedules['15_minutes_lite'] = array(
|
49 |
'interval' => 900, // 15 minutes in seconds
|
50 |
'display' => __( 'Once Every Fifteen Minutes' ),
|
@@ -56,7 +56,7 @@ function wcal_add_cron_schedule( $schedules ) {
|
|
56 |
* Schedule an action if it's not already scheduled.
|
57 |
* @since 1.3
|
58 |
* @package Abandoned-Cart-Lite-for-WooCommerce/Cron
|
59 |
-
*/
|
60 |
if ( ! wp_next_scheduled( 'woocommerce_ac_send_email_action' ) ) {
|
61 |
wp_schedule_event( time(), '15_minutes_lite', 'woocommerce_ac_send_email_action' );
|
62 |
}
|
@@ -70,7 +70,7 @@ if( ! wp_next_scheduled( 'wcal_clear_carts' ) ) {
|
|
70 |
wp_schedule_event( time(), 'daily', 'wcal_clear_carts' );
|
71 |
}
|
72 |
/**
|
73 |
-
* Hook into that action that'll fire every 15 minutes
|
74 |
*/
|
75 |
add_action( 'woocommerce_ac_send_email_action', 'wcal_send_email_cron' );
|
76 |
|
@@ -89,10 +89,10 @@ function wcal_send_email_cron() {
|
|
89 |
* woocommerce_abandon_cart_lite class
|
90 |
**/
|
91 |
if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
92 |
-
|
93 |
|
94 |
/**
|
95 |
-
* It will add the hooks, filters, menu and the variables and all the necessary actions for the plguins which will be used
|
96 |
* all over the plugin.
|
97 |
* @since 1.0
|
98 |
* @package Abandoned-Cart-Lite-for-WooCommerce/Core
|
@@ -103,33 +103,33 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
103 |
var $six_hours;
|
104 |
var $twelve_hours;
|
105 |
var $one_day;
|
106 |
-
var $one_week;
|
107 |
var $duration_range_select = array();
|
108 |
var $start_end_dates = array();
|
109 |
/**
|
110 |
* The constructor will add the hooks, filters and the variable which will be used all over the plugin.
|
111 |
* @since 1.0
|
112 |
-
*
|
113 |
*/
|
114 |
-
public function __construct() {
|
115 |
if ( !defined( 'WCAL_PLUGIN_URL' ) ) {
|
116 |
define('WCAL_PLUGIN_URL', untrailingslashit(plugins_url('/', __FILE__)) );
|
117 |
-
}
|
118 |
$this->one_hour = 60 * 60;
|
119 |
$this->three_hours = 3 * $this->one_hour;
|
120 |
$this->six_hours = 6 * $this->one_hour;
|
121 |
$this->twelve_hours = 12 * $this->one_hour;
|
122 |
$this->one_day = 24 * $this->one_hour;
|
123 |
-
$this->one_week = 7 * $this->one_day;
|
124 |
$this->duration_range_select = array( 'yesterday' => 'Yesterday',
|
125 |
'today' => 'Today',
|
126 |
'last_seven' => 'Last 7 days',
|
127 |
'last_fifteen' => 'Last 15 days',
|
128 |
'last_thirty' => 'Last 30 days',
|
129 |
'last_ninety' => 'Last 90 days',
|
130 |
-
'last_year_days' => 'Last 365'
|
131 |
);
|
132 |
-
|
133 |
$this->start_end_dates = array( 'yesterday' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 24*60*60 ) ),
|
134 |
'end_date' => date( "d M Y", ( current_time( 'timestamp' ) - 7*24*60*60 ) ) ),
|
135 |
'today' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ),
|
@@ -143,19 +143,19 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
143 |
'last_ninety' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 90*24*60*60 ) ),
|
144 |
'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
|
145 |
'last_year_days' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 365*24*60*60 ) ),
|
146 |
-
'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) )
|
147 |
);
|
148 |
-
|
149 |
// Initialize settings
|
150 |
register_activation_hook ( __FILE__, array( &$this, 'wcal_activate' ) );
|
151 |
|
152 |
// Background Processing for Cron
|
153 |
require_once( 'cron/wcal_send_email.php' );
|
154 |
require_once( 'includes/background-processes/wcal_process_base.php' );
|
155 |
-
|
156 |
-
// WordPress Administration Menu
|
157 |
add_action ( 'admin_menu', array( &$this, 'wcal_admin_menu' ) );
|
158 |
-
|
159 |
// Actions to be done on cart update
|
160 |
add_action( 'woocommerce_add_to_cart', array( &$this, 'wcal_store_cart_timestamp' ), 100 );
|
161 |
add_action( 'woocommerce_cart_item_removed', array( &$this, 'wcal_store_cart_timestamp' ), 100 );
|
@@ -164,48 +164,48 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
164 |
add_action( 'woocommerce_calculate_totals', array( &$this, 'wcal_store_cart_timestamp' ), 100 );
|
165 |
|
166 |
add_action ( 'admin_init', array( &$this, 'wcal_action_admin_init' ) );
|
167 |
-
|
168 |
// Update the options as per settings API
|
169 |
add_action ( 'admin_init', array( &$this, 'wcal_update_db_check' ) );
|
170 |
|
171 |
// Wordpress settings API
|
172 |
add_action( 'admin_init', array( &$this, 'wcal_initialize_plugin_options' ) );
|
173 |
-
|
174 |
// Language Translation
|
175 |
add_action ( 'init', array( &$this, 'wcal_update_po_file' ) );
|
176 |
|
177 |
add_action ( 'init', array ( &$this, 'wcal_add_component_file') );
|
178 |
-
|
179 |
// track links
|
180 |
add_filter( 'template_include', array( &$this, 'wcal_email_track_links' ), 99, 1 );
|
181 |
-
|
182 |
//It will used to unsubcribe the emails.
|
183 |
add_action( 'template_include', array( &$this, 'wcal_email_unsubscribe'),99, 1 );
|
184 |
-
|
185 |
add_action ( 'admin_enqueue_scripts', array( &$this, 'wcal_enqueue_scripts_js' ) );
|
186 |
add_action ( 'admin_enqueue_scripts', array( &$this, 'wcal_enqueue_scripts_css' ) );
|
187 |
//delete abandoned order after X number of days
|
188 |
if ( class_exists( 'wcal_delete_bulk_action_handler' ) ) {
|
189 |
add_action( 'wcal_clear_carts', array( 'wcal_delete_bulk_action_handler', 'wcal_delete_abandoned_carts_after_x_days' ) );
|
190 |
}
|
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 |
-
add_action ( 'wp_ajax_wcal_toggle_template_status', array( &$this, 'wcal_toggle_template_status' ) );
|
197 |
|
198 |
add_filter( 'ts_tracker_data', array( 'wcal_common', 'ts_add_plugin_tracking_data' ), 10, 1 );
|
199 |
add_filter( 'ts_tracker_opt_out_data', array( 'wcal_common', 'ts_get_data_for_opt_out' ), 10, 1 );
|
200 |
add_filter( 'ts_deativate_plugin_questions', array( &$this, 'wcal_deactivate_add_questions' ), 10, 1 );
|
201 |
}
|
202 |
-
|
203 |
// Plugin Settings link in WP->Plugins page
|
204 |
$plugin = plugin_basename( __FILE__ );
|
205 |
add_action( "plugin_action_links_$plugin", array( &$this, 'wcal_settings_link' ) );
|
206 |
-
|
207 |
add_action( 'admin_init', array( $this, 'wcal_preview_emails' ) );
|
208 |
-
add_action( 'init', array( $this, 'wcal_app_output_buffer') );
|
209 |
|
210 |
add_filter( 'admin_footer_text', array( $this, 'wcal_admin_footer_text' ), 1 );
|
211 |
|
@@ -213,7 +213,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
213 |
|
214 |
include_once 'includes/frontend/wcal_frontend.php';
|
215 |
}
|
216 |
-
|
217 |
/**
|
218 |
* Add Settings link to WP->Plugins page
|
219 |
* @since 5.3.0
|
@@ -232,7 +232,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
232 |
public static function wcal_add_component_file () {
|
233 |
if ( is_admin() ) {
|
234 |
require_once( 'includes/wcal_all_component.php' );
|
235 |
-
|
236 |
}
|
237 |
}
|
238 |
/**
|
@@ -249,7 +249,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
249 |
'text' => __( "Emails are not being sent to customers.", "woocommerce-abandoned-cart" ),
|
250 |
'input_type' => '',
|
251 |
'input_placeholder' => ''
|
252 |
-
),
|
253 |
1 => array(
|
254 |
'id' => 5,
|
255 |
'text' => __( "Capturing of cart and other information was not satisfactory.", "woocommerce-abandoned-cart" ),
|
@@ -288,9 +288,9 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
288 |
$message = '';
|
289 |
// create a new email
|
290 |
if ( $woocommerce->version < '2.3' ) {
|
291 |
-
global $email_heading;
|
292 |
ob_start();
|
293 |
-
|
294 |
include( 'views/wcal-wc-email-template-preview.php' );
|
295 |
$mailer = WC()->mailer();
|
296 |
$message = ob_get_clean();
|
@@ -298,22 +298,22 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
298 |
$message = $mailer->wrap_message( $email_heading, $message );
|
299 |
} else {
|
300 |
// load the mailer class
|
301 |
-
$mailer = WC()->mailer();
|
302 |
// get the preview email subject
|
303 |
-
$email_heading = __( 'Abandoned cart Email Template', 'woocommerce-abandoned-cart' );
|
304 |
// get the preview email content
|
305 |
ob_start();
|
306 |
include( 'views/wcal-wc-email-template-preview.php' );
|
307 |
-
$message = ob_get_clean();
|
308 |
// create a new email
|
309 |
-
$email = new WC_Email();
|
310 |
// wrap the content with the email template and then add styles
|
311 |
$message = $email->style_inline( $mailer->wrap_message( $email_heading, $message ) );
|
312 |
-
}
|
313 |
echo $message;
|
314 |
exit;
|
315 |
}
|
316 |
-
|
317 |
if ( isset( $_GET['wcal_preview_mail'] ) ) {
|
318 |
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-abandoned-cart' ) ) {
|
319 |
die( 'Security check' );
|
@@ -321,7 +321,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
321 |
// get the preview email content
|
322 |
ob_start();
|
323 |
include( 'views/wcal-email-template-preview.php' );
|
324 |
-
$message = ob_get_clean();
|
325 |
// print the preview email
|
326 |
echo $message;
|
327 |
exit;
|
@@ -348,20 +348,20 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
348 |
load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/i18n/languages/' );
|
349 |
}
|
350 |
}
|
351 |
-
|
352 |
/**
|
353 |
* It will create the plugin tables & the options reqired for plugin.
|
354 |
* @hook register_activation_hook
|
355 |
* @globals mixed $wpdb
|
356 |
* @since 1.0
|
357 |
-
*/
|
358 |
function wcal_activate() {
|
359 |
-
global $wpdb;
|
360 |
$wcap_collate = '';
|
361 |
if ( $wpdb->has_cap( 'collation' ) ) {
|
362 |
$wcap_collate = $wpdb->get_charset_collate();
|
363 |
}
|
364 |
-
$table_name = $wpdb->prefix . "ac_email_templates_lite";
|
365 |
$sql = "CREATE TABLE IF NOT EXISTS $table_name (
|
366 |
`id` int(11) NOT NULL AUTO_INCREMENT,
|
367 |
`subject` text NOT NULL,
|
@@ -375,24 +375,24 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
375 |
`wc_email_header` varchar(50) NOT NULL,
|
376 |
PRIMARY KEY (`id`)
|
377 |
) $wcap_collate AUTO_INCREMENT=1 ";
|
378 |
-
|
379 |
require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
380 |
dbDelta( $sql );
|
381 |
-
|
382 |
// $table_name = $wpdb->prefix . "ac_email_templates_lite";
|
383 |
// $check_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'is_wc_template' ";
|
384 |
// $results = $wpdb->get_results( $check_template_table_query );
|
385 |
-
|
386 |
// if ( count( $results ) == 0 ) {
|
387 |
// $alter_template_table_query = "ALTER TABLE $table_name
|
388 |
// ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8mb4_unicode_ci NOT NULL AFTER `template_name`,
|
389 |
// ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
|
390 |
-
|
391 |
// $wpdb->get_results( $alter_template_table_query );
|
392 |
// }
|
393 |
-
|
394 |
$sent_table_name = $wpdb->prefix . "ac_sent_history_lite";
|
395 |
-
|
396 |
$sql_query = "CREATE TABLE IF NOT EXISTS $sent_table_name (
|
397 |
`id` int(11) NOT NULL auto_increment,
|
398 |
`template_id` varchar(40) collate utf8_unicode_ci NOT NULL,
|
@@ -401,12 +401,12 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
401 |
`sent_email_id` text COLLATE utf8_unicode_ci NOT NULL,
|
402 |
PRIMARY KEY (`id`)
|
403 |
) $wcap_collate AUTO_INCREMENT=1 ";
|
404 |
-
|
405 |
require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
406 |
dbDelta ( $sql_query );
|
407 |
-
|
408 |
$ac_history_table_name = $wpdb->prefix . "ac_abandoned_cart_history_lite";
|
409 |
-
|
410 |
$history_query = "CREATE TABLE IF NOT EXISTS $ac_history_table_name (
|
411 |
`id` int(11) NOT NULL AUTO_INCREMENT,
|
412 |
`user_id` int(11) NOT NULL,
|
@@ -419,13 +419,13 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
419 |
`session_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
|
420 |
PRIMARY KEY (`id`)
|
421 |
) $wcap_collate";
|
422 |
-
|
423 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
424 |
dbDelta( $history_query );
|
425 |
// Default templates: function call to create default templates.
|
426 |
$check_table_empty = $wpdb->get_var( "SELECT COUNT(*) FROM `" . $wpdb->prefix . "ac_email_templates_lite`" );
|
427 |
-
|
428 |
-
if ( ! get_option( 'wcal_new_default_templates' ) ) {
|
429 |
if ( 0 == $check_table_empty ) {
|
430 |
$default_template = new wcal_default_template_settings;
|
431 |
$default_template->wcal_create_default_templates();
|
@@ -435,8 +435,8 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
435 |
|
436 |
$guest_table = $wpdb->prefix."ac_guest_abandoned_cart_history_lite" ;
|
437 |
$query_guest_table = "SHOW TABLES LIKE '$guest_table' ";
|
438 |
-
$result_guest_table = $wpdb->get_results( $query_guest_table );
|
439 |
-
|
440 |
if ( 0 == count( $result_guest_table ) ) {
|
441 |
$ac_guest_history_table_name = $wpdb->prefix . "ac_guest_abandoned_cart_history_lite";
|
442 |
$ac_guest_history_query = "CREATE TABLE IF NOT EXISTS $ac_guest_history_table_name (
|
@@ -466,7 +466,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
466 |
) $wcap_collate AUTO_INCREMENT=63000000";
|
467 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
|
468 |
$wpdb->query( $ac_guest_history_query );
|
469 |
-
}
|
470 |
|
471 |
/**
|
472 |
* This is add for thos user who Install the plguin first time.
|
@@ -474,7 +474,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
474 |
*/
|
475 |
if ( ! get_option( 'ac_lite_track_guest_cart_from_cart_page' ) ) {
|
476 |
add_option( 'ac_lite_track_guest_cart_from_cart_page', 'on' );
|
477 |
-
}
|
478 |
if ( ! get_option( 'wcal_from_name' ) ) {
|
479 |
add_option( 'wcal_from_name', 'Admin' );
|
480 |
}
|
@@ -482,14 +482,14 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
482 |
if ( ! get_option( 'wcal_from_email' ) ) {
|
483 |
add_option( 'wcal_from_email', $wcal_get_admin_email );
|
484 |
}
|
485 |
-
|
486 |
if ( ! get_option( 'wcal_reply_email' ) ) {
|
487 |
add_option( 'wcal_reply_email', $wcal_get_admin_email );
|
488 |
}
|
489 |
|
490 |
do_action( 'wcal_activate' );
|
491 |
-
}
|
492 |
-
|
493 |
/**
|
494 |
* It will add the section, field, & registres the plugin fields using Settings API.
|
495 |
* @hook admin_init
|
@@ -504,7 +504,16 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
504 |
array( $this, 'ac_lite_general_options_callback' ), // Callback used to render the description of the section
|
505 |
'woocommerce_ac_page' // Page on which to add this section of options
|
506 |
);
|
507 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
add_settings_field(
|
509 |
'ac_lite_cart_abandoned_time',
|
510 |
__( 'Cart abandoned cut-off time', 'woocommerce-abandoned-cart' ),
|
@@ -523,7 +532,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
523 |
array( __( 'Automatically delete abandoned cart orders after X days.', 'woocommerce-abandoned-cart' ) )
|
524 |
);
|
525 |
|
526 |
-
|
527 |
add_settings_field(
|
528 |
'ac_lite_email_admin_on_recovery',
|
529 |
__( 'Email admin On Order Recovery', 'woocommerce-abandoned-cart' ),
|
@@ -533,7 +542,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
533 |
array( __( 'Sends email to Admin if an Abandoned Cart Order is recovered.', 'woocommerce-abandoned-cart' ) )
|
534 |
);
|
535 |
|
536 |
-
|
537 |
add_settings_field(
|
538 |
'ac_lite_track_guest_cart_from_cart_page',
|
539 |
__( 'Start tracking from Cart Page', 'woocommerce-abandoned-cart' ),
|
@@ -551,7 +560,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
551 |
'ac_lite_general_settings_section',
|
552 |
array( __( '<br>In compliance with GDPR, add a message on the Checkout page to inform Guest users of how their data is being used.<br><i>For example: Your email address will help us support your shopping experience throughout the site. Please check our Privacy Policy to see how we use your personal data.</i>', 'woocommerce-abandoned-cart' ) )
|
553 |
);
|
554 |
-
|
555 |
add_settings_field(
|
556 |
'wcal_logged_cart_capture_msg',
|
557 |
__( 'Message to be displayed for registered users when tracking their carts.', 'woocommerce-abandoned-cart' ),
|
@@ -560,19 +569,37 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
560 |
'ac_lite_general_settings_section',
|
561 |
array( __( '<br>In compliance with GDPR, add a message on the Shop & Product pages to inform Registered users of how their data is being used.<br><i>For example: Please check our Privacy Policy to see how we use your personal data.</i>', 'woocommerce-abandoned-cart' ) )
|
562 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
564 |
/**
|
565 |
* New section for the Adding the abandoned cart setting.
|
566 |
* @since 4.7
|
567 |
*/
|
568 |
-
|
569 |
add_settings_section(
|
570 |
'ac_email_settings_section', // ID used to identify this section and with which to register options
|
571 |
__( 'Settings for abandoned cart recovery emails', 'woocommerce-abandoned-cart' ), // Title to be displayed on the administration page
|
572 |
array( $this, 'wcal_email_callback' ), // Callback used to render the description of the section
|
573 |
'woocommerce_ac_email_page' // Page on which to add this section of options
|
574 |
);
|
575 |
-
|
576 |
add_settings_field(
|
577 |
'wcal_from_name',
|
578 |
__( '"From" Name', 'woocommerce-abandoned-cart' ),
|
@@ -581,7 +608,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
581 |
'ac_email_settings_section',
|
582 |
array( 'Enter the name that should appear in the email sent.', 'woocommerce-abandoned-cart' )
|
583 |
);
|
584 |
-
|
585 |
add_settings_field(
|
586 |
'wcal_from_email',
|
587 |
__( '"From" Address', 'woocommerce-abandoned-cart' ),
|
@@ -590,7 +617,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
590 |
'ac_email_settings_section',
|
591 |
array( 'Email address from which the reminder emails should be sent.', 'woocommerce-abandoned-cart' )
|
592 |
);
|
593 |
-
|
594 |
add_settings_field(
|
595 |
'wcal_reply_email',
|
596 |
__( 'Send Reply Emails to', 'woocommerce-abandoned-cart' ),
|
@@ -599,8 +626,13 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
599 |
'ac_email_settings_section',
|
600 |
array( 'When a contact receives your email and clicks reply, which email address should that reply be sent to?', 'woocommerce-abandoned-cart' )
|
601 |
);
|
602 |
-
|
603 |
// Finally, we register the fields with WordPress
|
|
|
|
|
|
|
|
|
|
|
604 |
register_setting(
|
605 |
'woocommerce_ac_settings',
|
606 |
'ac_lite_cart_abandoned_time',
|
@@ -612,12 +644,12 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
612 |
'ac_lite_delete_abandoned_order_days',
|
613 |
array ( $this, 'wcal_delete_days_validation' )
|
614 |
);
|
615 |
-
|
616 |
register_setting(
|
617 |
'woocommerce_ac_settings',
|
618 |
'ac_lite_email_admin_on_recovery'
|
619 |
);
|
620 |
-
|
621 |
register_setting(
|
622 |
'woocommerce_ac_settings',
|
623 |
'ac_lite_track_guest_cart_from_cart_page'
|
@@ -627,12 +659,22 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
627 |
'woocommerce_ac_settings',
|
628 |
'wcal_guest_cart_capture_msg'
|
629 |
);
|
630 |
-
|
631 |
register_setting(
|
632 |
'woocommerce_ac_settings',
|
633 |
'wcal_logged_cart_capture_msg'
|
634 |
);
|
635 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
636 |
register_setting(
|
637 |
'woocommerce_ac_email_settings',
|
638 |
'wcal_from_name'
|
@@ -648,15 +690,31 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
648 |
|
649 |
do_action ( "wcal_add_new_settings" );
|
650 |
}
|
651 |
-
|
652 |
/**
|
653 |
* Settings API callback for section "ac_lite_general_settings_section".
|
654 |
* @since 2.5
|
655 |
*/
|
656 |
function ac_lite_general_options_callback() {
|
657 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
}
|
659 |
-
|
660 |
/**
|
661 |
* Settings API callback for cart time field.
|
662 |
* @param array $args Arguments
|
@@ -675,7 +733,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
675 |
$html = '<label for="ac_lite_cart_abandoned_time"> ' . $args[0] . '</label>';
|
676 |
echo $html;
|
677 |
}
|
678 |
-
|
679 |
/**
|
680 |
* Settings API cart time field validation.
|
681 |
* @param int | string $input
|
@@ -726,20 +784,20 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
726 |
$html = '<label for="ac_lite_delete_abandoned_order_days"> ' . $args[0] . '</label>';
|
727 |
echo $html;
|
728 |
}
|
729 |
-
|
730 |
/**
|
731 |
* Settings API callback for email admin on cart recovery field.
|
732 |
* @param array $args Arguments
|
733 |
* @since 2.5
|
734 |
*/
|
735 |
-
function ac_lite_email_admin_on_recovery( $args ) {
|
736 |
// First, we read the option
|
737 |
$email_admin_on_recovery = get_option( 'ac_lite_email_admin_on_recovery' );
|
738 |
-
|
739 |
// This condition added to avoid the notie displyed while Check box is unchecked.
|
740 |
if ( isset( $email_admin_on_recovery ) && '' == $email_admin_on_recovery ) {
|
741 |
$email_admin_on_recovery = 'off';
|
742 |
-
}
|
743 |
// Next, we update the name attribute to access this element's ID in the context of the display options array
|
744 |
// We also access the show_header element of the options collection in the call to the checked() helper function
|
745 |
$html='';
|
@@ -747,7 +805,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
747 |
'<input type="checkbox" id="ac_lite_email_admin_on_recovery" name="ac_lite_email_admin_on_recovery" value="on"
|
748 |
' . checked('on', $email_admin_on_recovery, false).' />'
|
749 |
);
|
750 |
-
|
751 |
// Here, we'll take the first argument of the array and add it to a label next to the checkbox
|
752 |
$html .= '<label for="ac_lite_email_admin_on_recovery"> ' . $args[0] . '</label>';
|
753 |
echo $html;
|
@@ -760,7 +818,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
760 |
function wcal_track_guest_cart_from_cart_page_callback( $args ) {
|
761 |
// First, we read the option
|
762 |
$disable_guest_cart_from_cart_page = get_option( 'ac_lite_track_guest_cart_from_cart_page' );
|
763 |
-
|
764 |
// This condition added to avoid the notice displyed while Check box is unchecked.
|
765 |
if ( isset( $disable_guest_cart_from_cart_page ) && '' == $disable_guest_cart_from_cart_page ) {
|
766 |
$disable_guest_cart_from_cart_page = 'off';
|
@@ -768,7 +826,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
768 |
// Next, we update the name attribute to access this element's ID in the context of the display options array
|
769 |
// We also access the show_header element of the options collection in the call to the checked() helper function
|
770 |
$html = '';
|
771 |
-
|
772 |
printf(
|
773 |
'<input type="checkbox" id="ac_lite_track_guest_cart_from_cart_page" name="ac_lite_track_guest_cart_from_cart_page" value="on"
|
774 |
'.checked( 'on', $disable_guest_cart_from_cart_page, false ) . ' />' );
|
@@ -776,45 +834,74 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
776 |
$html .= '<label for="ac_lite_track_guest_cart_from_cart_page"> ' . $args[0] . '</label>';
|
777 |
echo $html;
|
778 |
}
|
779 |
-
|
780 |
/**
|
781 |
* Call back function for guest user cart capture message
|
782 |
* @param array $args Argument for adding field details
|
783 |
* @since 7.8
|
784 |
*/
|
785 |
public static function wcal_guest_cart_capture_msg_callback( $args ) {
|
786 |
-
|
787 |
$guest_msg = get_option( 'wcal_guest_cart_capture_msg' );
|
788 |
-
|
789 |
-
$html = "<textarea rows='4' cols='80' id='wcal_guest_cart_capture_msg' name='wcal_guest_cart_capture_msg'
|
790 |
-
|
791 |
$html .= '<label for="wcal_guest_cart_capture_msg"> ' . $args[0] . '</label>';
|
792 |
echo $html;
|
793 |
}
|
794 |
-
|
795 |
/**
|
796 |
* Call back function for registered user cart capture message
|
797 |
* @param array $args Argument for adding field details
|
798 |
* @since 7.8
|
799 |
*/
|
800 |
public static function wcal_logged_cart_capture_msg_callback( $args ) {
|
801 |
-
|
802 |
$logged_msg = get_option( 'wcal_logged_cart_capture_msg' );
|
803 |
-
|
804 |
-
$html = "<input type='text'
|
805 |
-
|
806 |
$html .= '<label for="wcal_logged_cart_capture_msg"> ' . $args[0] . '</label>';
|
807 |
echo $html;
|
808 |
}
|
809 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
810 |
/**
|
811 |
* Settings API callback for Abandoned cart email settings of the plugin.
|
812 |
* @since 3.5
|
813 |
*/
|
814 |
function wcal_email_callback () {
|
815 |
-
|
816 |
}
|
817 |
-
|
818 |
/**
|
819 |
* Settings API callback for from name used in Abandoned cart email.
|
820 |
* @param array $args Arguments
|
@@ -833,7 +920,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
833 |
$html = '<label for="wcal_from_name_label"> ' . $args[0] . '</label>';
|
834 |
echo $html;
|
835 |
}
|
836 |
-
|
837 |
/**
|
838 |
* Settings API callback for from email used in Abandoned cart email.
|
839 |
* @param array $args Arguments
|
@@ -852,7 +939,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
852 |
$html = '<label for="wcal_from_email_label"> ' . $args[0] . '</label>';
|
853 |
echo $html;
|
854 |
}
|
855 |
-
|
856 |
/**
|
857 |
* Settings API callback for reply email used in Abandoned cart email.
|
858 |
* @param array $args Arguments
|
@@ -880,17 +967,17 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
880 |
*/
|
881 |
function wcal_update_db_check() {
|
882 |
global $wpdb;
|
883 |
-
|
884 |
$wcal_previous_version = get_option( 'wcal_previous_version' );
|
885 |
|
886 |
if ( $wcal_previous_version != wcal_common::wcal_get_version() ) {
|
887 |
-
update_option( 'wcal_previous_version', '5.
|
888 |
}
|
889 |
|
890 |
/**
|
891 |
* This is used to prevent guest users wrong Id. If guest users id is less then 63000000 then this code will
|
892 |
* ensure that we will change the id of guest tables so it wont affect on the next guest users.
|
893 |
-
*/
|
894 |
if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_guest_abandoned_cart_history_lite';" ) && 'yes' != get_option( 'wcal_guest_user_id_altered' ) ) {
|
895 |
$last_id = $wpdb->get_var( "SELECT max(id) FROM `{$wpdb->prefix}ac_guest_abandoned_cart_history_lite`;" );
|
896 |
if ( NULL != $last_id && $last_id <= 63000000 ) {
|
@@ -899,37 +986,37 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
899 |
}
|
900 |
}
|
901 |
|
902 |
-
if( !get_option( 'wcal_new_default_templates' ) ) {
|
903 |
$default_template = new wcal_default_template_settings;
|
904 |
$default_template->wcal_create_default_templates();
|
905 |
add_option( 'wcal_new_default_templates', "yes" );
|
906 |
-
|
907 |
}
|
908 |
if ( 'yes' != get_option( 'ac_lite_alter_table_queries' ) ) {
|
909 |
$ac_history_table_name = $wpdb->prefix."ac_abandoned_cart_history_lite";
|
910 |
$check_table_query = "SHOW COLUMNS FROM $ac_history_table_name LIKE 'user_type'";
|
911 |
$results = $wpdb->get_results( $check_table_query );
|
912 |
-
|
913 |
if ( 0 == count( $results ) ) {
|
914 |
$alter_table_query = "ALTER TABLE $ac_history_table_name ADD `user_type` text AFTER `recovered_cart`";
|
915 |
$wpdb->get_results( $alter_table_query );
|
916 |
}
|
917 |
-
|
918 |
$table_name = $wpdb->prefix . "ac_email_templates_lite";
|
919 |
$check_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'is_wc_template' ";
|
920 |
$results = $wpdb->get_results( $check_template_table_query );
|
921 |
-
|
922 |
if ( 0 == count( $results ) ) {
|
923 |
$alter_template_table_query = "ALTER TABLE $table_name
|
924 |
ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8_unicode_ci NOT NULL AFTER `template_name`,
|
925 |
ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
|
926 |
$wpdb->get_results( $alter_template_table_query );
|
927 |
}
|
928 |
-
|
929 |
$table_name = $wpdb->prefix . "ac_email_templates_lite";
|
930 |
$check_email_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'wc_email_header' ";
|
931 |
$results_email = $wpdb->get_results( $check_email_template_table_query );
|
932 |
-
|
933 |
if ( 0 == count( $results_email ) ) {
|
934 |
$alter_email_template_table_query = "ALTER TABLE $table_name
|
935 |
ADD COLUMN `wc_email_header` varchar(50) NOT NULL AFTER `default_template`";
|
@@ -941,16 +1028,16 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
941 |
$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`;" );
|
942 |
}
|
943 |
}
|
944 |
-
|
945 |
if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_abandoned_cart_history_lite';" ) ) {
|
946 |
if ( ! $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}ac_abandoned_cart_history_lite` LIKE 'session_id';" ) ) {
|
947 |
$wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_abandoned_cart_history_lite ADD `session_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `unsubscribe_link`;" );
|
948 |
}
|
949 |
-
}
|
950 |
-
|
951 |
/**
|
952 |
* We have moved email templates fields in the setings section. SO to remove that fields column fro the db we need it.
|
953 |
-
* For existing user we need to fill this setting with the first template.
|
954 |
* @since 4.7
|
955 |
*/
|
956 |
if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_email_templates_lite';" ) ) {
|
@@ -959,53 +1046,53 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
959 |
$get_email_template_result = $wpdb->get_results ( $get_email_template_query );
|
960 |
$wcal_from_email = '';
|
961 |
if ( isset( $get_email_template_result ) && count ( $get_email_template_result ) > 0 ){
|
962 |
-
$wcal_from_email = $get_email_template_result[0]->from_email;
|
963 |
/* Store data in setings api*/
|
964 |
-
update_option ( 'wcal_from_email', $wcal_from_email );
|
965 |
/* Delete table from the Db*/
|
966 |
$wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_email_templates_lite DROP COLUMN `from_email`;" );
|
967 |
}
|
968 |
}
|
969 |
-
|
970 |
if ( $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}ac_email_templates_lite` LIKE 'from_name';" ) ) {
|
971 |
$get_email_template_from_name_query = "SELECT `from_name` FROM {$wpdb->prefix}ac_email_templates_lite WHERE `is_active` = '1' ORDER BY `id` ASC LIMIT 1";
|
972 |
$get_email_template_from_name_result = $wpdb->get_results ( $get_email_template_from_name_query );
|
973 |
$wcal_from_name = '';
|
974 |
if ( isset( $get_email_template_from_name_result ) && count ( $get_email_template_from_name_result ) > 0 ){
|
975 |
-
$wcal_from_name = $get_email_template_from_name_result[0]->from_name;
|
976 |
/* Store data in setings api*/
|
977 |
-
add_option ( 'wcal_from_name', $wcal_from_name );
|
978 |
/* Delete table from the Db*/
|
979 |
$wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_email_templates_lite DROP COLUMN `from_name`;" );
|
980 |
}
|
981 |
}
|
982 |
-
|
983 |
if ( $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}ac_email_templates_lite` LIKE 'reply_email';" ) ) {
|
984 |
$get_email_template_reply_email_query = "SELECT `reply_email` FROM {$wpdb->prefix}ac_email_templates_lite WHERE `is_active` = '1' ORDER BY `id` ASC LIMIT 1";
|
985 |
$get_email_template_reply_email_result = $wpdb->get_results ( $get_email_template_reply_email_query);
|
986 |
$wcal_reply_email = '';
|
987 |
if ( isset( $get_email_template_reply_email_result ) && count ( $get_email_template_reply_email_result ) > 0 ){
|
988 |
-
$wcal_reply_email = $get_email_template_reply_email_result[0]->reply_email;
|
989 |
/* Store data in setings api*/
|
990 |
-
update_option ( 'wcal_reply_email', $wcal_reply_email );
|
991 |
/* Delete table from the Db*/
|
992 |
$wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_email_templates_lite DROP COLUMN `reply_email`;" );
|
993 |
}
|
994 |
}
|
995 |
}
|
996 |
-
|
997 |
if ( ! get_option( 'wcal_security_key' ) ) {
|
998 |
update_option( 'wcal_security_key', 'qJB0rGtIn5UB1xG03efyCp' );
|
999 |
}
|
1000 |
|
1001 |
update_option( 'ac_lite_alter_table_queries', 'yes' );
|
1002 |
}
|
1003 |
-
|
1004 |
//get the option, if it is not set to individual then convert to individual records and delete the base record
|
1005 |
-
$ac_settings = get_option( 'ac_lite_settings_status' );
|
1006 |
if ( 'INDIVIDUAL' != $ac_settings ) {
|
1007 |
//fetch the existing settings and save them as inidividual to be used for the settings API
|
1008 |
-
$woocommerce_ac_settings = json_decode( get_option( 'woocommerce_ac_settings' ) );
|
1009 |
|
1010 |
if ( isset( $woocommerce_ac_settings[0]->cart_time ) ) {
|
1011 |
add_option( 'ac_lite_cart_abandoned_time', $woocommerce_ac_settings[0]->cart_time );
|
@@ -1018,7 +1105,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1018 |
} else {
|
1019 |
add_option( 'ac_lite_delete_abandoned_order_days', "" );
|
1020 |
}
|
1021 |
-
|
1022 |
if ( isset( $woocommerce_ac_settings[0]->email_admin ) ) {
|
1023 |
add_option( 'ac_lite_email_admin_on_recovery', $woocommerce_ac_settings[0]->email_admin );
|
1024 |
} else {
|
@@ -1045,7 +1132,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1045 |
}
|
1046 |
|
1047 |
if ( 'yes' !== get_option( 'ac_lite_user_cleanup' ) ) {
|
1048 |
-
$query_cleanup = "UPDATE `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` SET
|
1049 |
billing_first_name = IF (billing_first_name LIKE '%<%', '', billing_first_name),
|
1050 |
billing_last_name = IF (billing_last_name LIKE '%<%', '', billing_last_name),
|
1051 |
billing_company_name = IF (billing_company_name LIKE '%<%', '', billing_company_name),
|
@@ -1083,25 +1170,29 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1083 |
|
1084 |
update_option( 'ac_lite_remove_abandoned_data', 'yes' );
|
1085 |
}
|
|
|
|
|
|
|
|
|
1086 |
}
|
1087 |
-
|
1088 |
/**
|
1089 |
* Add a submenu page under the WooCommerce.
|
1090 |
* @hook admin_menu
|
1091 |
* @since 1.0
|
1092 |
-
*/
|
1093 |
function wcal_admin_menu() {
|
1094 |
$page = add_submenu_page ( 'woocommerce', __( 'Abandoned Carts', 'woocommerce-abandoned-cart' ), __( 'Abandoned Carts', 'woocommerce-abandoned-cart' ), 'manage_woocommerce', 'woocommerce_ac_page', array( &$this, 'wcal_menu_page' ) );
|
1095 |
}
|
1096 |
-
|
1097 |
/**
|
1098 |
* Capture the cart and insert the information of the cart into DataBase.
|
1099 |
* @hook woocommerce_cart_updated
|
1100 |
* @globals mixed $wpdb
|
1101 |
* @globals mixed $woocommerce
|
1102 |
* @since 1.0
|
1103 |
-
*/
|
1104 |
-
function wcal_store_cart_timestamp() {
|
1105 |
|
1106 |
if ( get_transient( 'wcal_email_sent_id' ) !== false ) {
|
1107 |
wcal_common::wcal_set_cart_session( 'email_sent_id', get_transient( 'wcal_email_sent_id' ) );
|
@@ -1114,175 +1205,201 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1114 |
|
1115 |
global $wpdb,$woocommerce;
|
1116 |
$current_time = current_time( 'timestamp' );
|
1117 |
-
$cut_off_time = get_option( 'ac_lite_cart_abandoned_time' );
|
1118 |
$track_guest_cart_from_cart_page = get_option( 'ac_lite_track_guest_cart_from_cart_page' );
|
1119 |
$cart_ignored = 0;
|
1120 |
-
$recovered_cart = 0;
|
1121 |
|
1122 |
-
$track_guest_user_cart_from_cart = "";
|
1123 |
if ( isset( $track_guest_cart_from_cart_page ) ) {
|
1124 |
$track_guest_user_cart_from_cart = $track_guest_cart_from_cart_page;
|
1125 |
}
|
1126 |
-
|
1127 |
if ( isset( $cut_off_time ) ) {
|
1128 |
$cart_cut_off_time = intval( $cut_off_time ) * 60;
|
1129 |
} else {
|
1130 |
$cart_cut_off_time = 60 * 60;
|
1131 |
-
}
|
1132 |
$compare_time = $current_time - $cart_cut_off_time;
|
1133 |
-
|
1134 |
-
if ( is_user_logged_in() ) {
|
|
|
1135 |
$user_id = get_current_user_id();
|
1136 |
-
$
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
|
1142 |
-
if
|
1143 |
-
$wcal_woocommerce_persistent_cart =version_compare( $woocommerce->version, '3.1.0', ">=" ) ? '_woocommerce_persistent_cart_' . get_current_blog_id() : '_woocommerce_persistent_cart' ;
|
1144 |
|
1145 |
-
$
|
|
|
|
|
|
|
|
|
1146 |
|
1147 |
-
if(
|
1148 |
-
$
|
1149 |
-
$user_type = "REGISTERED";
|
1150 |
-
$insert_query = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
|
1151 |
-
( user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type )
|
1152 |
-
VALUES ( %d, %s, %d, %s, %s )";
|
1153 |
-
$wpdb->query( $wpdb->prepare( $insert_query, $user_id, $cart_info,$current_time, $cart_ignored, $user_type ) );
|
1154 |
|
1155 |
-
$
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
$
|
1170 |
-
$
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1199 |
}
|
1200 |
}
|
1201 |
-
|
|
|
1202 |
//start here guest user
|
1203 |
$user_id = wcal_common::wcal_get_cart_session( 'user_id' );
|
1204 |
|
1205 |
-
|
1206 |
-
$
|
1207 |
-
$
|
1208 |
-
|
1209 |
-
|
1210 |
-
if ( function_exists('WC') ) {
|
1211 |
-
$cart['cart'] = WC()->session->cart;
|
1212 |
-
} else {
|
1213 |
-
$cart['cart'] = $woocommerce->session->cart;
|
1214 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1215 |
|
1216 |
-
|
1217 |
-
|
1218 |
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
|
|
|
|
|
|
1234 |
} else {
|
1235 |
-
|
1236 |
-
|
|
|
|
|
|
|
1237 |
} else {
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
if ( $blank_cart_info != $cart_info && '{"cart":[]}' != $cart_info ) {
|
1255 |
-
$insert_query = "INSERT INTO `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
|
1256 |
-
( abandoned_cart_info , abandoned_cart_time , cart_ignored , recovered_cart, user_type, session_id )
|
1257 |
-
VALUES ( '" . $cart_info."' , '" . $current_time . "' , '0' , '0' , 'GUEST', '". $get_cookie[0] ."' )";
|
1258 |
-
$wpdb->query( $insert_query );
|
1259 |
-
}
|
1260 |
-
} elseif ( $compare_time > $results[0]->abandoned_cart_time ) {
|
1261 |
-
$blank_cart_info = '[]';
|
1262 |
-
if ( $blank_cart_info != $updated_cart_info && '{"cart":[]}' != $updated_cart_info ) {
|
1263 |
-
if ( ! $this->wcal_compare_only_guest_carts( $updated_cart_info, $results[0]->abandoned_cart_info ) ) {
|
1264 |
-
$query_ignored = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` SET cart_ignored = '1' WHERE session_id ='" . $get_cookie[0] . "'";
|
1265 |
-
$wpdb->query( $query_ignored );
|
1266 |
-
$query_update = "INSERT INTO `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
|
1267 |
-
( abandoned_cart_info, abandoned_cart_time, cart_ignored, recovered_cart, user_type, session_id )
|
1268 |
-
VALUES ( '" . $updated_cart_info . "', '" . $current_time . "', '0', '0', 'GUEST', '". $get_cookie[0] ."' )";
|
1269 |
-
$wpdb->query( $query_update );
|
1270 |
}
|
1271 |
-
}
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1278 |
}
|
1279 |
}
|
|
|
|
|
|
|
|
|
1280 |
}
|
1281 |
}
|
1282 |
-
}
|
1283 |
}
|
1284 |
}
|
1285 |
-
|
1286 |
/**
|
1287 |
* It will unsubscribe the abandoned cart, so user will not recieve further abandoned cart emails.
|
1288 |
* @hook template_include
|
@@ -1293,29 +1410,29 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1293 |
*/
|
1294 |
function wcal_email_unsubscribe( $args ) {
|
1295 |
global $wpdb;
|
1296 |
-
|
1297 |
if ( isset( $_GET['wcal_track_unsubscribe'] ) && $_GET['wcal_track_unsubscribe'] == 'wcal_unsubscribe' ) {
|
1298 |
$encoded_email_id = rawurldecode( $_GET['validate'] );
|
1299 |
$validate_email_id_string = str_replace( " " , "+", $encoded_email_id );
|
1300 |
$validate_email_address_string = '';
|
1301 |
$validate_email_id_decode = 0;
|
1302 |
$cryptKey = get_option( 'wcal_security_key' );
|
1303 |
-
$validate_email_id_decode = Wcal_Aes_Ctr::decrypt( $validate_email_id_string, $cryptKey, 256 );
|
1304 |
if ( isset( $_GET['track_email_id'] ) ) {
|
1305 |
$encoded_email_address = rawurldecode( $_GET['track_email_id'] );
|
1306 |
$validate_email_address_string = str_replace( " " , "+", $encoded_email_address );
|
1307 |
}
|
1308 |
$query_id = "SELECT * FROM `" . $wpdb->prefix . "ac_sent_history_lite` WHERE id = %d ";
|
1309 |
$results_sent = $wpdb->get_results ( $wpdb->prepare( $query_id, $validate_email_id_decode ) );
|
1310 |
-
$email_address = '';
|
1311 |
if ( isset( $results_sent[0] ) ) {
|
1312 |
$email_address = $results_sent[0]->sent_email_id;
|
1313 |
-
}
|
1314 |
-
if ( $validate_email_address_string == hash( 'sha256', $email_address ) && '' != $email_address ) {
|
1315 |
$email_sent_id = $validate_email_id_decode;
|
1316 |
$get_ac_id_query = "SELECT abandoned_order_id FROM `" . $wpdb->prefix . "ac_sent_history_lite` WHERE id = %d";
|
1317 |
$get_ac_id_results = $wpdb->get_results( $wpdb->prepare( $get_ac_id_query , $email_sent_id ) );
|
1318 |
-
$user_id = 0;
|
1319 |
if ( isset( $get_ac_id_results[0] ) ) {
|
1320 |
$get_user_id_query = "SELECT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE id = %d";
|
1321 |
$get_user_results = $wpdb->get_results( $wpdb->prepare( $get_user_id_query , $get_ac_id_results[0]->abandoned_order_id ) );
|
@@ -1323,11 +1440,11 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1323 |
if ( isset( $get_user_results[0] ) ) {
|
1324 |
$user_id = $get_user_results[0]->user_id;
|
1325 |
}
|
1326 |
-
|
1327 |
$unsubscribe_query = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
|
1328 |
-
SET unsubscribe_link = '1'
|
1329 |
WHERE user_id= %d AND cart_ignored='0' ";
|
1330 |
-
$wpdb->query( $wpdb->prepare( $unsubscribe_query , $user_id ) );
|
1331 |
echo "Unsubscribed Successfully";
|
1332 |
sleep( 2 );
|
1333 |
$url = get_option( 'siteurl' );
|
@@ -1335,41 +1452,41 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1335 |
<script>
|
1336 |
location.href = "<?php echo $url; ?>";
|
1337 |
</script>
|
1338 |
-
<?php
|
1339 |
}
|
1340 |
} else {
|
1341 |
-
return $args;
|
1342 |
}
|
1343 |
}
|
1344 |
-
|
1345 |
/**
|
1346 |
* It will track the URL of cart link from email, and it will populate the logged-in and guest users cart.
|
1347 |
* @hook template_include
|
1348 |
-
* @param string $template
|
1349 |
* @return string $template
|
1350 |
* @globals mixed $wpdb
|
1351 |
* @globals mixed $woocommerce
|
1352 |
* @since 1.0
|
1353 |
-
*/
|
1354 |
-
function wcal_email_track_links( $template ) {
|
1355 |
global $woocommerce;
|
1356 |
$track_link = '';
|
1357 |
-
|
1358 |
-
if ( isset( $_GET['wcal_action'] ) ) {
|
1359 |
$track_link = $_GET['wcal_action'];
|
1360 |
-
}
|
1361 |
if ( $track_link == 'track_links' ) {
|
1362 |
if ( '' === session_id() ) {
|
1363 |
//session has not started
|
1364 |
session_start();
|
1365 |
-
}
|
1366 |
global $wpdb;
|
1367 |
$validate_server_string = rawurldecode( $_GET ['validate'] );
|
1368 |
$validate_server_string = str_replace( " " , "+", $validate_server_string );
|
1369 |
-
$validate_encoded_string = $validate_server_string;
|
1370 |
$cryptKey = get_option( 'wcal_security_key' );
|
1371 |
-
$link_decode = Wcal_Aes_Ctr::decrypt( $validate_encoded_string, $cryptKey, 256 );
|
1372 |
-
$sent_email_id_pos = strpos( $link_decode, '&' );
|
1373 |
$email_sent_id = substr( $link_decode , 0, $sent_email_id_pos );
|
1374 |
|
1375 |
wcal_common::wcal_set_cart_session( 'email_sent_id', $email_sent_id );
|
@@ -1377,7 +1494,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1377 |
|
1378 |
$url_pos = strpos( $link_decode, '=' );
|
1379 |
$url_pos = $url_pos + 1;
|
1380 |
-
$url = substr( $link_decode, $url_pos );
|
1381 |
$get_ac_id_query = "SELECT abandoned_order_id FROM `".$wpdb->prefix."ac_sent_history_lite` WHERE id = %d";
|
1382 |
$get_ac_id_results = $wpdb->get_results( $wpdb->prepare( $get_ac_id_query, $email_sent_id ) );
|
1383 |
|
@@ -1389,20 +1506,20 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1389 |
$get_user_id_query = "SELECT user_id FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE id = %d";
|
1390 |
$get_user_results = $wpdb->get_results( $wpdb->prepare( $get_user_id_query, $get_ac_id_results[0]->abandoned_order_id ) );
|
1391 |
}
|
1392 |
-
$user_id = 0;
|
1393 |
-
if ( isset( $get_user_results ) && count( $get_user_results ) > 0 ) {
|
1394 |
$user_id = $get_user_results[0]->user_id;
|
1395 |
-
}
|
1396 |
if ( 0 == $user_id ) {
|
1397 |
echo "Link expired";
|
1398 |
exit;
|
1399 |
-
}
|
1400 |
-
$user = wp_set_current_user( $user_id );
|
1401 |
if ( $user_id >= "63000000" ) {
|
1402 |
$query_guest = "SELECT * from `". $wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = %d";
|
1403 |
$results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $user_id ) );
|
1404 |
$query_cart = "SELECT recovered_cart FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id = %d";
|
1405 |
-
$results = $wpdb->get_results( $wpdb->prepare( $query_cart, $user_id ) );
|
1406 |
if ( $results_guest && $results[0]->recovered_cart == '0' ) {
|
1407 |
wcal_common::wcal_set_cart_session( 'guest_first_name', $results_guest[0]->billing_first_name );
|
1408 |
wcal_common::wcal_set_cart_session( 'guest_last_name', $results_guest[0]->billing_last_name );
|
@@ -1418,33 +1535,34 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1418 |
}
|
1419 |
}
|
1420 |
}
|
1421 |
-
|
1422 |
if ( $user_id < "63000000" ) {
|
1423 |
$user_login = $user->data->user_login;
|
1424 |
wp_set_auth_cookie( $user_id );
|
1425 |
$my_temp = wc_load_persistent_cart( $user_login, $user );
|
1426 |
-
do_action( 'wp_login', $user_login, $user );
|
1427 |
if ( isset( $sign_in ) && is_wp_error( $sign_in ) ) {
|
1428 |
echo $sign_in->get_error_message();
|
1429 |
exit;
|
1430 |
}
|
1431 |
-
} else
|
1432 |
$my_temp = $this->wcal_load_guest_persistent_cart( $user_id );
|
1433 |
-
|
1434 |
-
if ( $email_sent_id > 0 && is_numeric( $email_sent_id ) ) {
|
1435 |
-
|
|
|
1436 |
}
|
1437 |
} else
|
1438 |
return $template;
|
1439 |
}
|
1440 |
-
|
1441 |
/**
|
1442 |
-
* When customer clicks on the abandoned cart link and that cart is for the the guest users the it will load the guest
|
1443 |
* user's cart detail.
|
1444 |
* @globals mixed $woocommerce
|
1445 |
* @since 1.0
|
1446 |
-
*/
|
1447 |
-
function wcal_load_guest_persistent_cart() {
|
1448 |
if ( wcal_common::wcal_get_cart_session( 'user_id' ) != '' ) {
|
1449 |
global $woocommerce;
|
1450 |
$saved_cart = json_decode( get_user_meta( wcal_common::wcal_get_cart_session( 'user_id' ), '_woocommerce_persistent_cart',true ), true );
|
@@ -1452,7 +1570,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1452 |
$cart_contents_total = $cart_contents_weight = $cart_contents_count = $cart_contents_tax = $total = $subtotal = $subtotal_ex_tax = $tax_total = 0;
|
1453 |
if ( count( $saved_cart ) > 0 ) {
|
1454 |
foreach ( $saved_cart as $key => $value ) {
|
1455 |
-
foreach ( $value as $a => $b ) {
|
1456 |
$c['product_id'] = $b['product_id'];
|
1457 |
$c['variation_id'] = $b['variation_id'];
|
1458 |
$c['variation'] = $b['variation'];
|
@@ -1474,9 +1592,9 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1474 |
$woocommerce_cart_hash = $a;
|
1475 |
}
|
1476 |
}
|
1477 |
-
|
1478 |
if ( $saved_cart ) {
|
1479 |
-
if ( empty( $woocommerce->session->cart ) || ! is_array( $woocommerce->session->cart ) || sizeof( $woocommerce->session->cart ) == 0 ) {
|
1480 |
$woocommerce->session->cart = $saved_cart['cart'];
|
1481 |
$woocommerce->session->cart_contents_total = $cart_contents_total;
|
1482 |
$woocommerce->session->cart_contents_weight = $cart_contents_weight;
|
@@ -1502,7 +1620,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1502 |
}
|
1503 |
}
|
1504 |
}
|
1505 |
-
|
1506 |
/**
|
1507 |
* It will compare only guest users cart while capturing the cart.
|
1508 |
* @param json_encode $new_cart New abandoned cart details
|
@@ -1512,11 +1630,11 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1512 |
*/
|
1513 |
function wcal_compare_only_guest_carts( $new_cart, $last_abandoned_cart ) {
|
1514 |
$current_woo_cart = array();
|
1515 |
-
$current_woo_cart = json_decode( stripslashes( $new_cart ), true );
|
1516 |
$abandoned_cart_arr = array();
|
1517 |
$abandoned_cart_arr = json_decode( $last_abandoned_cart, true );
|
1518 |
$temp_variable = "";
|
1519 |
-
if ( isset( $current_woo_cart['cart'] ) && isset( $abandoned_cart_arr['cart'] ) ) {
|
1520 |
if ( count( $current_woo_cart['cart'] ) >= count( $abandoned_cart_arr['cart'] ) ) {
|
1521 |
//do nothing
|
1522 |
} else {
|
@@ -1530,7 +1648,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1530 |
$current_cart_product_id = $item_value['product_id'];
|
1531 |
$current_cart_variation_id = $item_value['variation_id'];
|
1532 |
$current_cart_quantity = $item_value['quantity'];
|
1533 |
-
|
1534 |
if ( isset( $abandoned_cart_arr[$key][$item_key]['product_id'] ) ){
|
1535 |
$abandoned_cart_product_id = $abandoned_cart_arr[$key][$item_key]['product_id'];
|
1536 |
} else {
|
@@ -1554,7 +1672,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1554 |
}
|
1555 |
}
|
1556 |
}
|
1557 |
-
}
|
1558 |
return true;
|
1559 |
}
|
1560 |
|
@@ -1565,15 +1683,15 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1565 |
* @return boolean true | false
|
1566 |
* @since 1.0
|
1567 |
*/
|
1568 |
-
function wcal_compare_carts( $user_id, $last_abandoned_cart ) {
|
1569 |
global $woocommerce;
|
1570 |
$current_woo_cart = array();
|
1571 |
$abandoned_cart_arr = array();
|
1572 |
-
$wcal_woocommerce_persistent_cart =version_compare( $woocommerce->version, '3.1.0', ">=" ) ? '_woocommerce_persistent_cart_' . get_current_blog_id() : '_woocommerce_persistent_cart' ;
|
1573 |
$current_woo_cart = get_user_meta( $user_id, $wcal_woocommerce_persistent_cart, true );
|
1574 |
$abandoned_cart_arr = json_decode( $last_abandoned_cart, true );
|
1575 |
$temp_variable = "";
|
1576 |
-
if ( isset( $current_woo_cart['cart'] ) && isset( $abandoned_cart_arr['cart'] ) ) {
|
1577 |
if ( count( $current_woo_cart['cart'] ) >= count( $abandoned_cart_arr['cart'] ) ) {
|
1578 |
//do nothing
|
1579 |
} else {
|
@@ -1583,19 +1701,19 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1583 |
}
|
1584 |
if ( is_array( $current_woo_cart ) && is_array( $abandoned_cart_arr ) ) {
|
1585 |
foreach ( $current_woo_cart as $key => $value ) {
|
1586 |
-
|
1587 |
foreach ( $value as $item_key => $item_value ) {
|
1588 |
$current_cart_product_id = $item_value['product_id'];
|
1589 |
$current_cart_variation_id = $item_value['variation_id'];
|
1590 |
$current_cart_quantity = $item_value['quantity'];
|
1591 |
-
|
1592 |
if ( isset( $abandoned_cart_arr[$key][$item_key]['product_id'] ) ) {
|
1593 |
$abandoned_cart_product_id = $abandoned_cart_arr[$key][$item_key]['product_id'];
|
1594 |
} else {
|
1595 |
$abandoned_cart_product_id = "";
|
1596 |
}
|
1597 |
if ( isset( $abandoned_cart_arr[$key][$item_key]['variation_id'] ) ) {
|
1598 |
-
$abandoned_cart_variation_id = $abandoned_cart_arr[$key][$item_key]['variation_id'];
|
1599 |
} else {
|
1600 |
$abandoned_cart_variation_id = "";
|
1601 |
}
|
@@ -1613,7 +1731,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1613 |
}
|
1614 |
}
|
1615 |
}
|
1616 |
-
}
|
1617 |
return true;
|
1618 |
}
|
1619 |
|
@@ -1631,7 +1749,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1631 |
}
|
1632 |
if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
|
1633 |
return;
|
1634 |
-
}
|
1635 |
if ( 'true' == get_user_option( 'rich_editing' ) ) {
|
1636 |
remove_filter( 'the_excerpt', 'wpautop' );
|
1637 |
add_filter( 'tiny_mce_before_init', array( &$this, 'wcal_format_tiny_MCE' ) );
|
@@ -1639,11 +1757,11 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1639 |
add_filter( 'mce_external_plugins', array( &$this, 'wcal_filter_mce_plugin' ) );
|
1640 |
}
|
1641 |
}
|
1642 |
-
|
1643 |
/**
|
1644 |
* It will create a button on the WordPress editor.
|
1645 |
* @hook mce_buttons
|
1646 |
-
* @param array $buttons
|
1647 |
* @return array $buttons
|
1648 |
* @since 2.6
|
1649 |
*/
|
@@ -1652,11 +1770,11 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1652 |
array_push( $buttons, 'abandoncart', '|' );
|
1653 |
return $buttons;
|
1654 |
}
|
1655 |
-
|
1656 |
/**
|
1657 |
* It will add the list for the added extra button.
|
1658 |
* @hook mce_external_plugins
|
1659 |
-
* @param array $plugins
|
1660 |
* @return array $plugins
|
1661 |
* @since 2.6
|
1662 |
*/
|
@@ -1665,25 +1783,25 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1665 |
$plugins['abandoncart'] = plugin_dir_url( __FILE__ ) . 'assets/js/abandoncart_plugin_button.js';
|
1666 |
return $plugins;
|
1667 |
}
|
1668 |
-
|
1669 |
/**
|
1670 |
* It will add the tabs on the Abandoned cart page.
|
1671 |
* @since 1.0
|
1672 |
*/
|
1673 |
function wcal_display_tabs() {
|
1674 |
-
|
1675 |
if ( isset( $_GET['action'] ) ) {
|
1676 |
$action = $_GET['action'];
|
1677 |
} else {
|
1678 |
-
$action = "";
|
1679 |
$active_listcart = "";
|
1680 |
$active_emailtemplates = "";
|
1681 |
$active_settings = "";
|
1682 |
$active_stats = "";
|
1683 |
-
}
|
1684 |
if ( ( 'listcart' == $action || 'orderdetails' == $action ) || '' == $action ) {
|
1685 |
$active_listcart = "nav-tab-active";
|
1686 |
-
}
|
1687 |
if ( 'emailtemplates' == $action ) {
|
1688 |
$active_emailtemplates = "nav-tab-active";
|
1689 |
}
|
@@ -1695,10 +1813,10 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1695 |
}
|
1696 |
if ( 'report' == $action ) {
|
1697 |
$active_report = "nav-tab-active";
|
1698 |
-
}
|
1699 |
-
?>
|
1700 |
<div style="background-image: url('<?php echo plugins_url(); ?>/woocommerce-abandoned-cart/assets/images/ac_tab_icon.png') !important;" class="icon32"><br>
|
1701 |
-
</div>
|
1702 |
<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
|
1703 |
<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-abandoned-cart' );?> </a>
|
1704 |
<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-abandoned-cart' );?> </a>
|
@@ -1710,7 +1828,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1710 |
</h2>
|
1711 |
<?php
|
1712 |
}
|
1713 |
-
|
1714 |
/**
|
1715 |
* It will add the scripts needed for the plugin.
|
1716 |
* @hook admin_enqueue_scripts
|
@@ -1723,7 +1841,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1723 |
|
1724 |
if ( $page === '' || $page !== 'woocommerce_ac_page' ) {
|
1725 |
return;
|
1726 |
-
} else {
|
1727 |
wp_enqueue_script( 'jquery' );
|
1728 |
wp_enqueue_script(
|
1729 |
'jquery-ui-min',
|
@@ -1741,13 +1859,13 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1741 |
false
|
1742 |
);
|
1743 |
|
1744 |
-
|
1745 |
wp_register_script( 'woocommerce_admin', plugins_url() . '/woocommerce/assets/js/admin/woocommerce_admin.min.js', array( 'jquery', 'jquery-tiptip' ) );
|
1746 |
wp_register_script( 'woocommerce_tip_tap', plugins_url() . '/woocommerce/assets/js/jquery-tiptip/jquery.tipTip.min.js', array( 'jquery') );
|
1747 |
wp_enqueue_script( 'woocommerce_tip_tap');
|
1748 |
wp_enqueue_script( 'woocommerce_admin');
|
1749 |
$locale = localeconv();
|
1750 |
-
$decimal = isset( $locale['decimal_point'] ) ? $locale['decimal_point'] : '.';
|
1751 |
$params = array(
|
1752 |
/* translators: %s: decimal */
|
1753 |
'i18n_decimal_error' => sprintf( __( 'Please enter in decimal (%s) format without thousand separators.', 'woocommerce' ), $decimal ),
|
@@ -1773,19 +1891,19 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1773 |
*/
|
1774 |
wp_localize_script( 'woocommerce_admin', 'woocommerce_admin', $params );
|
1775 |
?>
|
1776 |
-
<script type="text/javascript" >
|
1777 |
function wcal_activate_email_template( template_id, active_state ) {
|
1778 |
location.href = 'admin.php?page=woocommerce_ac_page&action=emailtemplates&mode=activate_template&id='+template_id+'&active_state='+active_state ;
|
1779 |
}
|
1780 |
</script>
|
1781 |
-
<?php
|
1782 |
-
$js_src = includes_url('js/tinymce/') . 'tinymce.min.js';
|
1783 |
wp_enqueue_script( 'tinyMce_ac',$js_src );
|
1784 |
-
wp_enqueue_script( 'ac_email_variables', plugins_url() . '/woocommerce-abandoned-cart/assets/js/abandoncart_plugin_button.js' );
|
1785 |
-
wp_enqueue_script( 'wcal_activate_template', plugins_url() . '/woocommerce-abandoned-cart/assets/js/wcal_template_activate.js' );
|
1786 |
}
|
1787 |
}
|
1788 |
-
|
1789 |
/**
|
1790 |
* It will add the parameter to the editor.
|
1791 |
* @hook tiny_mce_before_init
|
@@ -1793,7 +1911,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1793 |
* @return array $in
|
1794 |
* @since 2.6
|
1795 |
*/
|
1796 |
-
function wcal_format_tiny_MCE( $in ) {
|
1797 |
$in['force_root_block'] = false;
|
1798 |
$in['valid_children'] = '+body[style]';
|
1799 |
$in['remove_linebreaks'] = false;
|
@@ -1810,14 +1928,14 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1810 |
$in['wpautop'] = false;
|
1811 |
$in['apply_source_formatting'] = true;
|
1812 |
$in['cleanup'] = true;
|
1813 |
-
$in['convert_newlines_to_brs'] = FALSE;
|
1814 |
-
$in['fullpage_default_xml_pi'] = false;
|
1815 |
$in['convert_urls'] = false;
|
1816 |
// Do not remove redundant BR tags
|
1817 |
-
$in['remove_redundant_brs'] = false;
|
1818 |
return $in;
|
1819 |
}
|
1820 |
-
|
1821 |
/**
|
1822 |
* It will add the necesaary css for the plugin.
|
1823 |
* @hook admin_enqueue_scripts
|
@@ -1833,48 +1951,48 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1833 |
if ( $page != 'woocommerce_ac_page' ) {
|
1834 |
return;
|
1835 |
} elseif ( $page === 'woocommerce_ac_page' ) {
|
1836 |
-
|
1837 |
-
wp_enqueue_style( 'jquery-ui', plugins_url() . '/woocommerce-abandoned-cart/assets/css/jquery-ui.css', '', '', false );
|
1838 |
wp_enqueue_style( 'woocommerce_admin_styles', plugins_url() . '/woocommerce/assets/css/admin.css' );
|
1839 |
-
|
1840 |
wp_enqueue_style( 'jquery-ui-style', plugins_url() . '/woocommerce-abandoned-cart/assets/css/jquery-ui-smoothness.css' );
|
1841 |
wp_enqueue_style( 'abandoned-orders-list', plugins_url() . '/woocommerce-abandoned-cart/assets/css/view.abandoned.orders.style.css' );
|
1842 |
wp_enqueue_style( 'wcal_email_template', plugins_url() . '/woocommerce-abandoned-cart/assets/css/wcal_template_activate.css' );
|
1843 |
-
|
1844 |
}
|
1845 |
-
}
|
1846 |
-
|
1847 |
|
1848 |
/**
|
1849 |
-
* When we have added the wp list table for the listing then while deleting the record with the bulk action it was showing
|
1850 |
-
* the notice. To overcome the wp redirect warning we need to start the ob_start.
|
1851 |
* @hook init
|
1852 |
* @since 2.5.2
|
1853 |
*/
|
1854 |
function wcal_app_output_buffer() {
|
1855 |
ob_start();
|
1856 |
}
|
1857 |
-
|
1858 |
/**
|
1859 |
* Abandon Cart Settings Page. It will show the tabs, notices for the plugin.
|
1860 |
-
* It will also update the template records and display the template fields.
|
1861 |
* It will also show the abandoned cart details page.
|
1862 |
* It will also show the details of all the tabs.
|
1863 |
* @globals mixed $wpdb
|
1864 |
* @since 1.0
|
1865 |
*/
|
1866 |
function wcal_menu_page() {
|
1867 |
-
|
1868 |
if ( is_user_logged_in() ) {
|
1869 |
-
global $wpdb;
|
1870 |
// Check the user capabilities
|
1871 |
-
if ( ! current_user_can( 'manage_woocommerce' ) ) {
|
1872 |
wp_die( __( 'You do not have sufficient permissions to access this page.', 'woocommerce-abandoned-cart' ) );
|
1873 |
-
}
|
1874 |
?>
|
1875 |
-
<div class="wrap">
|
1876 |
<h2><?php _e( 'WooCommerce - Abandon Cart Lite', 'woocommerce-abandoned-cart' ); ?></h2>
|
1877 |
-
<?php
|
1878 |
|
1879 |
if ( isset( $_GET['ac_update'] ) && 'email_templates' === $_GET['ac_update'] ) {
|
1880 |
$status = wcal_common::update_templates_table();
|
@@ -1885,7 +2003,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1885 |
wcal_common::show_update_failure();
|
1886 |
}
|
1887 |
}
|
1888 |
-
|
1889 |
if ( isset( $_GET['action'] ) ) {
|
1890 |
$action = $_GET['action'];
|
1891 |
} else {
|
@@ -1895,11 +2013,11 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1895 |
$mode = $_GET['mode'];
|
1896 |
} else {
|
1897 |
$mode = "";
|
1898 |
-
}
|
1899 |
$this->wcal_display_tabs();
|
1900 |
-
|
1901 |
do_action ( 'wcal_add_tab_content' );
|
1902 |
-
|
1903 |
/**
|
1904 |
* When we delete the item from the below drop down it is registred in action 2
|
1905 |
*/
|
@@ -1930,27 +2048,27 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1930 |
$class->wcal_delete_template_bulk_action_handler_function( $id );
|
1931 |
}
|
1932 |
}
|
1933 |
-
|
1934 |
if ( isset( $_GET['wcal_deleted'] ) && 'YES' == $_GET['wcal_deleted'] ) { ?>
|
1935 |
<div id="message" class="updated fade">
|
1936 |
<p><strong><?php _e( 'The Abandoned cart has been successfully deleted.', 'woocommerce-abandoned-cart' ); ?></strong></p>
|
1937 |
</div>
|
1938 |
-
<?php }
|
1939 |
if ( isset( $_GET ['wcal_template_deleted'] ) && 'YES' == $_GET['wcal_template_deleted'] ) { ?>
|
1940 |
<div id="message" class="updated fade">
|
1941 |
<p><strong><?php _e( 'The Template has been successfully deleted.', 'woocommerce-abandoned-cart' ); ?></strong></p>
|
1942 |
</div>
|
1943 |
-
<?php }
|
1944 |
if ( 'emailsettings' == $action ) {
|
1945 |
// Save the field values
|
1946 |
?>
|
1947 |
<p><?php _e( 'Change settings for sending email notifications to Customers, to Admin etc.', 'woocommerce-abandoned-cart' ); ?></p>
|
1948 |
<div id="content">
|
1949 |
-
<?php
|
1950 |
$wcal_general_settings_class = $wcal_email_setting = $wcap_sms_settings = $wcap_atc_settings = $wcap_fb_settings = "";
|
1951 |
|
1952 |
$section = isset( $_GET[ 'wcal_section' ] ) ? $_GET[ 'wcal_section' ] : '';
|
1953 |
-
|
1954 |
switch( $section ) {
|
1955 |
|
1956 |
case 'wcal_general_settings':
|
@@ -1978,7 +2096,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1978 |
$wcal_general_settings_class = "current";
|
1979 |
break;
|
1980 |
|
1981 |
-
}
|
1982 |
?>
|
1983 |
<ul class="subsubsub" id="wcal_general_settings_list">
|
1984 |
<li>
|
@@ -1991,11 +2109,11 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
1991 |
<a href="admin.php?page=woocommerce_ac_page&action=emailsettings&wcal_section=wcap_atc_settings" class="<?php echo $wcap_atc_settings; ?>"><?php _e( 'Add To Cart Popup Editor', 'woocommerce-ac' );?> </a> |
|
1992 |
</li>
|
1993 |
<li>
|
1994 |
-
<a href="admin.php?page=woocommerce_ac_page&action=emailsettings&wcal_section=wcap_fb_settings" class="<?php echo $wcap_fb_settings; ?>"><?php _e( 'Facebook Messenger', 'woocommerce-ac' );?> </a> |
|
1995 |
</li>
|
1996 |
<li>
|
1997 |
-
<a href="admin.php?page=woocommerce_ac_page&action=emailsettings&wcal_section=wcap_sms_settings" class="<?php echo $wcap_sms_settings; ?>"><?php _e( 'SMS', 'woocommerce-ac' );?> </a>
|
1998 |
-
</li>
|
1999 |
|
2000 |
</ul>
|
2001 |
<br class="clear">
|
@@ -2006,9 +2124,9 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2006 |
<?php settings_fields( 'woocommerce_ac_settings' ); ?>
|
2007 |
<?php do_settings_sections( 'woocommerce_ac_page' ); ?>
|
2008 |
<?php settings_errors(); ?>
|
2009 |
-
<?php submit_button(); ?>
|
2010 |
</form>
|
2011 |
-
<?php
|
2012 |
} else if ( 'wcal_email_settings' == $section ) {
|
2013 |
?>
|
2014 |
<form method="post" action="options.php">
|
@@ -2017,7 +2135,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2017 |
<?php settings_errors(); ?>
|
2018 |
<?php submit_button(); ?>
|
2019 |
</form>
|
2020 |
-
<?php
|
2021 |
} elseif( 'wcap_atc_settings' == $section ) {
|
2022 |
WCAP_Pro_Settings::wcap_atc_settings();
|
2023 |
} elseif( 'wcap_fb_settings' == $section ) {
|
@@ -2027,26 +2145,26 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2027 |
}
|
2028 |
?>
|
2029 |
</div>
|
2030 |
-
<?php
|
2031 |
} elseif ( $action == 'listcart' || '' == $action || '-1' == $action || '-1' == $action_two ) {
|
2032 |
-
?>
|
2033 |
<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-abandoned-cart' );?> </p>
|
2034 |
<?php
|
2035 |
$get_all_abandoned_count = wcal_common::wcal_get_abandoned_order_count( 'wcal_all_abandoned' );
|
2036 |
$get_registered_user_ac_count = wcal_common::wcal_get_abandoned_order_count( 'wcal_all_registered' );
|
2037 |
$get_guest_user_ac_count = wcal_common::wcal_get_abandoned_order_count( 'wcal_all_guest' );
|
2038 |
-
$get_visitor_user_ac_count = wcal_common::wcal_get_abandoned_order_count( 'wcal_all_visitor' );
|
2039 |
-
|
2040 |
$wcal_user_reg_text = 'User';
|
2041 |
if ( $get_registered_user_ac_count > 1 ) {
|
2042 |
$wcal_user_reg_text = 'Users';
|
2043 |
-
}
|
2044 |
$wcal_user_gus_text = 'User';
|
2045 |
if ( $get_guest_user_ac_count > 1 ) {
|
2046 |
$wcal_user_gus_text = 'Users';
|
2047 |
-
}
|
2048 |
$wcal_all_abandoned_carts = $section = $wcal_all_registered = $wcal_all_guest = $wcal_all_visitor = "" ;
|
2049 |
-
|
2050 |
if ( isset( $_GET[ 'wcal_section' ] ) ) {
|
2051 |
$section = $_GET[ 'wcal_section' ];
|
2052 |
} else {
|
@@ -2055,7 +2173,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2055 |
if ( 'wcal_all_abandoned' == $section || '' == $section ) {
|
2056 |
$wcal_all_abandoned_carts = "current";
|
2057 |
}
|
2058 |
-
|
2059 |
if ( 'wcal_all_registered' == $section ) {
|
2060 |
$wcal_all_registered = "current";
|
2061 |
$wcal_all_abandoned_carts = "";
|
@@ -2064,7 +2182,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2064 |
$wcal_all_guest = "current";
|
2065 |
$wcal_all_abandoned_carts = "";
|
2066 |
}
|
2067 |
-
|
2068 |
if ( 'wcal_all_visitor' == $section ) {
|
2069 |
$wcal_all_visitor = "current";
|
2070 |
$wcal_all_abandoned_carts = "";
|
@@ -2072,29 +2190,29 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2072 |
?>
|
2073 |
<ul class="subsubsub" id="wcal_recovered_orders_list">
|
2074 |
<li>
|
2075 |
-
<a href="admin.php?page=woocommerce_ac_page&action=listcart&wcal_section=wcal_all_abandoned" class="<?php echo $wcal_all_abandoned_carts; ?>"><?php _e( "All ", 'woocommerce-abandoned-cart' ) ;?> <span class = "count" > <?php echo "( $get_all_abandoned_count )" ?> </span></a>
|
2076 |
</li>
|
2077 |
-
|
2078 |
<?php if ( $get_registered_user_ac_count > 0 ) { ?>
|
2079 |
<li>
|
2080 |
-
| <a href="admin.php?page=woocommerce_ac_page&action=listcart&wcal_section=wcal_all_registered" class="<?php echo $wcal_all_registered; ?>"><?php printf( __( 'Registered %s', 'woocommerce-abandoned-cart' ), $wcal_user_reg_text ); ?> <span class = "count" > <?php echo "( $get_registered_user_ac_count )" ?> </span></a>
|
2081 |
</li>
|
2082 |
<?php } ?>
|
2083 |
-
|
2084 |
<?php if ( $get_guest_user_ac_count > 0 ) { ?>
|
2085 |
<li>
|
2086 |
-
| <a href="admin.php?page=woocommerce_ac_page&action=listcart&wcal_section=wcal_all_guest" class="<?php echo $wcal_all_guest; ?>"><?php printf( __( 'Guest %s', 'woocommerce-abandoned-cart' ), $wcal_user_gus_text ); ?> <span class = "count" > <?php echo "( $get_guest_user_ac_count )" ?> </span></a>
|
2087 |
</li>
|
2088 |
<?php } ?>
|
2089 |
-
|
2090 |
<?php if ( $get_visitor_user_ac_count > 0 ) { ?>
|
2091 |
<li>
|
2092 |
-
| <a href="admin.php?page=woocommerce_ac_page&action=listcart&wcal_section=wcal_all_visitor" class="<?php echo $wcal_all_visitor; ?>"><?php _e( "Carts without Customer Details", 'woocommerce-abandoned-cart' ); ?> <span class = "count" > <?php echo "( $get_visitor_user_ac_count )" ?> </span></a>
|
2093 |
</li>
|
2094 |
<?php } ?>
|
2095 |
</ul>
|
2096 |
-
|
2097 |
-
<?php
|
2098 |
global $wpdb;
|
2099 |
include_once( 'includes/classes/class-wcal-abandoned-orders-table.php' );
|
2100 |
$wcal_abandoned_order_list = new WCAL_Abandoned_Orders_Table();
|
@@ -2106,14 +2224,14 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2106 |
<input type="hidden" name="action" value="listcart" />
|
2107 |
<?php $wcal_abandoned_order_list->display(); ?>
|
2108 |
</form>
|
2109 |
-
</div>
|
2110 |
-
<?php
|
2111 |
} elseif ( ( 'emailtemplates' == $action && ( 'edittemplate' != $mode && 'addnewtemplate' != $mode ) || '' == $action || '-1' == $action || '-1' == $action_two ) ) {
|
2112 |
?>
|
2113 |
<p> <?php _e( 'Add email templates at different intervals to maximize the possibility of recovering your abandoned carts.', 'woocommerce-abandoned-cart' );?> </p>
|
2114 |
-
<?php
|
2115 |
// Save the field values
|
2116 |
-
$insert_template_successfuly = $update_template_successfuly = '';
|
2117 |
if ( isset( $_POST['ac_settings_frm'] ) && 'save' == $_POST['ac_settings_frm'] ) {
|
2118 |
$woocommerce_ac_email_subject = trim( htmlspecialchars( $_POST['woocommerce_ac_email_subject'] ), ENT_QUOTES );
|
2119 |
$woocommerce_ac_email_body = trim( $_POST['woocommerce_ac_email_body'] );
|
@@ -2124,11 +2242,11 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2124 |
$day_or_hour = trim( $_POST['day_or_hour'] );
|
2125 |
$is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
|
2126 |
$default_value = 0 ;
|
2127 |
-
|
2128 |
$query = "INSERT INTO `".$wpdb->prefix."ac_email_templates_lite`
|
2129 |
(subject, body, frequency, day_or_hour, template_name, is_wc_template, default_template, wc_email_header )
|
2130 |
VALUES ( %s, %s, %d, %s, %s, %s, %d, %s )";
|
2131 |
-
|
2132 |
$insert_template_successfuly = $wpdb->query( $wpdb->prepare( $query,
|
2133 |
$woocommerce_ac_email_subject,
|
2134 |
$woocommerce_ac_email_body,
|
@@ -2137,35 +2255,35 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2137 |
$woocommerce_ac_template_name,
|
2138 |
$is_wc_template,
|
2139 |
$default_value,
|
2140 |
-
$woocommerce_ac_email_header )
|
2141 |
-
);
|
2142 |
}
|
2143 |
-
|
2144 |
-
if ( isset( $_POST['ac_settings_frm'] ) && 'update' == $_POST['ac_settings_frm'] ) {
|
2145 |
-
|
2146 |
$updated_is_active = '0';
|
2147 |
-
|
2148 |
$email_frequency = trim( $_POST['email_frequency'] );
|
2149 |
$day_or_hour = trim( $_POST['day_or_hour'] );
|
2150 |
$is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
|
2151 |
-
|
2152 |
$woocommerce_ac_email_subject = trim( htmlspecialchars( $_POST['woocommerce_ac_email_subject'] ), ENT_QUOTES );
|
2153 |
$woocommerce_ac_email_body = trim( $_POST['woocommerce_ac_email_body'] );
|
2154 |
$woocommerce_ac_template_name = trim( $_POST['woocommerce_ac_template_name'] );
|
2155 |
$woocommerce_ac_email_header = stripslashes( trim( htmlspecialchars( $_POST['wcal_wc_email_header'] ), ENT_QUOTES ) );
|
2156 |
$id = trim( $_POST['id'] );
|
2157 |
-
|
2158 |
$check_query = "SELECT * FROM `".$wpdb->prefix."ac_email_templates_lite`
|
2159 |
WHERE id = %d ";
|
2160 |
$check_results = $wpdb->get_results( $wpdb->prepare( $check_query, $id ) );
|
2161 |
$default_value = '';
|
2162 |
|
2163 |
-
if ( count( $check_results ) > 0 ) {
|
2164 |
if ( isset( $check_results[0]->default_template ) && $check_results[0]->default_template == '1' ) {
|
2165 |
$default_value = '1';
|
2166 |
}
|
2167 |
}
|
2168 |
-
|
2169 |
$query_update_latest = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
|
2170 |
SET
|
2171 |
subject = %s,
|
@@ -2177,7 +2295,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2177 |
default_template = %d,
|
2178 |
wc_email_header = %s
|
2179 |
WHERE id = %d ";
|
2180 |
-
|
2181 |
$update_template_successfuly = $wpdb->query( $wpdb->prepare( $query_update_latest,
|
2182 |
$woocommerce_ac_email_subject,
|
2183 |
$woocommerce_ac_email_body,
|
@@ -2188,20 +2306,20 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2188 |
$default_value,
|
2189 |
$woocommerce_ac_email_header,
|
2190 |
$id )
|
2191 |
-
);
|
2192 |
-
|
2193 |
}
|
2194 |
-
|
2195 |
if ( 'emailtemplates' == $action && 'removetemplate' == $mode ) {
|
2196 |
$id_remove = $_GET['id'];
|
2197 |
$query_remove = "DELETE FROM `".$wpdb->prefix."ac_email_templates_lite` WHERE id= %d ";
|
2198 |
$wpdb->query( $wpdb->prepare( $query_remove, $id_remove ) );
|
2199 |
}
|
2200 |
-
|
2201 |
if ( 'emailtemplates' == $action && 'activate_template' == $mode ) {
|
2202 |
$template_id = $_GET['id'];
|
2203 |
$current_template_status = $_GET['active_state'];
|
2204 |
-
|
2205 |
if ( "1" == $current_template_status ) {
|
2206 |
$active = "0";
|
2207 |
} else {
|
@@ -2214,7 +2332,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2214 |
$email_day_or_hour = $get_selected_template_result[0]->day_or_hour;
|
2215 |
|
2216 |
$query_update = "UPDATE `".$wpdb->prefix."ac_email_templates_lite` SET is_active='0' WHERE frequency='" . $email_frequncy . "' AND day_or_hour='" . $email_day_or_hour . "' ";
|
2217 |
-
$wcap_updated = $wpdb->query( $query_update );
|
2218 |
}
|
2219 |
|
2220 |
$query_update = "UPDATE `" . $wpdb->prefix . "ac_email_templates_lite`
|
@@ -2222,7 +2340,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2222 |
is_active = '" . $active . "'
|
2223 |
WHERE id = '" . $template_id . "' ";
|
2224 |
$wpdb->query( $query_update );
|
2225 |
-
|
2226 |
wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&action=emailtemplates' ) );
|
2227 |
}
|
2228 |
|
@@ -2243,7 +2361,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2243 |
</strong>
|
2244 |
</p>
|
2245 |
</div>
|
2246 |
-
<?php
|
2247 |
}
|
2248 |
|
2249 |
if ( isset( $_POST['ac_settings_frm'] ) && 'update' == $_POST['ac_settings_frm'] && isset( $update_template_successfuly ) && $update_template_successfuly !== false ) { ?>
|
@@ -2263,15 +2381,15 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2263 |
</strong>
|
2264 |
</p>
|
2265 |
</div>
|
2266 |
-
<?php
|
2267 |
}
|
2268 |
?>
|
2269 |
<div class="tablenav">
|
2270 |
<p style="float:left;">
|
2271 |
<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-abandoned-cart' ); ?>
|
2272 |
-
</a>
|
2273 |
</p>
|
2274 |
-
|
2275 |
<?php
|
2276 |
/* From here you can do whatever you want with the data from the $result link. */
|
2277 |
include_once('includes/classes/class-wcal-templates-table.php');
|
@@ -2286,7 +2404,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2286 |
</form>
|
2287 |
</div>
|
2288 |
</div>
|
2289 |
-
<?php
|
2290 |
} elseif ( 'stats' == $action || '' == $action ) {
|
2291 |
?>
|
2292 |
<p>
|
@@ -2319,32 +2437,32 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2319 |
start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 365 );
|
2320 |
end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
|
2321 |
}
|
2322 |
-
|
2323 |
var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
2324 |
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
2325 |
-
|
2326 |
var start_date_value = start_date.getDate() + " " + monthNames[start_date.getMonth()] + " " + start_date.getFullYear();
|
2327 |
var end_date_value = end_date.getDate() + " " + monthNames[end_date.getMonth()] + " " + end_date.getFullYear();
|
2328 |
-
|
2329 |
jQuery( '#start_date' ).val( start_date_value );
|
2330 |
jQuery( '#end_date' ).val( end_date_value );
|
2331 |
} );
|
2332 |
});
|
2333 |
</script>
|
2334 |
<?php
|
2335 |
-
|
2336 |
if ( isset( $_POST['duration_select'] ) ){
|
2337 |
$duration_range = $_POST['duration_select'];
|
2338 |
} else {
|
2339 |
$duration_range = "";
|
2340 |
-
}
|
2341 |
if ( '' == $duration_range ) {
|
2342 |
if ( isset( $_GET['duration_select'] ) ){
|
2343 |
$duration_range = $_GET['duration_select'];
|
2344 |
}
|
2345 |
}
|
2346 |
if ( '' == $duration_range ) $duration_range = "last_seven";
|
2347 |
-
|
2348 |
_e( 'The Report below shows how many Abandoned Carts we were able to recover for you by sending automatic emails to encourage shoppers.', 'woocommerce-abandoned-cart');
|
2349 |
?>
|
2350 |
<div id="recovered_stats" class="postbox" style="display:block">
|
@@ -2356,9 +2474,9 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2356 |
$sel = "";
|
2357 |
if ( $key == $duration_range ) {
|
2358 |
$sel = " selected ";
|
2359 |
-
}
|
2360 |
echo"<option value='$key' $sel> $value </option>";
|
2361 |
-
}
|
2362 |
$date_sett = $this->start_end_dates[ $duration_range ];
|
2363 |
?>
|
2364 |
</select>
|
@@ -2368,36 +2486,36 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2368 |
var formats = ["d.m.y", "d M yy","MM d, yy"];
|
2369 |
jQuery( "#start_date" ).datepicker( { dateFormat: formats[1] } );
|
2370 |
});
|
2371 |
-
|
2372 |
jQuery( document ).ready( function()
|
2373 |
{
|
2374 |
var formats = ["d.m.y", "d M yy","MM d, yy"];
|
2375 |
jQuery( "#end_date" ).datepicker( { dateFormat: formats[1] } );
|
2376 |
});
|
2377 |
-
</script>
|
2378 |
-
<?php
|
2379 |
-
include_once('includes/classes/class-wcal-recover-orders-table.php');
|
2380 |
$wcal_recover_orders_list = new WCAL_Recover_Orders_Table();
|
2381 |
$wcal_recover_orders_list->wcal_recovered_orders_prepare_items();
|
2382 |
-
|
2383 |
if ( isset( $_POST['start_date'] ) ) $start_date_range = $_POST['start_date'];
|
2384 |
else $start_date_range = "";
|
2385 |
-
|
2386 |
if ( $start_date_range == "" ) {
|
2387 |
$start_date_range = $date_sett['start_date'];
|
2388 |
}
|
2389 |
-
|
2390 |
if ( isset( $_POST['end_date'] ) ) $end_date_range = $_POST['end_date'];
|
2391 |
else $end_date_range = "";
|
2392 |
-
|
2393 |
if ( $end_date_range == "" ) {
|
2394 |
$end_date_range = $date_sett['end_date'];
|
2395 |
}
|
2396 |
-
?>
|
2397 |
<label class="start_label" for="start_day"> <?php _e( 'Start Date:', 'woocommerce-abandoned-cart' ); ?> </label>
|
2398 |
-
<input type="text" id="start_date" name="start_date" readonly="readonly" value="<?php echo $start_date_range; ?>"/>
|
2399 |
<label class="end_label" for="end_day"> <?php _e( 'End Date:', 'woocommerce-abandoned-cart' ); ?> </label>
|
2400 |
-
<input type="text" id="end_date" name="end_date" readonly="readonly" value="<?php echo $end_date_range; ?>"/>
|
2401 |
<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e( 'Go', 'woocommerce-abandoned-cart' ); ?>" />
|
2402 |
</form>
|
2403 |
</div>
|
@@ -2406,7 +2524,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2406 |
<div class="inside" >
|
2407 |
<?php
|
2408 |
$count = $wcal_recover_orders_list->total_abandoned_cart_count;
|
2409 |
-
$total_of_all_order = $wcal_recover_orders_list->total_order_amount;
|
2410 |
$recovered_item = $wcal_recover_orders_list->recovered_item;
|
2411 |
$recovered_total = wc_price( $wcal_recover_orders_list->total_recover_amount );
|
2412 |
?>
|
@@ -2440,16 +2558,16 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2440 |
<th> <?php _e( 'Quantity', 'woocommerce-abandoned-cart' ); ?> </th>
|
2441 |
<th> <?php _e( 'Line Subtotal', 'woocommerce-abandoned-cart' ); ?> </th>
|
2442 |
<th> <?php _e( 'Line Total', 'woocommerce-abandoned-cart' ); ?> </th>
|
2443 |
-
</tr>
|
2444 |
-
<?php
|
2445 |
$query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE id = %d ";
|
2446 |
-
$results = $wpdb->get_results( $wpdb->prepare( $query,$_GET['id'] ) );
|
2447 |
-
|
2448 |
$shipping_charges = 0;
|
2449 |
$currency_symbol = get_woocommerce_currency_symbol();
|
2450 |
-
$number_decimal = wc_get_price_decimals();
|
2451 |
if ( $results[0]->user_type == "GUEST" && "0" != $results[0]->user_id ) {
|
2452 |
-
$query_guest = "SELECT * FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = %d";
|
2453 |
$results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $results[0]->user_id ) );
|
2454 |
$user_email = $user_first_name = $user_last_name = $user_billing_postcode = $user_shipping_postcode = '';
|
2455 |
$shipping_charges = '';
|
@@ -2462,7 +2580,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2462 |
$shipping_charges = $results_guest[0]->shipping_charges;
|
2463 |
}
|
2464 |
$user_billing_company = $user_billing_address_1 = $user_billing_address_2 = $user_billing_city = $user_billing_state = $user_billing_country = $user_billing_phone = "";
|
2465 |
-
$user_shipping_company = $user_shipping_address_1 = $user_shipping_address_2 = $user_shipping_city = $user_shipping_state = $user_shipping_country = "";
|
2466 |
} else if ( $results[0]->user_type == "GUEST" && $results[0]->user_id == "0" ) {
|
2467 |
$user_email = '';
|
2468 |
$user_first_name = "Visitor";
|
@@ -2472,13 +2590,13 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2472 |
$shipping_charges = '';
|
2473 |
$user_billing_phone = '';
|
2474 |
$user_billing_company = $user_billing_address_1 = $user_billing_address_2 = $user_billing_city = $user_billing_state = $user_billing_country = "";
|
2475 |
-
$user_shipping_company = $user_shipping_address_1 = $user_shipping_address_2 = $user_shipping_city = $user_shipping_state = $user_shipping_country = "";
|
2476 |
} else {
|
2477 |
-
$user_id = $results[0]->user_id;
|
2478 |
if ( isset( $results[0]->user_login ) ) {
|
2479 |
$user_login = $results[0]->user_login;
|
2480 |
}
|
2481 |
-
$user_email = get_user_meta( $results[0]->user_id, 'billing_email', true );
|
2482 |
if ( '' == $user_email ) {
|
2483 |
$user_data = get_userdata( $results[0]->user_id );
|
2484 |
if ( isset( $user_data->user_email ) ) {
|
@@ -2487,7 +2605,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2487 |
$user_email = '';
|
2488 |
}
|
2489 |
}
|
2490 |
-
|
2491 |
$user_first_name = "";
|
2492 |
$user_first_name_temp = get_user_meta( $user_id, 'billing_first_name', true );
|
2493 |
if ( isset( $user_first_name_temp ) && '' == $user_first_name_temp ) {
|
@@ -2499,7 +2617,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2499 |
}
|
2500 |
} else {
|
2501 |
$user_first_name = $user_first_name_temp;
|
2502 |
-
}
|
2503 |
$user_last_name = "";
|
2504 |
$user_last_name_temp = get_user_meta( $user_id, 'billing_last_name', true );
|
2505 |
if ( isset( $user_last_name_temp ) && "" == $user_last_name_temp ) {
|
@@ -2511,12 +2629,12 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2511 |
}
|
2512 |
} else {
|
2513 |
$user_last_name = $user_last_name_temp;
|
2514 |
-
}
|
2515 |
$user_billing_first_name = get_user_meta( $results[0]->user_id, 'billing_first_name' );
|
2516 |
-
$user_billing_last_name = get_user_meta( $results[0]->user_id, 'billing_last_name' );
|
2517 |
|
2518 |
$user_billing_details = wcal_common::wcal_get_billing_details( $results[0]->user_id );
|
2519 |
-
|
2520 |
$user_billing_company = $user_billing_details[ 'billing_company' ];
|
2521 |
$user_billing_address_1 = $user_billing_details[ 'billing_address_1' ];
|
2522 |
$user_billing_address_2 = $user_billing_details[ 'billing_address_2' ];
|
@@ -2530,48 +2648,48 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2530 |
$user_billing_phone = $user_billing_phone_temp[0];
|
2531 |
} else {
|
2532 |
$user_billing_phone = "";
|
2533 |
-
}
|
2534 |
$user_shipping_first_name = get_user_meta( $results[0]->user_id, 'shipping_first_name' );
|
2535 |
-
$user_shipping_last_name = get_user_meta( $results[0]->user_id, 'shipping_last_name' );
|
2536 |
-
$user_shipping_company_temp = get_user_meta( $results[0]->user_id, 'shipping_company' );
|
2537 |
if ( isset( $user_shipping_company_temp[0] ) ) {
|
2538 |
$user_shipping_company = $user_shipping_company_temp[0];
|
2539 |
} else {
|
2540 |
$user_shipping_company = "";
|
2541 |
-
}
|
2542 |
$user_shipping_address_1_temp = get_user_meta( $results[0]->user_id, 'shipping_address_1' );
|
2543 |
if ( isset( $user_shipping_address_1_temp[0] ) ) {
|
2544 |
$user_shipping_address_1 = $user_shipping_address_1_temp[0];
|
2545 |
} else {
|
2546 |
$user_shipping_address_1 = "";
|
2547 |
-
}
|
2548 |
$user_shipping_address_2_temp = get_user_meta( $results[0]->user_id, 'shipping_address_2' );
|
2549 |
if ( isset( $user_shipping_address_2_temp[0] ) ) {
|
2550 |
$user_shipping_address_2 = $user_shipping_address_2_temp[0];
|
2551 |
} else {
|
2552 |
$user_shipping_address_2 = "";
|
2553 |
-
}
|
2554 |
$user_shipping_city_temp = get_user_meta( $results[0]->user_id, 'shipping_city' );
|
2555 |
if ( isset( $user_shipping_city_temp[0] ) ) {
|
2556 |
$user_shipping_city = $user_shipping_city_temp[0];
|
2557 |
} else {
|
2558 |
$user_shipping_city = "";
|
2559 |
-
}
|
2560 |
$user_shipping_postcode_temp = get_user_meta( $results[0]->user_id, 'shipping_postcode' );
|
2561 |
if ( isset( $user_shipping_postcode_temp[0] ) ) {
|
2562 |
$user_shipping_postcode = $user_shipping_postcode_temp[0];
|
2563 |
} else {
|
2564 |
$user_shipping_postcode = "";
|
2565 |
-
}
|
2566 |
$user_shipping_country_temp = get_user_meta( $results[0]->user_id, 'shipping_country' );
|
2567 |
$user_shipping_country = "";
|
2568 |
if ( isset( $user_shipping_country_temp[0] ) ) {
|
2569 |
$user_shipping_country = $user_shipping_country_temp[0];
|
2570 |
if ( isset( $woocommerce->countries->countries[ $user_shipping_country ] ) ) {
|
2571 |
-
$user_shipping_country = $woocommerce->countries->countries[ $user_shipping_country ];
|
2572 |
}else {
|
2573 |
$user_shipping_country = "";
|
2574 |
-
}
|
2575 |
}
|
2576 |
$user_shipping_state_temp = get_user_meta( $results[0]->user_id, 'shipping_state' );
|
2577 |
$user_shipping_state = "";
|
@@ -2580,16 +2698,16 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2580 |
if ( isset( $woocommerce->countries->states[ $user_shipping_country_temp[0] ][ $user_shipping_state ] ) ) {
|
2581 |
# code...
|
2582 |
$user_shipping_state = $woocommerce->countries->states[ $user_shipping_country_temp[0] ][ $user_shipping_state ];
|
2583 |
-
}
|
2584 |
-
}
|
2585 |
-
}
|
2586 |
-
|
2587 |
$cart_details = array();
|
2588 |
$cart_info = json_decode( $results[0]->abandoned_cart_info );
|
2589 |
$cart_details = (array) $cart_info->cart;
|
2590 |
$item_subtotal = $item_total = 0;
|
2591 |
-
|
2592 |
-
if ( is_array ( $cart_details ) && count( $cart_details ) > 0 ) {
|
2593 |
foreach ( $cart_details as $k => $v ) {
|
2594 |
|
2595 |
$item_details = wcal_common::wcal_get_cart_details( $v );
|
@@ -2605,26 +2723,26 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2605 |
$item_subtotal = $item_details[ 'item_total_formatted' ];
|
2606 |
$item_total = $item_details[ 'item_total' ];
|
2607 |
$quantity_total = $item_details[ 'qty' ];
|
2608 |
-
|
2609 |
$qty_item_text = 'item';
|
2610 |
if ( $quantity_total > 1 ) {
|
2611 |
$qty_item_text = 'items';
|
2612 |
}
|
2613 |
-
?>
|
2614 |
<tr>
|
2615 |
<td> <?php echo $prod_image; ?></td>
|
2616 |
<td> <?php echo '<a href="' . $product_page_url . '"> ' . $product_name . ' </a>'; ?> </td>
|
2617 |
<td> <?php echo $quantity_total; ?></td>
|
2618 |
<td> <?php echo $item_subtotal; ?></td>
|
2619 |
<td> <?php echo $item_total; ?></td>
|
2620 |
-
</tr>
|
2621 |
-
<?php
|
2622 |
$item_subtotal = $item_total = 0;
|
2623 |
}
|
2624 |
}
|
2625 |
?>
|
2626 |
</table>
|
2627 |
-
</div>
|
2628 |
</div>
|
2629 |
<div id="ac_order_customer_details" class="postbox" style="display:block">
|
2630 |
<h3 class="details-title"> <p> <?php _e( 'Customer Details' , 'woocommerce-abandoned-cart' ); ?> </p> </h3>
|
@@ -2634,7 +2752,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2634 |
<h3> <p> <?php _e( 'Billing Details' , 'woocommerce-abandoned-cart' ); ?> </p> </h3>
|
2635 |
<p> <strong> <?php _e( 'Name:' , 'woocommerce-abandoned-cart' ); ?> </strong>
|
2636 |
<?php echo $user_first_name." ".$user_last_name;?>
|
2637 |
-
</p>
|
2638 |
<p> <strong> <?php _e( 'Address:' , 'woocommerce-abandoned-cart' ); ?> </strong>
|
2639 |
<?php echo $user_billing_company."</br>".
|
2640 |
$user_billing_address_1."</br>".
|
@@ -2643,20 +2761,20 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2643 |
$user_billing_postcode."</br>".
|
2644 |
$user_billing_state."</br>".
|
2645 |
$user_billing_country."</br>";
|
2646 |
-
?>
|
2647 |
-
</p>
|
2648 |
<p> <strong> <?php _e( 'Email:', 'woocommerce-abandoned-cart' ); ?> </strong>
|
2649 |
<?php $user_mail_to = "mailto:".$user_email; ?>
|
2650 |
<a href=<?php echo $user_mail_to;?>><?php echo $user_email;?> </a>
|
2651 |
-
</p>
|
2652 |
<p> <strong> <?php _e( 'Phone:', 'woocommerce-abandoned-cart' ); ?> </strong>
|
2653 |
<?php echo $user_billing_phone;?>
|
2654 |
</p>
|
2655 |
-
</div>
|
2656 |
<div style="width:50%;float:right">
|
2657 |
-
<h3> <p> <?php _e( 'Shipping Details', 'woocommerce-abandoned-cart' ); ?> </p> </h3>
|
2658 |
<p> <strong> <?php _e( 'Address:', 'woocommerce-abandoned-cart' ); ?> </strong>
|
2659 |
-
<?php
|
2660 |
if ( $user_shipping_company == '' &&
|
2661 |
$user_shipping_address_1 == '' &&
|
2662 |
$user_shipping_address_2 == '' &&
|
@@ -2665,7 +2783,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2665 |
$user_shipping_state == '' &&
|
2666 |
$user_shipping_country == '') {
|
2667 |
echo "Shipping Address same as Billing Address";
|
2668 |
-
} else { ?>
|
2669 |
<?php echo $user_shipping_company."</br>".
|
2670 |
$user_shipping_address_1."</br>".
|
2671 |
$user_shipping_address_2."</br>".
|
@@ -2673,20 +2791,20 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2673 |
$user_shipping_postcode."</br>".
|
2674 |
$user_shipping_state."</br>".
|
2675 |
$user_shipping_country."</br>";
|
2676 |
-
?>
|
2677 |
<br><br>
|
2678 |
<strong><?php _e( 'Shipping Charges', 'woocommerce-abandoned-lite' ); ?>: </strong>
|
2679 |
<?php if ( $shipping_charges != 0 ) echo $currency_symbol . $shipping_charges;?>
|
2680 |
</p>
|
2681 |
-
<?php }?>
|
2682 |
</div>
|
2683 |
</div>
|
2684 |
</div>
|
2685 |
-
</div>
|
2686 |
<?php } elseif ( $action == 'report' ) {
|
2687 |
include_once('includes/classes/class-wcal-product-report-table.php');
|
2688 |
$wcal_product_report_list = new WCAL_Product_Report_Table();
|
2689 |
-
$wcal_product_report_list->wcal_product_report_prepare_items();
|
2690 |
?>
|
2691 |
<div class="wrap">
|
2692 |
<form id="wcal-sent-emails" method="get" >
|
@@ -2694,27 +2812,27 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2694 |
<input type="hidden" name="action" value="report" />
|
2695 |
<?php $wcal_product_report_list->display(); ?>
|
2696 |
</form>
|
2697 |
-
</div>
|
2698 |
<?php }
|
2699 |
}
|
2700 |
echo( "</table>" );
|
2701 |
-
|
2702 |
if ( isset( $_GET['action'] ) ) {
|
2703 |
$action = $_GET['action'];
|
2704 |
-
}
|
2705 |
if ( isset( $_GET['mode'] ) ) {
|
2706 |
$mode = $_GET['mode'];
|
2707 |
}
|
2708 |
-
if ( 'emailtemplates' == $action && ( 'addnewtemplate' == $mode || 'edittemplate' == $mode ) ) {
|
2709 |
if ( 'edittemplate' == $mode ) {
|
2710 |
$results = array();
|
2711 |
-
if ( isset( $_GET['id'] ) ) {
|
2712 |
$edit_id = $_GET['id'];
|
2713 |
$query = "SELECT wpet . * FROM `".$wpdb->prefix."ac_email_templates_lite` AS wpet WHERE id = %d ";
|
2714 |
$results = $wpdb->get_results( $wpdb->prepare( $query, $edit_id ) );
|
2715 |
}
|
2716 |
}
|
2717 |
-
$active_post = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
|
2718 |
?>
|
2719 |
<div id="content">
|
2720 |
<form method="post" action="admin.php?page=woocommerce_ac_page&action=emailtemplates" id="ac_settings">
|
@@ -2723,8 +2841,8 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2723 |
$id_by = "";
|
2724 |
if ( isset( $_GET['id'] ) ) {
|
2725 |
$id_by = $_GET['id'];
|
2726 |
-
}
|
2727 |
-
?>
|
2728 |
<input type="hidden" name="id" value="<?php echo $id_by ;?>" />
|
2729 |
<?php
|
2730 |
$button_mode = "save";
|
@@ -2748,12 +2866,12 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2748 |
$template_name = "";
|
2749 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->template_name ) ) {
|
2750 |
$template_name = $results[0]->template_name;
|
2751 |
-
}
|
2752 |
print'<input type="text" name="woocommerce_ac_template_name" id="woocommerce_ac_template_name" class="regular-text" value="'.$template_name.'">';?>
|
2753 |
<img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter a template name for reference', 'woocommerce-abandoned-cart') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
|
2754 |
</td>
|
2755 |
</tr>
|
2756 |
-
|
2757 |
<tr>
|
2758 |
<th>
|
2759 |
<label for="woocommerce_ac_email_subject"><b><?php _e( 'Subject:', 'woocommerce-abandoned-cart' ); ?></b></label>
|
@@ -2763,7 +2881,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2763 |
$subject_edit = "";
|
2764 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->subject ) ) {
|
2765 |
$subject_edit= stripslashes ( $results[0]->subject );
|
2766 |
-
}
|
2767 |
print'<input type="text" name="woocommerce_ac_email_subject" id="woocommerce_ac_email_subject" class="regular-text" value="'.$subject_edit.'">';?>
|
2768 |
<img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter the subject that should appear in the email sent', 'woocommerce-abandoned-cart') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
|
2769 |
</td>
|
@@ -2773,14 +2891,14 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2773 |
<th>
|
2774 |
<label for="woocommerce_ac_email_body"><b><?php _e( 'Email Body:', 'woocommerce-abandoned-cart' ); ?></b></label>
|
2775 |
</th>
|
2776 |
-
<td>
|
2777 |
<?php
|
2778 |
$initial_data = "";
|
2779 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->body ) ) {
|
2780 |
$initial_data = stripslashes( $results[0]->body );
|
2781 |
}
|
2782 |
-
|
2783 |
-
$initial_data = str_replace ( "My document title", "", $initial_data );
|
2784 |
wp_editor(
|
2785 |
$initial_data,
|
2786 |
'woocommerce_ac_email_body',
|
@@ -2793,7 +2911,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2793 |
),
|
2794 |
)
|
2795 |
);
|
2796 |
-
|
2797 |
?>
|
2798 |
<?php echo stripslashes( get_option( 'woocommerce_ac_email_body' ) ); ?>
|
2799 |
<span class="description">
|
@@ -2822,17 +2940,17 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2822 |
}
|
2823 |
}
|
2824 |
</script>
|
2825 |
-
|
2826 |
<tr>
|
2827 |
<th>
|
2828 |
<label for="is_wc_template"><b><?php _e( 'Use WooCommerce Template Style:', 'woocommerce-abandoned-cart' ); ?></b></label>
|
2829 |
</th>
|
2830 |
<td>
|
2831 |
<?php
|
2832 |
-
$is_wc_template = "";
|
2833 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->is_wc_template ) ) {
|
2834 |
$use_wc_template = $results[0]->is_wc_template;
|
2835 |
-
|
2836 |
if ( '1' == $use_wc_template ) {
|
2837 |
$is_wc_template = "checked";
|
2838 |
} else {
|
@@ -2840,11 +2958,11 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2840 |
}
|
2841 |
}
|
2842 |
print'<input type="checkbox" name="is_wc_template" id="is_wc_template" ' . $is_wc_template . '> </input>'; ?>
|
2843 |
-
<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-abandoned-cart' ) ; ?> >
|
2844 |
-
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-abandoned-cart' ) ; ?>>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.
|
2845 |
</td>
|
2846 |
</tr>
|
2847 |
-
|
2848 |
<tr>
|
2849 |
<th>
|
2850 |
<label for="wcal_wc_email_header"><b><?php _e( 'Email Template Header Text: ', 'woocommerce-abandoned-cart' ); ?></b></label>
|
@@ -2852,19 +2970,19 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2852 |
<td>
|
2853 |
|
2854 |
<?php
|
2855 |
-
|
2856 |
-
$wcal_wc_email_header = "";
|
2857 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->wc_email_header ) ) {
|
2858 |
$wcal_wc_email_header = $results[0]->wc_email_header;
|
2859 |
-
}
|
2860 |
if ( '' == $wcal_wc_email_header ) {
|
2861 |
$wcal_wc_email_header = "Abandoned cart reminder";
|
2862 |
}
|
2863 |
print'<input type="text" name="wcal_wc_email_header" id="wcal_wc_email_header" class="regular-text" value="' . $wcal_wc_email_header . '">'; ?>
|
2864 |
<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-abandoned-cart' ) ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
|
2865 |
</td>
|
2866 |
-
</tr>
|
2867 |
-
|
2868 |
<tr>
|
2869 |
<th>
|
2870 |
<label for="woocommerce_ac_email_frequency"><b><?php _e( 'Send this email:', 'woocommerce-abandoned-cart' ); ?></b></label>
|
@@ -2875,24 +2993,24 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2875 |
$frequency_edit = "";
|
2876 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->frequency ) ) {
|
2877 |
$frequency_edit = $results[0]->frequency;
|
2878 |
-
}
|
2879 |
for ( $i = 1; $i < 4; $i++ ) {
|
2880 |
printf( "<option %s value='%s'>%s</option>\n",
|
2881 |
selected( $i, $frequency_edit, false ),
|
2882 |
esc_attr( $i ),
|
2883 |
$i
|
2884 |
);
|
2885 |
-
}
|
2886 |
-
?>
|
2887 |
</select>
|
2888 |
|
2889 |
-
<select name="day_or_hour" id="day_or_hour">
|
2890 |
<?php
|
2891 |
$days_or_hours_edit = "";
|
2892 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->day_or_hour ) )
|
2893 |
{
|
2894 |
$days_or_hours_edit = $results[0]->day_or_hour;
|
2895 |
-
}
|
2896 |
$days_or_hours = array(
|
2897 |
'Days' => 'Day(s)',
|
2898 |
'Hours' => 'Hour(s)'
|
@@ -2906,43 +3024,43 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2906 |
);
|
2907 |
}
|
2908 |
?>
|
2909 |
-
</select>
|
2910 |
<span class="description">
|
2911 |
<?php _e( 'after cart is abandoned.', 'woocommerce-abandoned-cart' ); ?>
|
2912 |
</span>
|
2913 |
</td>
|
2914 |
</tr>
|
2915 |
-
|
2916 |
<tr>
|
2917 |
<th>
|
2918 |
<label for="woocommerce_ac_email_preview"><b><?php _e( 'Send a test email to:', 'woocommerce-abandoned-cart' ); ?></b></label>
|
2919 |
</th>
|
2920 |
-
<td>
|
2921 |
<input type="text" id="send_test_email" name="send_test_email" class="regular-text" >
|
2922 |
<input type="button" value="Send a test email" id="preview_email" onclick="javascript:void(0);">
|
2923 |
<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-abandoned-cart') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
|
2924 |
<div id="preview_email_sent_msg" style="display:none;"></div>
|
2925 |
</td>
|
2926 |
-
</tr>
|
2927 |
</table>
|
2928 |
</div>
|
2929 |
</div>
|
2930 |
</div>
|
2931 |
<p class="submit">
|
2932 |
<?php
|
2933 |
-
$button_value = "Save Changes";
|
2934 |
if ( 'edittemplate' == $mode ) {
|
2935 |
-
$button_value = "Update Changes";
|
2936 |
}
|
2937 |
?>
|
2938 |
-
<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e( $button_value
|
2939 |
</p>
|
2940 |
</form>
|
2941 |
</div>
|
2942 |
-
<?php
|
2943 |
-
}
|
2944 |
}
|
2945 |
-
|
2946 |
/**
|
2947 |
* It will add the footer text for the plugin.
|
2948 |
* @hook admin_footer_text
|
@@ -2953,17 +3071,16 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2953 |
function wcal_admin_footer_text( $footer_text ) {
|
2954 |
|
2955 |
if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'woocommerce_ac_page' ) {
|
2956 |
-
$footer_text =
|
2957 |
-
rating. Thank you in advance. :)', 'woocommerce-abandoned-cart' ) );
|
2958 |
wc_enqueue_js( "
|
2959 |
jQuery( 'a.ac-rating-link' ).click( function() {
|
2960 |
jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
|
2961 |
});
|
2962 |
-
" );
|
2963 |
-
}
|
2964 |
return $footer_text;
|
2965 |
}
|
2966 |
-
|
2967 |
/**
|
2968 |
* It will sort the record for the product reports tab.
|
2969 |
* @param array $unsort_array Unsorted array
|
@@ -2971,12 +3088,12 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2971 |
* @return array $array
|
2972 |
* @since 2.6
|
2973 |
*/
|
2974 |
-
function bubble_sort_function( $unsort_array, $order ) {
|
2975 |
$temp = array();
|
2976 |
foreach ( $unsort_array as $key => $value )
|
2977 |
-
$temp[ $key ] = $value; //concatenate something unique to make sure two equal weights don't overwrite each other
|
2978 |
asort( $temp, SORT_NUMERIC ); // or ksort( $temp, SORT_NATURAL ); see paragraph above to understand why
|
2979 |
-
|
2980 |
if ( 'desc' == $order ) {
|
2981 |
$array = array_reverse( $temp, true );
|
2982 |
} else if ( $order == 'asc' ) {
|
@@ -2985,19 +3102,19 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
2985 |
unset( $temp );
|
2986 |
return $array;
|
2987 |
}
|
2988 |
-
|
2989 |
/**
|
2990 |
* It will be called when we send the test email from the email edit page.
|
2991 |
* @hook wp_ajax_wcal_preview_email_sent
|
2992 |
* @since 1.0
|
2993 |
-
*/
|
2994 |
function wcal_action_send_preview() {
|
2995 |
?>
|
2996 |
<script type="text/javascript" >
|
2997 |
jQuery( document ).ready( function( $ )
|
2998 |
{
|
2999 |
$( "table#addedit_template input#preview_email" ).click( function()
|
3000 |
-
{
|
3001 |
var email_body = '';
|
3002 |
if ( jQuery("#wp-woocommerce_ac_email_body-wrap").hasClass( "tmce-active" ) ) {
|
3003 |
email_body = tinyMCE.get('woocommerce_ac_email_body').getContent();
|
@@ -3006,10 +3123,10 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
3006 |
}
|
3007 |
var subject_email_preview = $( '#woocommerce_ac_email_subject' ).val();
|
3008 |
var body_email_preview = email_body;
|
3009 |
-
var send_email_id = $( '#send_test_email' ).val();
|
3010 |
-
var is_wc_template = document.getElementById( "is_wc_template" ).checked;
|
3011 |
-
var wc_template_header = $( '#wcal_wc_email_header' ).val() != '' ? $( '#wcal_wc_email_header' ).val() : 'Abandoned cart reminder';
|
3012 |
-
var data = {
|
3013 |
subject_email_preview: subject_email_preview,
|
3014 |
body_email_preview : body_email_preview,
|
3015 |
send_email_id : send_email_id,
|
@@ -3089,20 +3206,20 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
3089 |
* It will replace the test email data with the static content.
|
3090 |
* @return string email sent | not sent
|
3091 |
* @since 1.0
|
3092 |
-
*/
|
3093 |
function wcal_preview_email_sent() {
|
3094 |
if ( '' != $_POST['body_email_preview'] ) {
|
3095 |
$from_email_name = get_option ( 'wcal_from_name' );
|
3096 |
$reply_name_preview = get_option ( 'wcal_from_email' );
|
3097 |
$from_email_preview = get_option ( 'wcal_reply_email' );
|
3098 |
$subject_email_preview = stripslashes ( $_POST['subject_email_preview'] );
|
3099 |
-
$subject_email_preview = convert_smilies ( $subject_email_preview );
|
3100 |
-
$subject_email_preview = str_replace( '{{customer.firstname}}', 'John', $subject_email_preview );
|
3101 |
$body_email_preview = convert_smilies ( $_POST['body_email_preview'] );
|
3102 |
$is_wc_template = $_POST['is_wc_template'];
|
3103 |
$wc_template_header = stripslashes( $_POST['wc_template_header'] );
|
3104 |
|
3105 |
-
$body_email_preview = str_replace( '{{customer.firstname}}', 'John', $body_email_preview );
|
3106 |
$body_email_preview = str_replace( '{{customer.firstname}}', 'John', $body_email_preview );
|
3107 |
$body_email_preview = str_replace( '{{customer.lastname}}', 'Doe', $body_email_preview );
|
3108 |
$body_email_preview = str_replace( '{{customer.fullname}}', 'John'." ".'Doe', $body_email_preview );
|
@@ -3110,10 +3227,10 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
3110 |
$date_format = date_i18n( get_option( 'date_format' ), $current_time_stamp );
|
3111 |
$time_format = date_i18n( get_option( 'time_format' ), $current_time_stamp );
|
3112 |
$test_date = $date_format . ' ' . $time_format;
|
3113 |
-
$body_email_preview = str_replace( '{{cart.abandoned_date}}', $test_date, $body_email_preview );
|
3114 |
$cart_url = wc_get_page_permalink( 'cart' );
|
3115 |
$body_email_preview = str_replace( '{{cart.link}}', $cart_url, $body_email_preview );
|
3116 |
-
$body_email_preview = str_replace( '{{cart.unsubscribe}}', '#', $body_email_preview );
|
3117 |
$wcal_price = wc_price( '100' );
|
3118 |
$wcal_total_price = wc_price( '200' );
|
3119 |
if ( class_exists( 'WP_Better_Emails' ) ) {
|
@@ -3131,14 +3248,14 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
3131 |
</tr>
|
3132 |
<tr align="center">
|
3133 |
<td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/assets/images/shoes.jpg"/></td>
|
3134 |
-
<td>'.__( "Men
|
3135 |
<td>1</td>
|
3136 |
<td>' . $wcal_price . '</td>
|
3137 |
<td>' . $wcal_price . '</td>
|
3138 |
</tr>
|
3139 |
<tr align="center">
|
3140 |
<td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/assets/images/handbag.jpg"/></td>
|
3141 |
-
<td>'.__( "Woman
|
3142 |
<td>1</td>
|
3143 |
<td>' . $wcal_price . '</td>
|
3144 |
<td>' . $wcal_price . '</td>
|
@@ -3166,14 +3283,14 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
3166 |
</tr>
|
3167 |
<tr align="center">
|
3168 |
<td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/assets/images/shoes.jpg"/></td>
|
3169 |
-
<td>'.__( "Men
|
3170 |
<td>1</td>
|
3171 |
<td>' . $wcal_price . '</td>
|
3172 |
<td>' . $wcal_price . '</td>
|
3173 |
</tr>
|
3174 |
<tr align="center">
|
3175 |
<td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/assets/images/handbag.jpg"/></td>
|
3176 |
-
<td>'.__( "Woman
|
3177 |
<td>1</td>
|
3178 |
<td>' . $wcal_price . '</td>
|
3179 |
<td>' . $wcal_price . '</td>
|
@@ -3186,36 +3303,36 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
3186 |
<td>' . $wcal_total_price . '</td>
|
3187 |
</tr>
|
3188 |
</table>';
|
3189 |
-
}
|
3190 |
-
$body_email_preview = str_replace( '{{products.cart}}', $var, $body_email_preview );
|
3191 |
if ( isset( $_POST['send_email_id'] ) ) {
|
3192 |
$to_email_preview = $_POST['send_email_id'];
|
3193 |
} else {
|
3194 |
$to_email_preview = "";
|
3195 |
-
}
|
3196 |
-
$user_email_from = get_option( 'admin_email' );
|
3197 |
$body_email_final_preview = stripslashes( $body_email_preview );
|
3198 |
-
|
3199 |
if ( isset( $is_wc_template ) && 'true' == $is_wc_template ) {
|
3200 |
ob_start();
|
3201 |
// Get email heading
|
3202 |
wc_get_template( 'emails/email-header.php', array( 'email_heading' => $wc_template_header ) );
|
3203 |
-
$email_body_template_header = ob_get_clean();
|
|
|
|
|
|
|
|
|
3204 |
|
3205 |
-
ob_start();
|
3206 |
-
wc_get_template( 'emails/email-footer.php' );
|
3207 |
-
$email_body_template_footer = ob_get_clean();
|
3208 |
-
|
3209 |
$final_email_body = $email_body_template_header . $body_email_final_preview . $email_body_template_footer;
|
3210 |
|
3211 |
-
$site_title = get_bloginfo( 'name' );
|
3212 |
-
$email_body_template_footer = str_replace( '{site_title}', $site_title, $email_body_template_footer );
|
3213 |
-
|
3214 |
-
wc_mail( $to_email_preview, $subject_email_preview, $final_email_body , $headers );
|
3215 |
}
|
3216 |
else {
|
3217 |
wp_mail( $to_email_preview, $subject_email_preview, stripslashes( $body_email_preview ), $headers );
|
3218 |
-
}
|
3219 |
echo "email sent";
|
3220 |
die();
|
3221 |
} else {
|
@@ -3223,7 +3340,7 @@ if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
|
3223 |
die();
|
3224 |
}
|
3225 |
}
|
3226 |
-
}
|
3227 |
-
}
|
3228 |
$woocommerce_abandon_cart = new woocommerce_abandon_cart_lite();
|
3229 |
?>
|
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.
|
6 |
+
* <strong><a href="http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro">Click here to get the
|
7 |
* PRO Version.</a></strong>
|
8 |
+
* Version: 5.5
|
9 |
* Author: Tyche Softwares
|
10 |
* Author URI: http://www.tychesoftwares.com/
|
11 |
* Text Domain: woocommerce-abandoned-cart
|
44 |
* @since 1.3
|
45 |
* @package Abandoned-Cart-Lite-for-WooCommerce/Cron
|
46 |
*/
|
47 |
+
function wcal_add_cron_schedule( $schedules ) {
|
48 |
$schedules['15_minutes_lite'] = array(
|
49 |
'interval' => 900, // 15 minutes in seconds
|
50 |
'display' => __( 'Once Every Fifteen Minutes' ),
|
56 |
* Schedule an action if it's not already scheduled.
|
57 |
* @since 1.3
|
58 |
* @package Abandoned-Cart-Lite-for-WooCommerce/Cron
|
59 |
+
*/
|
60 |
if ( ! wp_next_scheduled( 'woocommerce_ac_send_email_action' ) ) {
|
61 |
wp_schedule_event( time(), '15_minutes_lite', 'woocommerce_ac_send_email_action' );
|
62 |
}
|
70 |
wp_schedule_event( time(), 'daily', 'wcal_clear_carts' );
|
71 |
}
|
72 |
/**
|
73 |
+
* Hook into that action that'll fire every 15 minutes
|
74 |
*/
|
75 |
add_action( 'woocommerce_ac_send_email_action', 'wcal_send_email_cron' );
|
76 |
|
89 |
* woocommerce_abandon_cart_lite class
|
90 |
**/
|
91 |
if ( ! class_exists( 'woocommerce_abandon_cart_lite' ) ) {
|
92 |
+
|
93 |
|
94 |
/**
|
95 |
+
* It will add the hooks, filters, menu and the variables and all the necessary actions for the plguins which will be used
|
96 |
* all over the plugin.
|
97 |
* @since 1.0
|
98 |
* @package Abandoned-Cart-Lite-for-WooCommerce/Core
|
103 |
var $six_hours;
|
104 |
var $twelve_hours;
|
105 |
var $one_day;
|
106 |
+
var $one_week;
|
107 |
var $duration_range_select = array();
|
108 |
var $start_end_dates = array();
|
109 |
/**
|
110 |
* The constructor will add the hooks, filters and the variable which will be used all over the plugin.
|
111 |
* @since 1.0
|
112 |
+
*
|
113 |
*/
|
114 |
+
public function __construct() {
|
115 |
if ( !defined( 'WCAL_PLUGIN_URL' ) ) {
|
116 |
define('WCAL_PLUGIN_URL', untrailingslashit(plugins_url('/', __FILE__)) );
|
117 |
+
}
|
118 |
$this->one_hour = 60 * 60;
|
119 |
$this->three_hours = 3 * $this->one_hour;
|
120 |
$this->six_hours = 6 * $this->one_hour;
|
121 |
$this->twelve_hours = 12 * $this->one_hour;
|
122 |
$this->one_day = 24 * $this->one_hour;
|
123 |
+
$this->one_week = 7 * $this->one_day;
|
124 |
$this->duration_range_select = array( 'yesterday' => 'Yesterday',
|
125 |
'today' => 'Today',
|
126 |
'last_seven' => 'Last 7 days',
|
127 |
'last_fifteen' => 'Last 15 days',
|
128 |
'last_thirty' => 'Last 30 days',
|
129 |
'last_ninety' => 'Last 90 days',
|
130 |
+
'last_year_days' => 'Last 365'
|
131 |
);
|
132 |
+
|
133 |
$this->start_end_dates = array( 'yesterday' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 24*60*60 ) ),
|
134 |
'end_date' => date( "d M Y", ( current_time( 'timestamp' ) - 7*24*60*60 ) ) ),
|
135 |
'today' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ),
|
143 |
'last_ninety' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 90*24*60*60 ) ),
|
144 |
'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) ),
|
145 |
'last_year_days' => array( 'start_date' => date( "d M Y", ( current_time( 'timestamp' ) - 365*24*60*60 ) ),
|
146 |
+
'end_date' => date( "d M Y", ( current_time( 'timestamp' ) ) ) )
|
147 |
);
|
148 |
+
|
149 |
// Initialize settings
|
150 |
register_activation_hook ( __FILE__, array( &$this, 'wcal_activate' ) );
|
151 |
|
152 |
// Background Processing for Cron
|
153 |
require_once( 'cron/wcal_send_email.php' );
|
154 |
require_once( 'includes/background-processes/wcal_process_base.php' );
|
155 |
+
|
156 |
+
// WordPress Administration Menu
|
157 |
add_action ( 'admin_menu', array( &$this, 'wcal_admin_menu' ) );
|
158 |
+
|
159 |
// Actions to be done on cart update
|
160 |
add_action( 'woocommerce_add_to_cart', array( &$this, 'wcal_store_cart_timestamp' ), 100 );
|
161 |
add_action( 'woocommerce_cart_item_removed', array( &$this, 'wcal_store_cart_timestamp' ), 100 );
|
164 |
add_action( 'woocommerce_calculate_totals', array( &$this, 'wcal_store_cart_timestamp' ), 100 );
|
165 |
|
166 |
add_action ( 'admin_init', array( &$this, 'wcal_action_admin_init' ) );
|
167 |
+
|
168 |
// Update the options as per settings API
|
169 |
add_action ( 'admin_init', array( &$this, 'wcal_update_db_check' ) );
|
170 |
|
171 |
// Wordpress settings API
|
172 |
add_action( 'admin_init', array( &$this, 'wcal_initialize_plugin_options' ) );
|
173 |
+
|
174 |
// Language Translation
|
175 |
add_action ( 'init', array( &$this, 'wcal_update_po_file' ) );
|
176 |
|
177 |
add_action ( 'init', array ( &$this, 'wcal_add_component_file') );
|
178 |
+
|
179 |
// track links
|
180 |
add_filter( 'template_include', array( &$this, 'wcal_email_track_links' ), 99, 1 );
|
181 |
+
|
182 |
//It will used to unsubcribe the emails.
|
183 |
add_action( 'template_include', array( &$this, 'wcal_email_unsubscribe'),99, 1 );
|
184 |
+
|
185 |
add_action ( 'admin_enqueue_scripts', array( &$this, 'wcal_enqueue_scripts_js' ) );
|
186 |
add_action ( 'admin_enqueue_scripts', array( &$this, 'wcal_enqueue_scripts_css' ) );
|
187 |
//delete abandoned order after X number of days
|
188 |
if ( class_exists( 'wcal_delete_bulk_action_handler' ) ) {
|
189 |
add_action( 'wcal_clear_carts', array( 'wcal_delete_bulk_action_handler', 'wcal_delete_abandoned_carts_after_x_days' ) );
|
190 |
}
|
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 |
+
add_action ( 'wp_ajax_wcal_toggle_template_status', array( &$this, 'wcal_toggle_template_status' ) );
|
197 |
|
198 |
add_filter( 'ts_tracker_data', array( 'wcal_common', 'ts_add_plugin_tracking_data' ), 10, 1 );
|
199 |
add_filter( 'ts_tracker_opt_out_data', array( 'wcal_common', 'ts_get_data_for_opt_out' ), 10, 1 );
|
200 |
add_filter( 'ts_deativate_plugin_questions', array( &$this, 'wcal_deactivate_add_questions' ), 10, 1 );
|
201 |
}
|
202 |
+
|
203 |
// Plugin Settings link in WP->Plugins page
|
204 |
$plugin = plugin_basename( __FILE__ );
|
205 |
add_action( "plugin_action_links_$plugin", array( &$this, 'wcal_settings_link' ) );
|
206 |
+
|
207 |
add_action( 'admin_init', array( $this, 'wcal_preview_emails' ) );
|
208 |
+
add_action( 'init', array( $this, 'wcal_app_output_buffer') );
|
209 |
|
210 |
add_filter( 'admin_footer_text', array( $this, 'wcal_admin_footer_text' ), 1 );
|
211 |
|
213 |
|
214 |
include_once 'includes/frontend/wcal_frontend.php';
|
215 |
}
|
216 |
+
|
217 |
/**
|
218 |
* Add Settings link to WP->Plugins page
|
219 |
* @since 5.3.0
|
232 |
public static function wcal_add_component_file () {
|
233 |
if ( is_admin() ) {
|
234 |
require_once( 'includes/wcal_all_component.php' );
|
235 |
+
|
236 |
}
|
237 |
}
|
238 |
/**
|
249 |
'text' => __( "Emails are not being sent to customers.", "woocommerce-abandoned-cart" ),
|
250 |
'input_type' => '',
|
251 |
'input_placeholder' => ''
|
252 |
+
),
|
253 |
1 => array(
|
254 |
'id' => 5,
|
255 |
'text' => __( "Capturing of cart and other information was not satisfactory.", "woocommerce-abandoned-cart" ),
|
288 |
$message = '';
|
289 |
// create a new email
|
290 |
if ( $woocommerce->version < '2.3' ) {
|
291 |
+
global $email_heading;
|
292 |
ob_start();
|
293 |
+
|
294 |
include( 'views/wcal-wc-email-template-preview.php' );
|
295 |
$mailer = WC()->mailer();
|
296 |
$message = ob_get_clean();
|
298 |
$message = $mailer->wrap_message( $email_heading, $message );
|
299 |
} else {
|
300 |
// load the mailer class
|
301 |
+
$mailer = WC()->mailer();
|
302 |
// get the preview email subject
|
303 |
+
$email_heading = __( 'Abandoned cart Email Template', 'woocommerce-abandoned-cart' );
|
304 |
// get the preview email content
|
305 |
ob_start();
|
306 |
include( 'views/wcal-wc-email-template-preview.php' );
|
307 |
+
$message = ob_get_clean();
|
308 |
// create a new email
|
309 |
+
$email = new WC_Email();
|
310 |
// wrap the content with the email template and then add styles
|
311 |
$message = $email->style_inline( $mailer->wrap_message( $email_heading, $message ) );
|
312 |
+
}
|
313 |
echo $message;
|
314 |
exit;
|
315 |
}
|
316 |
+
|
317 |
if ( isset( $_GET['wcal_preview_mail'] ) ) {
|
318 |
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-abandoned-cart' ) ) {
|
319 |
die( 'Security check' );
|
321 |
// get the preview email content
|
322 |
ob_start();
|
323 |
include( 'views/wcal-email-template-preview.php' );
|
324 |
+
$message = ob_get_clean();
|
325 |
// print the preview email
|
326 |
echo $message;
|
327 |
exit;
|
348 |
load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/i18n/languages/' );
|
349 |
}
|
350 |
}
|
351 |
+
|
352 |
/**
|
353 |
* It will create the plugin tables & the options reqired for plugin.
|
354 |
* @hook register_activation_hook
|
355 |
* @globals mixed $wpdb
|
356 |
* @since 1.0
|
357 |
+
*/
|
358 |
function wcal_activate() {
|
359 |
+
global $wpdb;
|
360 |
$wcap_collate = '';
|
361 |
if ( $wpdb->has_cap( 'collation' ) ) {
|
362 |
$wcap_collate = $wpdb->get_charset_collate();
|
363 |
}
|
364 |
+
$table_name = $wpdb->prefix . "ac_email_templates_lite";
|
365 |
$sql = "CREATE TABLE IF NOT EXISTS $table_name (
|
366 |
`id` int(11) NOT NULL AUTO_INCREMENT,
|
367 |
`subject` text NOT NULL,
|
375 |
`wc_email_header` varchar(50) NOT NULL,
|
376 |
PRIMARY KEY (`id`)
|
377 |
) $wcap_collate AUTO_INCREMENT=1 ";
|
378 |
+
|
379 |
require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
380 |
dbDelta( $sql );
|
381 |
+
|
382 |
// $table_name = $wpdb->prefix . "ac_email_templates_lite";
|
383 |
// $check_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'is_wc_template' ";
|
384 |
// $results = $wpdb->get_results( $check_template_table_query );
|
385 |
+
|
386 |
// if ( count( $results ) == 0 ) {
|
387 |
// $alter_template_table_query = "ALTER TABLE $table_name
|
388 |
// ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8mb4_unicode_ci NOT NULL AFTER `template_name`,
|
389 |
// ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
|
390 |
+
|
391 |
// $wpdb->get_results( $alter_template_table_query );
|
392 |
// }
|
393 |
+
|
394 |
$sent_table_name = $wpdb->prefix . "ac_sent_history_lite";
|
395 |
+
|
396 |
$sql_query = "CREATE TABLE IF NOT EXISTS $sent_table_name (
|
397 |
`id` int(11) NOT NULL auto_increment,
|
398 |
`template_id` varchar(40) collate utf8_unicode_ci NOT NULL,
|
401 |
`sent_email_id` text COLLATE utf8_unicode_ci NOT NULL,
|
402 |
PRIMARY KEY (`id`)
|
403 |
) $wcap_collate AUTO_INCREMENT=1 ";
|
404 |
+
|
405 |
require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
406 |
dbDelta ( $sql_query );
|
407 |
+
|
408 |
$ac_history_table_name = $wpdb->prefix . "ac_abandoned_cart_history_lite";
|
409 |
+
|
410 |
$history_query = "CREATE TABLE IF NOT EXISTS $ac_history_table_name (
|
411 |
`id` int(11) NOT NULL AUTO_INCREMENT,
|
412 |
`user_id` int(11) NOT NULL,
|
419 |
`session_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
|
420 |
PRIMARY KEY (`id`)
|
421 |
) $wcap_collate";
|
422 |
+
|
423 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
424 |
dbDelta( $history_query );
|
425 |
// Default templates: function call to create default templates.
|
426 |
$check_table_empty = $wpdb->get_var( "SELECT COUNT(*) FROM `" . $wpdb->prefix . "ac_email_templates_lite`" );
|
427 |
+
|
428 |
+
if ( ! get_option( 'wcal_new_default_templates' ) ) {
|
429 |
if ( 0 == $check_table_empty ) {
|
430 |
$default_template = new wcal_default_template_settings;
|
431 |
$default_template->wcal_create_default_templates();
|
435 |
|
436 |
$guest_table = $wpdb->prefix."ac_guest_abandoned_cart_history_lite" ;
|
437 |
$query_guest_table = "SHOW TABLES LIKE '$guest_table' ";
|
438 |
+
$result_guest_table = $wpdb->get_results( $query_guest_table );
|
439 |
+
|
440 |
if ( 0 == count( $result_guest_table ) ) {
|
441 |
$ac_guest_history_table_name = $wpdb->prefix . "ac_guest_abandoned_cart_history_lite";
|
442 |
$ac_guest_history_query = "CREATE TABLE IF NOT EXISTS $ac_guest_history_table_name (
|
466 |
) $wcap_collate AUTO_INCREMENT=63000000";
|
467 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
|
468 |
$wpdb->query( $ac_guest_history_query );
|
469 |
+
}
|
470 |
|
471 |
/**
|
472 |
* This is add for thos user who Install the plguin first time.
|
474 |
*/
|
475 |
if ( ! get_option( 'ac_lite_track_guest_cart_from_cart_page' ) ) {
|
476 |
add_option( 'ac_lite_track_guest_cart_from_cart_page', 'on' );
|
477 |
+
}
|
478 |
if ( ! get_option( 'wcal_from_name' ) ) {
|
479 |
add_option( 'wcal_from_name', 'Admin' );
|
480 |
}
|
482 |
if ( ! get_option( 'wcal_from_email' ) ) {
|
483 |
add_option( 'wcal_from_email', $wcal_get_admin_email );
|
484 |
}
|
485 |
+
|
486 |
if ( ! get_option( 'wcal_reply_email' ) ) {
|
487 |
add_option( 'wcal_reply_email', $wcal_get_admin_email );
|
488 |
}
|
489 |
|
490 |
do_action( 'wcal_activate' );
|
491 |
+
}
|
492 |
+
|
493 |
/**
|
494 |
* It will add the section, field, & registres the plugin fields using Settings API.
|
495 |
* @hook admin_init
|
504 |
array( $this, 'ac_lite_general_options_callback' ), // Callback used to render the description of the section
|
505 |
'woocommerce_ac_page' // Page on which to add this section of options
|
506 |
);
|
507 |
+
|
508 |
+
add_settings_field(
|
509 |
+
'wcal_enable_cart_emails',
|
510 |
+
__( 'Enable abandoned cart emails', 'woocommerce-abandoned-cart' ),
|
511 |
+
array( $this, 'wcal_enable_cart_emails_callback' ),
|
512 |
+
'woocommerce_ac_page',
|
513 |
+
'ac_lite_general_settings_section',
|
514 |
+
array( __( "Yes, enable the abandoned cart emails.", 'woocommerce-abandoned-cart' ) )
|
515 |
+
);
|
516 |
+
|
517 |
add_settings_field(
|
518 |
'ac_lite_cart_abandoned_time',
|
519 |
__( 'Cart abandoned cut-off time', 'woocommerce-abandoned-cart' ),
|
532 |
array( __( 'Automatically delete abandoned cart orders after X days.', 'woocommerce-abandoned-cart' ) )
|
533 |
);
|
534 |
|
535 |
+
|
536 |
add_settings_field(
|
537 |
'ac_lite_email_admin_on_recovery',
|
538 |
__( 'Email admin On Order Recovery', 'woocommerce-abandoned-cart' ),
|
542 |
array( __( 'Sends email to Admin if an Abandoned Cart Order is recovered.', 'woocommerce-abandoned-cart' ) )
|
543 |
);
|
544 |
|
545 |
+
|
546 |
add_settings_field(
|
547 |
'ac_lite_track_guest_cart_from_cart_page',
|
548 |
__( 'Start tracking from Cart Page', 'woocommerce-abandoned-cart' ),
|
560 |
'ac_lite_general_settings_section',
|
561 |
array( __( '<br>In compliance with GDPR, add a message on the Checkout page to inform Guest users of how their data is being used.<br><i>For example: Your email address will help us support your shopping experience throughout the site. Please check our Privacy Policy to see how we use your personal data.</i>', 'woocommerce-abandoned-cart' ) )
|
562 |
);
|
563 |
+
|
564 |
add_settings_field(
|
565 |
'wcal_logged_cart_capture_msg',
|
566 |
__( 'Message to be displayed for registered users when tracking their carts.', 'woocommerce-abandoned-cart' ),
|
569 |
'ac_lite_general_settings_section',
|
570 |
array( __( '<br>In compliance with GDPR, add a message on the Shop & Product pages to inform Registered users of how their data is being used.<br><i>For example: Please check our Privacy Policy to see how we use your personal data.</i>', 'woocommerce-abandoned-cart' ) )
|
571 |
);
|
572 |
+
|
573 |
+
add_settings_field(
|
574 |
+
'wcal_gdpr_allow_opt_out',
|
575 |
+
__( 'Allow the visitor to opt out of cart tracking.', 'woocommerce-abandoned-cart' ),
|
576 |
+
array( $this, 'wcal_gdpr_allow_opt_out_callback' ),
|
577 |
+
'woocommerce_ac_page',
|
578 |
+
'ac_lite_general_settings_section',
|
579 |
+
array( __( '<br>In compliance with GDPR, allow the site visitor (guests & registered users) to opt out from cart tracking. This message will be displayed in conjunction with the GDPR message above.</i>', 'woocommerce-abandoned-cart' ) )
|
580 |
+
);
|
581 |
|
582 |
+
add_settings_field(
|
583 |
+
'wcal_gdpr_opt_out_message',
|
584 |
+
__( 'Message to be displayed when the user chooses to opt out of cart tracking.', 'woocommerce-abandoned-cart' ),
|
585 |
+
array( $this, 'wcal_gdpr_opt_out_msg_callback' ),
|
586 |
+
'woocommerce_ac_page',
|
587 |
+
'ac_lite_general_settings_section',
|
588 |
+
array( __( '<br>Message to be displayed when the user chooses to opt out of cart tracking.</i>', 'woocommerce-abandoned-cart' ) )
|
589 |
+
);
|
590 |
+
|
591 |
/**
|
592 |
* New section for the Adding the abandoned cart setting.
|
593 |
* @since 4.7
|
594 |
*/
|
595 |
+
|
596 |
add_settings_section(
|
597 |
'ac_email_settings_section', // ID used to identify this section and with which to register options
|
598 |
__( 'Settings for abandoned cart recovery emails', 'woocommerce-abandoned-cart' ), // Title to be displayed on the administration page
|
599 |
array( $this, 'wcal_email_callback' ), // Callback used to render the description of the section
|
600 |
'woocommerce_ac_email_page' // Page on which to add this section of options
|
601 |
);
|
602 |
+
|
603 |
add_settings_field(
|
604 |
'wcal_from_name',
|
605 |
__( '"From" Name', 'woocommerce-abandoned-cart' ),
|
608 |
'ac_email_settings_section',
|
609 |
array( 'Enter the name that should appear in the email sent.', 'woocommerce-abandoned-cart' )
|
610 |
);
|
611 |
+
|
612 |
add_settings_field(
|
613 |
'wcal_from_email',
|
614 |
__( '"From" Address', 'woocommerce-abandoned-cart' ),
|
617 |
'ac_email_settings_section',
|
618 |
array( 'Email address from which the reminder emails should be sent.', 'woocommerce-abandoned-cart' )
|
619 |
);
|
620 |
+
|
621 |
add_settings_field(
|
622 |
'wcal_reply_email',
|
623 |
__( 'Send Reply Emails to', 'woocommerce-abandoned-cart' ),
|
626 |
'ac_email_settings_section',
|
627 |
array( 'When a contact receives your email and clicks reply, which email address should that reply be sent to?', 'woocommerce-abandoned-cart' )
|
628 |
);
|
629 |
+
|
630 |
// Finally, we register the fields with WordPress
|
631 |
+
register_setting(
|
632 |
+
'woocommerce_ac_settings',
|
633 |
+
'wcal_enable_cart_emails'
|
634 |
+
);
|
635 |
+
|
636 |
register_setting(
|
637 |
'woocommerce_ac_settings',
|
638 |
'ac_lite_cart_abandoned_time',
|
644 |
'ac_lite_delete_abandoned_order_days',
|
645 |
array ( $this, 'wcal_delete_days_validation' )
|
646 |
);
|
647 |
+
|
648 |
register_setting(
|
649 |
'woocommerce_ac_settings',
|
650 |
'ac_lite_email_admin_on_recovery'
|
651 |
);
|
652 |
+
|
653 |
register_setting(
|
654 |
'woocommerce_ac_settings',
|
655 |
'ac_lite_track_guest_cart_from_cart_page'
|
659 |
'woocommerce_ac_settings',
|
660 |
'wcal_guest_cart_capture_msg'
|
661 |
);
|
662 |
+
|
663 |
register_setting(
|
664 |
'woocommerce_ac_settings',
|
665 |
'wcal_logged_cart_capture_msg'
|
666 |
);
|
667 |
+
|
668 |
+
register_setting(
|
669 |
+
'woocommerce_ac_settings',
|
670 |
+
'wcal_gdpr_allow_opt_out'
|
671 |
+
);
|
672 |
+
|
673 |
+
register_setting(
|
674 |
+
'woocommerce_ac_settings',
|
675 |
+
'wcal_gdpr_opt_out_message'
|
676 |
+
);
|
677 |
+
|
678 |
register_setting(
|
679 |
'woocommerce_ac_email_settings',
|
680 |
'wcal_from_name'
|
690 |
|
691 |
do_action ( "wcal_add_new_settings" );
|
692 |
}
|
693 |
+
|
694 |
/**
|
695 |
* Settings API callback for section "ac_lite_general_settings_section".
|
696 |
* @since 2.5
|
697 |
*/
|
698 |
function ac_lite_general_options_callback() {
|
699 |
+
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Settings API callback for the enable cart reminder emails
|
704 |
+
* @since 5.5
|
705 |
+
*/
|
706 |
+
public static function wcal_enable_cart_emails_callback( $args ) {
|
707 |
+
|
708 |
+
$enable_cart_emails = get_option( 'wcal_enable_cart_emails' );
|
709 |
+
|
710 |
+
if (isset( $enable_cart_emails ) && $enable_cart_emails == "" ) {
|
711 |
+
$enable_cart_emails = 'off';
|
712 |
+
}
|
713 |
+
$html = '<input type="checkbox" id="wcal_enable_cart_emails" name="wcal_enable_cart_emails" value="on" ' . checked( 'on', $enable_cart_emails, false ) . ' />';
|
714 |
+
$html .= '<label for="wcal_enable_cart_emails"> ' . $args[0] . '</label>';
|
715 |
+
echo $html;
|
716 |
}
|
717 |
+
|
718 |
/**
|
719 |
* Settings API callback for cart time field.
|
720 |
* @param array $args Arguments
|
733 |
$html = '<label for="ac_lite_cart_abandoned_time"> ' . $args[0] . '</label>';
|
734 |
echo $html;
|
735 |
}
|
736 |
+
|
737 |
/**
|
738 |
* Settings API cart time field validation.
|
739 |
* @param int | string $input
|
784 |
$html = '<label for="ac_lite_delete_abandoned_order_days"> ' . $args[0] . '</label>';
|
785 |
echo $html;
|
786 |
}
|
787 |
+
|
788 |
/**
|
789 |
* Settings API callback for email admin on cart recovery field.
|
790 |
* @param array $args Arguments
|
791 |
* @since 2.5
|
792 |
*/
|
793 |
+
function ac_lite_email_admin_on_recovery( $args ) {
|
794 |
// First, we read the option
|
795 |
$email_admin_on_recovery = get_option( 'ac_lite_email_admin_on_recovery' );
|
796 |
+
|
797 |
// This condition added to avoid the notie displyed while Check box is unchecked.
|
798 |
if ( isset( $email_admin_on_recovery ) && '' == $email_admin_on_recovery ) {
|
799 |
$email_admin_on_recovery = 'off';
|
800 |
+
}
|
801 |
// Next, we update the name attribute to access this element's ID in the context of the display options array
|
802 |
// We also access the show_header element of the options collection in the call to the checked() helper function
|
803 |
$html='';
|
805 |
'<input type="checkbox" id="ac_lite_email_admin_on_recovery" name="ac_lite_email_admin_on_recovery" value="on"
|
806 |
' . checked('on', $email_admin_on_recovery, false).' />'
|
807 |
);
|
808 |
+
|
809 |
// Here, we'll take the first argument of the array and add it to a label next to the checkbox
|
810 |
$html .= '<label for="ac_lite_email_admin_on_recovery"> ' . $args[0] . '</label>';
|
811 |
echo $html;
|
818 |
function wcal_track_guest_cart_from_cart_page_callback( $args ) {
|
819 |
// First, we read the option
|
820 |
$disable_guest_cart_from_cart_page = get_option( 'ac_lite_track_guest_cart_from_cart_page' );
|
821 |
+
|
822 |
// This condition added to avoid the notice displyed while Check box is unchecked.
|
823 |
if ( isset( $disable_guest_cart_from_cart_page ) && '' == $disable_guest_cart_from_cart_page ) {
|
824 |
$disable_guest_cart_from_cart_page = 'off';
|
826 |
// Next, we update the name attribute to access this element's ID in the context of the display options array
|
827 |
// We also access the show_header element of the options collection in the call to the checked() helper function
|
828 |
$html = '';
|
829 |
+
|
830 |
printf(
|
831 |
'<input type="checkbox" id="ac_lite_track_guest_cart_from_cart_page" name="ac_lite_track_guest_cart_from_cart_page" value="on"
|
832 |
'.checked( 'on', $disable_guest_cart_from_cart_page, false ) . ' />' );
|
834 |
$html .= '<label for="ac_lite_track_guest_cart_from_cart_page"> ' . $args[0] . '</label>';
|
835 |
echo $html;
|
836 |
}
|
837 |
+
|
838 |
/**
|
839 |
* Call back function for guest user cart capture message
|
840 |
* @param array $args Argument for adding field details
|
841 |
* @since 7.8
|
842 |
*/
|
843 |
public static function wcal_guest_cart_capture_msg_callback( $args ) {
|
844 |
+
|
845 |
$guest_msg = get_option( 'wcal_guest_cart_capture_msg' );
|
846 |
+
|
847 |
+
$html = "<textarea rows='4' cols='80' id='wcal_guest_cart_capture_msg' name='wcal_guest_cart_capture_msg'>" . htmlspecialchars( $guest_msg, ENT_QUOTES ) . "</textarea>";
|
848 |
+
|
849 |
$html .= '<label for="wcal_guest_cart_capture_msg"> ' . $args[0] . '</label>';
|
850 |
echo $html;
|
851 |
}
|
852 |
+
|
853 |
/**
|
854 |
* Call back function for registered user cart capture message
|
855 |
* @param array $args Argument for adding field details
|
856 |
* @since 7.8
|
857 |
*/
|
858 |
public static function wcal_logged_cart_capture_msg_callback( $args ) {
|
859 |
+
|
860 |
$logged_msg = get_option( 'wcal_logged_cart_capture_msg' );
|
861 |
+
|
862 |
+
$html = "<input type='text' id='wcal_logged_cart_capture_msg' name='wcal_logged_cart_capture_msg' value='" . htmlspecialchars( $logged_msg, ENT_QUOTES ) . "' style='width:60%;'/>";
|
863 |
+
|
864 |
$html .= '<label for="wcal_logged_cart_capture_msg"> ' . $args[0] . '</label>';
|
865 |
echo $html;
|
866 |
}
|
867 |
|
868 |
+
|
869 |
+
/**
|
870 |
+
* Text to allow the user the choice to opt out of cart tracking
|
871 |
+
* @since 5.5
|
872 |
+
*/
|
873 |
+
public static function wcal_gdpr_allow_opt_out_callback( $args ) {
|
874 |
+
|
875 |
+
$wcal_gdpr_allow_opt_out = get_option( 'wcal_gdpr_allow_opt_out' );
|
876 |
+
|
877 |
+
$html = "<input type='text' class='regular-text' id='wcal_gdpr_allow_opt_out' name='wcal_gdpr_allow_opt_out' value='" . htmlspecialchars( $wcal_gdpr_allow_opt_out, ENT_QUOTES ) . "' />";
|
878 |
+
|
879 |
+
$html .= '<label for="wcal_gdpr_allow_opt_out"> ' . $args[0] . '</label>';
|
880 |
+
echo $html;
|
881 |
+
}
|
882 |
+
|
883 |
+
/**
|
884 |
+
* Message to display when the user chooses to opt out of cart tracking.
|
885 |
+
* @since 5.5
|
886 |
+
*/
|
887 |
+
public static function wcal_gdpr_opt_out_msg_callback( $args ) {
|
888 |
+
|
889 |
+
$wcal_gdpr_opt_out_message = get_option( 'wcal_gdpr_opt_out_message' );
|
890 |
+
|
891 |
+
$html = "<input type='text' id='wcal_gdpr_opt_out_message' name='wcal_gdpr_opt_out_message' value='" . htmlspecialchars( $wcal_gdpr_opt_out_message, ENT_QUOTES ) . "' style='width:60%;'/>";
|
892 |
+
|
893 |
+
$html .= '<label for="wcal_gdpr_opt_out_message"> ' . $args[0] . '</label>';
|
894 |
+
echo $html;
|
895 |
+
}
|
896 |
+
|
897 |
/**
|
898 |
* Settings API callback for Abandoned cart email settings of the plugin.
|
899 |
* @since 3.5
|
900 |
*/
|
901 |
function wcal_email_callback () {
|
902 |
+
|
903 |
}
|
904 |
+
|
905 |
/**
|
906 |
* Settings API callback for from name used in Abandoned cart email.
|
907 |
* @param array $args Arguments
|
920 |
$html = '<label for="wcal_from_name_label"> ' . $args[0] . '</label>';
|
921 |
echo $html;
|
922 |
}
|
923 |
+
|
924 |
/**
|
925 |
* Settings API callback for from email used in Abandoned cart email.
|
926 |
* @param array $args Arguments
|
939 |
$html = '<label for="wcal_from_email_label"> ' . $args[0] . '</label>';
|
940 |
echo $html;
|
941 |
}
|
942 |
+
|
943 |
/**
|
944 |
* Settings API callback for reply email used in Abandoned cart email.
|
945 |
* @param array $args Arguments
|
967 |
*/
|
968 |
function wcal_update_db_check() {
|
969 |
global $wpdb;
|
970 |
+
|
971 |
$wcal_previous_version = get_option( 'wcal_previous_version' );
|
972 |
|
973 |
if ( $wcal_previous_version != wcal_common::wcal_get_version() ) {
|
974 |
+
update_option( 'wcal_previous_version', '5.5' );
|
975 |
}
|
976 |
|
977 |
/**
|
978 |
* This is used to prevent guest users wrong Id. If guest users id is less then 63000000 then this code will
|
979 |
* ensure that we will change the id of guest tables so it wont affect on the next guest users.
|
980 |
+
*/
|
981 |
if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_guest_abandoned_cart_history_lite';" ) && 'yes' != get_option( 'wcal_guest_user_id_altered' ) ) {
|
982 |
$last_id = $wpdb->get_var( "SELECT max(id) FROM `{$wpdb->prefix}ac_guest_abandoned_cart_history_lite`;" );
|
983 |
if ( NULL != $last_id && $last_id <= 63000000 ) {
|
986 |
}
|
987 |
}
|
988 |
|
989 |
+
if( !get_option( 'wcal_new_default_templates' ) ) {
|
990 |
$default_template = new wcal_default_template_settings;
|
991 |
$default_template->wcal_create_default_templates();
|
992 |
add_option( 'wcal_new_default_templates', "yes" );
|
993 |
+
|
994 |
}
|
995 |
if ( 'yes' != get_option( 'ac_lite_alter_table_queries' ) ) {
|
996 |
$ac_history_table_name = $wpdb->prefix."ac_abandoned_cart_history_lite";
|
997 |
$check_table_query = "SHOW COLUMNS FROM $ac_history_table_name LIKE 'user_type'";
|
998 |
$results = $wpdb->get_results( $check_table_query );
|
999 |
+
|
1000 |
if ( 0 == count( $results ) ) {
|
1001 |
$alter_table_query = "ALTER TABLE $ac_history_table_name ADD `user_type` text AFTER `recovered_cart`";
|
1002 |
$wpdb->get_results( $alter_table_query );
|
1003 |
}
|
1004 |
+
|
1005 |
$table_name = $wpdb->prefix . "ac_email_templates_lite";
|
1006 |
$check_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'is_wc_template' ";
|
1007 |
$results = $wpdb->get_results( $check_template_table_query );
|
1008 |
+
|
1009 |
if ( 0 == count( $results ) ) {
|
1010 |
$alter_template_table_query = "ALTER TABLE $table_name
|
1011 |
ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8_unicode_ci NOT NULL AFTER `template_name`,
|
1012 |
ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
|
1013 |
$wpdb->get_results( $alter_template_table_query );
|
1014 |
}
|
1015 |
+
|
1016 |
$table_name = $wpdb->prefix . "ac_email_templates_lite";
|
1017 |
$check_email_template_table_query = "SHOW COLUMNS FROM $table_name LIKE 'wc_email_header' ";
|
1018 |
$results_email = $wpdb->get_results( $check_email_template_table_query );
|
1019 |
+
|
1020 |
if ( 0 == count( $results_email ) ) {
|
1021 |
$alter_email_template_table_query = "ALTER TABLE $table_name
|
1022 |
ADD COLUMN `wc_email_header` varchar(50) NOT NULL AFTER `default_template`";
|
1028 |
$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`;" );
|
1029 |
}
|
1030 |
}
|
1031 |
+
|
1032 |
if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_abandoned_cart_history_lite';" ) ) {
|
1033 |
if ( ! $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}ac_abandoned_cart_history_lite` LIKE 'session_id';" ) ) {
|
1034 |
$wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_abandoned_cart_history_lite ADD `session_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `unsubscribe_link`;" );
|
1035 |
}
|
1036 |
+
}
|
1037 |
+
|
1038 |
/**
|
1039 |
* We have moved email templates fields in the setings section. SO to remove that fields column fro the db we need it.
|
1040 |
+
* For existing user we need to fill this setting with the first template.
|
1041 |
* @since 4.7
|
1042 |
*/
|
1043 |
if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_email_templates_lite';" ) ) {
|
1046 |
$get_email_template_result = $wpdb->get_results ( $get_email_template_query );
|
1047 |
$wcal_from_email = '';
|
1048 |
if ( isset( $get_email_template_result ) && count ( $get_email_template_result ) > 0 ){
|
1049 |
+
$wcal_from_email = $get_email_template_result[0]->from_email;
|
1050 |
/* Store data in setings api*/
|
1051 |
+
update_option ( 'wcal_from_email', $wcal_from_email );
|
1052 |
/* Delete table from the Db*/
|
1053 |
$wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_email_templates_lite DROP COLUMN `from_email`;" );
|
1054 |
}
|
1055 |
}
|
1056 |
+
|
1057 |
if ( $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}ac_email_templates_lite` LIKE 'from_name';" ) ) {
|
1058 |
$get_email_template_from_name_query = "SELECT `from_name` FROM {$wpdb->prefix}ac_email_templates_lite WHERE `is_active` = '1' ORDER BY `id` ASC LIMIT 1";
|
1059 |
$get_email_template_from_name_result = $wpdb->get_results ( $get_email_template_from_name_query );
|
1060 |
$wcal_from_name = '';
|
1061 |
if ( isset( $get_email_template_from_name_result ) && count ( $get_email_template_from_name_result ) > 0 ){
|
1062 |
+
$wcal_from_name = $get_email_template_from_name_result[0]->from_name;
|
1063 |
/* Store data in setings api*/
|
1064 |
+
add_option ( 'wcal_from_name', $wcal_from_name );
|
1065 |
/* Delete table from the Db*/
|
1066 |
$wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_email_templates_lite DROP COLUMN `from_name`;" );
|
1067 |
}
|
1068 |
}
|
1069 |
+
|
1070 |
if ( $wpdb->get_var( "SHOW COLUMNS FROM `{$wpdb->prefix}ac_email_templates_lite` LIKE 'reply_email';" ) ) {
|
1071 |
$get_email_template_reply_email_query = "SELECT `reply_email` FROM {$wpdb->prefix}ac_email_templates_lite WHERE `is_active` = '1' ORDER BY `id` ASC LIMIT 1";
|
1072 |
$get_email_template_reply_email_result = $wpdb->get_results ( $get_email_template_reply_email_query);
|
1073 |
$wcal_reply_email = '';
|
1074 |
if ( isset( $get_email_template_reply_email_result ) && count ( $get_email_template_reply_email_result ) > 0 ){
|
1075 |
+
$wcal_reply_email = $get_email_template_reply_email_result[0]->reply_email;
|
1076 |
/* Store data in setings api*/
|
1077 |
+
update_option ( 'wcal_reply_email', $wcal_reply_email );
|
1078 |
/* Delete table from the Db*/
|
1079 |
$wpdb->query( "ALTER TABLE {$wpdb->prefix}ac_email_templates_lite DROP COLUMN `reply_email`;" );
|
1080 |
}
|
1081 |
}
|
1082 |
}
|
1083 |
+
|
1084 |
if ( ! get_option( 'wcal_security_key' ) ) {
|
1085 |
update_option( 'wcal_security_key', 'qJB0rGtIn5UB1xG03efyCp' );
|
1086 |
}
|
1087 |
|
1088 |
update_option( 'ac_lite_alter_table_queries', 'yes' );
|
1089 |
}
|
1090 |
+
|
1091 |
//get the option, if it is not set to individual then convert to individual records and delete the base record
|
1092 |
+
$ac_settings = get_option( 'ac_lite_settings_status' );
|
1093 |
if ( 'INDIVIDUAL' != $ac_settings ) {
|
1094 |
//fetch the existing settings and save them as inidividual to be used for the settings API
|
1095 |
+
$woocommerce_ac_settings = json_decode( get_option( 'woocommerce_ac_settings' ) );
|
1096 |
|
1097 |
if ( isset( $woocommerce_ac_settings[0]->cart_time ) ) {
|
1098 |
add_option( 'ac_lite_cart_abandoned_time', $woocommerce_ac_settings[0]->cart_time );
|
1105 |
} else {
|
1106 |
add_option( 'ac_lite_delete_abandoned_order_days', "" );
|
1107 |
}
|
1108 |
+
|
1109 |
if ( isset( $woocommerce_ac_settings[0]->email_admin ) ) {
|
1110 |
add_option( 'ac_lite_email_admin_on_recovery', $woocommerce_ac_settings[0]->email_admin );
|
1111 |
} else {
|
1132 |
}
|
1133 |
|
1134 |
if ( 'yes' !== get_option( 'ac_lite_user_cleanup' ) ) {
|
1135 |
+
$query_cleanup = "UPDATE `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` SET
|
1136 |
billing_first_name = IF (billing_first_name LIKE '%<%', '', billing_first_name),
|
1137 |
billing_last_name = IF (billing_last_name LIKE '%<%', '', billing_last_name),
|
1138 |
billing_company_name = IF (billing_company_name LIKE '%<%', '', billing_company_name),
|
1170 |
|
1171 |
update_option( 'ac_lite_remove_abandoned_data', 'yes' );
|
1172 |
}
|
1173 |
+
|
1174 |
+
if( ! get_option( 'wcal_enable_cart_emails' ) ) {
|
1175 |
+
add_option( 'wcal_enable_cart_emails', 'on' );
|
1176 |
+
}
|
1177 |
}
|
1178 |
+
|
1179 |
/**
|
1180 |
* Add a submenu page under the WooCommerce.
|
1181 |
* @hook admin_menu
|
1182 |
* @since 1.0
|
1183 |
+
*/
|
1184 |
function wcal_admin_menu() {
|
1185 |
$page = add_submenu_page ( 'woocommerce', __( 'Abandoned Carts', 'woocommerce-abandoned-cart' ), __( 'Abandoned Carts', 'woocommerce-abandoned-cart' ), 'manage_woocommerce', 'woocommerce_ac_page', array( &$this, 'wcal_menu_page' ) );
|
1186 |
}
|
1187 |
+
|
1188 |
/**
|
1189 |
* Capture the cart and insert the information of the cart into DataBase.
|
1190 |
* @hook woocommerce_cart_updated
|
1191 |
* @globals mixed $wpdb
|
1192 |
* @globals mixed $woocommerce
|
1193 |
* @since 1.0
|
1194 |
+
*/
|
1195 |
+
function wcal_store_cart_timestamp() {
|
1196 |
|
1197 |
if ( get_transient( 'wcal_email_sent_id' ) !== false ) {
|
1198 |
wcal_common::wcal_set_cart_session( 'email_sent_id', get_transient( 'wcal_email_sent_id' ) );
|
1205 |
|
1206 |
global $wpdb,$woocommerce;
|
1207 |
$current_time = current_time( 'timestamp' );
|
1208 |
+
$cut_off_time = get_option( 'ac_lite_cart_abandoned_time' );
|
1209 |
$track_guest_cart_from_cart_page = get_option( 'ac_lite_track_guest_cart_from_cart_page' );
|
1210 |
$cart_ignored = 0;
|
1211 |
+
$recovered_cart = 0;
|
1212 |
|
1213 |
+
$track_guest_user_cart_from_cart = "";
|
1214 |
if ( isset( $track_guest_cart_from_cart_page ) ) {
|
1215 |
$track_guest_user_cart_from_cart = $track_guest_cart_from_cart_page;
|
1216 |
}
|
1217 |
+
|
1218 |
if ( isset( $cut_off_time ) ) {
|
1219 |
$cart_cut_off_time = intval( $cut_off_time ) * 60;
|
1220 |
} else {
|
1221 |
$cart_cut_off_time = 60 * 60;
|
1222 |
+
}
|
1223 |
$compare_time = $current_time - $cart_cut_off_time;
|
1224 |
+
|
1225 |
+
if ( is_user_logged_in() ) {
|
1226 |
+
|
1227 |
$user_id = get_current_user_id();
|
1228 |
+
$gdpr_consent = get_user_meta( $user_id, 'wcal_gdpr_tracking_choice', true );
|
1229 |
+
|
1230 |
+
if( $gdpr_consent === '' ) {
|
1231 |
+
$gdpr_consent = true;
|
1232 |
+
}
|
1233 |
|
1234 |
+
if( $gdpr_consent ) {
|
|
|
1235 |
|
1236 |
+
$query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite`
|
1237 |
+
WHERE user_id = %d
|
1238 |
+
AND cart_ignored = %s
|
1239 |
+
AND recovered_cart = %d ";
|
1240 |
+
$results = $wpdb->get_results( $wpdb->prepare( $query, $user_id, $cart_ignored, $recovered_cart ) );
|
1241 |
|
1242 |
+
if ( 0 == count( $results ) ) {
|
1243 |
+
$wcal_woocommerce_persistent_cart =version_compare( $woocommerce->version, '3.1.0', ">=" ) ? '_woocommerce_persistent_cart_' . get_current_blog_id() : '_woocommerce_persistent_cart' ;
|
|
|
|
|
|
|
|
|
|
|
1244 |
|
1245 |
+
$cart_info_meta = json_encode( get_user_meta( $user_id, $wcal_woocommerce_persistent_cart, true ) );
|
1246 |
+
|
1247 |
+
if( '' !== $cart_info_meta && '{"cart":[]}' != $cart_info_meta && '""' !== $cart_info_meta ) {
|
1248 |
+
$cart_info = $cart_info_meta;
|
1249 |
+
$user_type = "REGISTERED";
|
1250 |
+
$insert_query = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
|
1251 |
+
( user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type )
|
1252 |
+
VALUES ( %d, %s, %d, %s, %s )";
|
1253 |
+
$wpdb->query( $wpdb->prepare( $insert_query, $user_id, $cart_info,$current_time, $cart_ignored, $user_type ) );
|
1254 |
+
|
1255 |
+
$abandoned_cart_id = $wpdb->insert_id;
|
1256 |
+
wcal_common::wcal_set_cart_session( 'abandoned_cart_id_lite', $abandoned_cart_id );
|
1257 |
+
}
|
1258 |
+
} elseif ( isset( $results[0]->abandoned_cart_time ) && $compare_time > $results[0]->abandoned_cart_time ) {
|
1259 |
+
$wcal_woocommerce_persistent_cart = version_compare( $woocommerce->version, '3.1.0', ">=" ) ? '_woocommerce_persistent_cart_' . get_current_blog_id() : '_woocommerce_persistent_cart' ;
|
1260 |
+
$updated_cart_info = json_encode( get_user_meta( $user_id, $wcal_woocommerce_persistent_cart, true ) );
|
1261 |
+
|
1262 |
+
if ( ! $this->wcal_compare_carts( $user_id, $results[0]->abandoned_cart_info ) ) {
|
1263 |
+
$updated_cart_ignored = 1;
|
1264 |
+
$query_ignored = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
|
1265 |
+
SET cart_ignored = %s
|
1266 |
+
WHERE user_id = %d ";
|
1267 |
+
$wpdb->query( $wpdb->prepare( $query_ignored, $updated_cart_ignored, $user_id ) );
|
1268 |
+
|
1269 |
+
$user_type = "REGISTERED";
|
1270 |
+
$query_update = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
|
1271 |
+
(user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type)
|
1272 |
+
VALUES (%d, %s, %d, %s, %s)";
|
1273 |
+
$wpdb->query( $wpdb->prepare( $query_update, $user_id, $updated_cart_info, $current_time, $cart_ignored, $user_type ) );
|
1274 |
+
|
1275 |
+
update_user_meta ( $user_id, '_woocommerce_ac_modified_cart', md5( "yes" ) );
|
1276 |
+
|
1277 |
+
$abandoned_cart_id = $wpdb->insert_id;
|
1278 |
+
wcal_common::wcal_set_cart_session( 'abandoned_cart_id_lite', $abandoned_cart_id );
|
1279 |
+
} else {
|
1280 |
+
update_user_meta ( $user_id, '_woocommerce_ac_modified_cart', md5( "no" ) );
|
1281 |
+
}
|
1282 |
+
} else {
|
1283 |
+
$wcal_woocommerce_persistent_cart = version_compare( $woocommerce->version, '3.1.0', ">=" ) ? '_woocommerce_persistent_cart_' . get_current_blog_id() : '_woocommerce_persistent_cart' ;
|
1284 |
+
$updated_cart_info = json_encode( get_user_meta( $user_id, $wcal_woocommerce_persistent_cart, true ) );
|
1285 |
+
|
1286 |
+
$query_update = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
|
1287 |
+
SET abandoned_cart_info = %s,
|
1288 |
+
abandoned_cart_time = %d
|
1289 |
+
WHERE user_id = %d
|
1290 |
+
AND cart_ignored = %s ";
|
1291 |
+
$wpdb->query( $wpdb->prepare( $query_update, $updated_cart_info, $current_time, $user_id, $cart_ignored ) );
|
1292 |
+
|
1293 |
+
$query_update = "SELECT * FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE user_id ='" . $user_id . "' AND cart_ignored='0' ";
|
1294 |
+
$get_abandoned_record = $wpdb->get_results( $query_update );
|
1295 |
+
|
1296 |
+
if ( count( $get_abandoned_record ) > 0 ) {
|
1297 |
+
$abandoned_cart_id = $get_abandoned_record[0]->id;
|
1298 |
+
wcal_common::wcal_set_cart_session( 'abandoned_cart_id_lite', $abandoned_cart_id );
|
1299 |
+
}
|
1300 |
}
|
1301 |
}
|
1302 |
+
|
1303 |
+
} else {
|
1304 |
//start here guest user
|
1305 |
$user_id = wcal_common::wcal_get_cart_session( 'user_id' );
|
1306 |
|
1307 |
+
// gdpr_consent
|
1308 |
+
$gdpr_consent = true;
|
1309 |
+
$show_gdpr_msg = wcal_common::wcal_get_cart_session( 'wcal_cart_tracking_refused' );
|
1310 |
+
if( isset( $show_gdpr_msg ) && 'yes' === $show_gdpr_msg ) {
|
1311 |
+
$gdpr_consent = false;
|
|
|
|
|
|
|
|
|
1312 |
}
|
1313 |
+
|
1314 |
+
if( $gdpr_consent ) {
|
1315 |
+
$query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id = %d AND cart_ignored = '0' AND recovered_cart = '0' AND user_id != '0'";
|
1316 |
+
$results = $wpdb->get_results( $wpdb->prepare( $query, $user_id ) );
|
1317 |
+
$cart = array();
|
1318 |
+
|
1319 |
+
$get_cookie = WC()->session->get_session_cookie();
|
1320 |
+
if ( function_exists('WC') ) {
|
1321 |
+
$cart['cart'] = WC()->session->cart;
|
1322 |
+
} else {
|
1323 |
+
$cart['cart'] = $woocommerce->session->cart;
|
1324 |
+
}
|
1325 |
|
1326 |
+
$updated_cart_info = json_encode( $cart );
|
1327 |
+
//$updated_cart_info = addslashes ( $updated_cart_info );
|
1328 |
|
1329 |
+
if ( count( $results ) > 0 && '{"cart":[]}' != $updated_cart_info ) {
|
1330 |
+
if ( $compare_time > $results[0]->abandoned_cart_time ) {
|
1331 |
+
if ( ! $this->wcal_compare_only_guest_carts( $updated_cart_info, $results[0]->abandoned_cart_info ) ) {
|
1332 |
|
1333 |
+
$query_ignored = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
|
1334 |
+
SET cart_ignored = '1'
|
1335 |
+
WHERE user_id ='".$user_id."'";
|
1336 |
+
$wpdb->query( $query_ignored );
|
1337 |
|
1338 |
+
$user_type = 'GUEST';
|
1339 |
+
$query_update = "INSERT INTO `".$wpdb->prefix."ac_abandoned_cart_history_lite`
|
1340 |
+
(user_id, abandoned_cart_info, abandoned_cart_time, cart_ignored, user_type)
|
1341 |
+
VALUES (%d, %s, %d, %s, %s)";
|
1342 |
+
$wpdb->query( $wpdb->prepare( $query_update, $user_id, $updated_cart_info, $current_time, $cart_ignored, $user_type ) );
|
1343 |
+
update_user_meta( $user_id, '_woocommerce_ac_modified_cart', md5("yes") );
|
1344 |
+
} else {
|
1345 |
+
update_user_meta( $user_id, '_woocommerce_ac_modified_cart', md5("no") );
|
1346 |
+
}
|
1347 |
} else {
|
1348 |
+
$query_update = "UPDATE `".$wpdb->prefix."ac_abandoned_cart_history_lite`
|
1349 |
+
SET abandoned_cart_info = '".$updated_cart_info."', abandoned_cart_time = '".$current_time."'
|
1350 |
+
WHERE user_id='".$user_id."' AND cart_ignored='0' ";
|
1351 |
+
$wpdb->query( $query_update );
|
1352 |
+
}
|
1353 |
} else {
|
1354 |
+
/**
|
1355 |
+
* Here we capture the guest cart from the cart page.
|
1356 |
+
* @since 3.5
|
1357 |
+
*/
|
1358 |
+
if ( 'on' == $track_guest_user_cart_from_cart && '' != $get_cookie[0] ) {
|
1359 |
+
$query = "SELECT * FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE session_id LIKE %s AND cart_ignored = '0' AND recovered_cart = '0' ";
|
1360 |
+
$results = $wpdb->get_results( $wpdb->prepare( $query, $get_cookie[0] ) );
|
1361 |
+
if ( 0 == count( $results ) ) {
|
1362 |
+
$cart_info = $updated_cart_info;
|
1363 |
+
$blank_cart_info = '[]';
|
1364 |
+
if ( $blank_cart_info != $cart_info && '{"cart":[]}' != $cart_info ) {
|
1365 |
+
$insert_query = "INSERT INTO `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
|
1366 |
+
( abandoned_cart_info , abandoned_cart_time , cart_ignored , recovered_cart, user_type, session_id )
|
1367 |
+
VALUES ( '" . $cart_info."' , '" . $current_time . "' , '0' , '0' , 'GUEST', '". $get_cookie[0] ."' )";
|
1368 |
+
$wpdb->query( $insert_query );
|
1369 |
+
$abandoned_cart_id = $wpdb->insert_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1370 |
}
|
1371 |
+
} elseif ( $compare_time > $results[0]->abandoned_cart_time ) {
|
1372 |
+
$blank_cart_info = '[]';
|
1373 |
+
if ( $blank_cart_info != $updated_cart_info && '{"cart":[]}' != $updated_cart_info ) {
|
1374 |
+
if ( ! $this->wcal_compare_only_guest_carts( $updated_cart_info, $results[0]->abandoned_cart_info ) ) {
|
1375 |
+
$query_ignored = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` SET cart_ignored = '1' WHERE session_id ='" . $get_cookie[0] . "'";
|
1376 |
+
$wpdb->query( $query_ignored );
|
1377 |
+
$query_update = "INSERT INTO `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
|
1378 |
+
( abandoned_cart_info, abandoned_cart_time, cart_ignored, recovered_cart, user_type, session_id )
|
1379 |
+
VALUES ( '" . $updated_cart_info . "', '" . $current_time . "', '0', '0', 'GUEST', '". $get_cookie[0] ."' )";
|
1380 |
+
$wpdb->query( $query_update );
|
1381 |
+
$abandoned_cart_id = $wpdb->insert_id;
|
1382 |
+
}
|
1383 |
+
}
|
1384 |
+
} else {
|
1385 |
+
$blank_cart_info = '[]';
|
1386 |
+
if ( $blank_cart_info != $updated_cart_info && '{"cart":[]}' != $updated_cart_info ) {
|
1387 |
+
if ( ! $this->wcal_compare_only_guest_carts( $updated_cart_info, $results[0]->abandoned_cart_info ) ) {
|
1388 |
+
$query_update = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` SET abandoned_cart_info = '" . $updated_cart_info . "', abandoned_cart_time = '" . $current_time . "' WHERE session_id ='" . $get_cookie[0] . "' AND cart_ignored='0' ";
|
1389 |
+
$wpdb->query( $query_update );
|
1390 |
+
}
|
1391 |
}
|
1392 |
}
|
1393 |
+
if( isset( $abandoned_cart_id ) ) {
|
1394 |
+
// add the abandoned id in the session
|
1395 |
+
wcal_common::wcal_set_cart_session( 'abandoned_cart_id_lite', $abandoned_cart_id );
|
1396 |
+
}
|
1397 |
}
|
1398 |
}
|
1399 |
+
}
|
1400 |
}
|
1401 |
}
|
1402 |
+
|
1403 |
/**
|
1404 |
* It will unsubscribe the abandoned cart, so user will not recieve further abandoned cart emails.
|
1405 |
* @hook template_include
|
1410 |
*/
|
1411 |
function wcal_email_unsubscribe( $args ) {
|
1412 |
global $wpdb;
|
1413 |
+
|
1414 |
if ( isset( $_GET['wcal_track_unsubscribe'] ) && $_GET['wcal_track_unsubscribe'] == 'wcal_unsubscribe' ) {
|
1415 |
$encoded_email_id = rawurldecode( $_GET['validate'] );
|
1416 |
$validate_email_id_string = str_replace( " " , "+", $encoded_email_id );
|
1417 |
$validate_email_address_string = '';
|
1418 |
$validate_email_id_decode = 0;
|
1419 |
$cryptKey = get_option( 'wcal_security_key' );
|
1420 |
+
$validate_email_id_decode = Wcal_Aes_Ctr::decrypt( $validate_email_id_string, $cryptKey, 256 );
|
1421 |
if ( isset( $_GET['track_email_id'] ) ) {
|
1422 |
$encoded_email_address = rawurldecode( $_GET['track_email_id'] );
|
1423 |
$validate_email_address_string = str_replace( " " , "+", $encoded_email_address );
|
1424 |
}
|
1425 |
$query_id = "SELECT * FROM `" . $wpdb->prefix . "ac_sent_history_lite` WHERE id = %d ";
|
1426 |
$results_sent = $wpdb->get_results ( $wpdb->prepare( $query_id, $validate_email_id_decode ) );
|
1427 |
+
$email_address = '';
|
1428 |
if ( isset( $results_sent[0] ) ) {
|
1429 |
$email_address = $results_sent[0]->sent_email_id;
|
1430 |
+
}
|
1431 |
+
if ( $validate_email_address_string == hash( 'sha256', $email_address ) && '' != $email_address ) {
|
1432 |
$email_sent_id = $validate_email_id_decode;
|
1433 |
$get_ac_id_query = "SELECT abandoned_order_id FROM `" . $wpdb->prefix . "ac_sent_history_lite` WHERE id = %d";
|
1434 |
$get_ac_id_results = $wpdb->get_results( $wpdb->prepare( $get_ac_id_query , $email_sent_id ) );
|
1435 |
+
$user_id = 0;
|
1436 |
if ( isset( $get_ac_id_results[0] ) ) {
|
1437 |
$get_user_id_query = "SELECT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE id = %d";
|
1438 |
$get_user_results = $wpdb->get_results( $wpdb->prepare( $get_user_id_query , $get_ac_id_results[0]->abandoned_order_id ) );
|
1440 |
if ( isset( $get_user_results[0] ) ) {
|
1441 |
$user_id = $get_user_results[0]->user_id;
|
1442 |
}
|
1443 |
+
|
1444 |
$unsubscribe_query = "UPDATE `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
|
1445 |
+
SET unsubscribe_link = '1'
|
1446 |
WHERE user_id= %d AND cart_ignored='0' ";
|
1447 |
+
$wpdb->query( $wpdb->prepare( $unsubscribe_query , $user_id ) );
|
1448 |
echo "Unsubscribed Successfully";
|
1449 |
sleep( 2 );
|
1450 |
$url = get_option( 'siteurl' );
|
1452 |
<script>
|
1453 |
location.href = "<?php echo $url; ?>";
|
1454 |
</script>
|
1455 |
+
<?php
|
1456 |
}
|
1457 |
} else {
|
1458 |
+
return $args;
|
1459 |
}
|
1460 |
}
|
1461 |
+
|
1462 |
/**
|
1463 |
* It will track the URL of cart link from email, and it will populate the logged-in and guest users cart.
|
1464 |
* @hook template_include
|
1465 |
+
* @param string $template
|
1466 |
* @return string $template
|
1467 |
* @globals mixed $wpdb
|
1468 |
* @globals mixed $woocommerce
|
1469 |
* @since 1.0
|
1470 |
+
*/
|
1471 |
+
function wcal_email_track_links( $template ) {
|
1472 |
global $woocommerce;
|
1473 |
$track_link = '';
|
1474 |
+
|
1475 |
+
if ( isset( $_GET['wcal_action'] ) ) {
|
1476 |
$track_link = $_GET['wcal_action'];
|
1477 |
+
}
|
1478 |
if ( $track_link == 'track_links' ) {
|
1479 |
if ( '' === session_id() ) {
|
1480 |
//session has not started
|
1481 |
session_start();
|
1482 |
+
}
|
1483 |
global $wpdb;
|
1484 |
$validate_server_string = rawurldecode( $_GET ['validate'] );
|
1485 |
$validate_server_string = str_replace( " " , "+", $validate_server_string );
|
1486 |
+
$validate_encoded_string = $validate_server_string;
|
1487 |
$cryptKey = get_option( 'wcal_security_key' );
|
1488 |
+
$link_decode = Wcal_Aes_Ctr::decrypt( $validate_encoded_string, $cryptKey, 256 );
|
1489 |
+
$sent_email_id_pos = strpos( $link_decode, '&' );
|
1490 |
$email_sent_id = substr( $link_decode , 0, $sent_email_id_pos );
|
1491 |
|
1492 |
wcal_common::wcal_set_cart_session( 'email_sent_id', $email_sent_id );
|
1494 |
|
1495 |
$url_pos = strpos( $link_decode, '=' );
|
1496 |
$url_pos = $url_pos + 1;
|
1497 |
+
$url = substr( $link_decode, $url_pos );
|
1498 |
$get_ac_id_query = "SELECT abandoned_order_id FROM `".$wpdb->prefix."ac_sent_history_lite` WHERE id = %d";
|
1499 |
$get_ac_id_results = $wpdb->get_results( $wpdb->prepare( $get_ac_id_query, $email_sent_id ) );
|
1500 |
|
1506 |
$get_user_id_query = "SELECT user_id FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE id = %d";
|
1507 |
$get_user_results = $wpdb->get_results( $wpdb->prepare( $get_user_id_query, $get_ac_id_results[0]->abandoned_order_id ) );
|
1508 |
}
|
1509 |
+
$user_id = 0;
|
1510 |
+
if ( isset( $get_user_results ) && count( $get_user_results ) > 0 ) {
|
1511 |
$user_id = $get_user_results[0]->user_id;
|
1512 |
+
}
|
1513 |
if ( 0 == $user_id ) {
|
1514 |
echo "Link expired";
|
1515 |
exit;
|
1516 |
+
}
|
1517 |
+
$user = wp_set_current_user( $user_id );
|
1518 |
if ( $user_id >= "63000000" ) {
|
1519 |
$query_guest = "SELECT * from `". $wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = %d";
|
1520 |
$results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $user_id ) );
|
1521 |
$query_cart = "SELECT recovered_cart FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE user_id = %d";
|
1522 |
+
$results = $wpdb->get_results( $wpdb->prepare( $query_cart, $user_id ) );
|
1523 |
if ( $results_guest && $results[0]->recovered_cart == '0' ) {
|
1524 |
wcal_common::wcal_set_cart_session( 'guest_first_name', $results_guest[0]->billing_first_name );
|
1525 |
wcal_common::wcal_set_cart_session( 'guest_last_name', $results_guest[0]->billing_last_name );
|
1535 |
}
|
1536 |
}
|
1537 |
}
|
1538 |
+
|
1539 |
if ( $user_id < "63000000" ) {
|
1540 |
$user_login = $user->data->user_login;
|
1541 |
wp_set_auth_cookie( $user_id );
|
1542 |
$my_temp = wc_load_persistent_cart( $user_login, $user );
|
1543 |
+
do_action( 'wp_login', $user_login, $user );
|
1544 |
if ( isset( $sign_in ) && is_wp_error( $sign_in ) ) {
|
1545 |
echo $sign_in->get_error_message();
|
1546 |
exit;
|
1547 |
}
|
1548 |
+
} else
|
1549 |
$my_temp = $this->wcal_load_guest_persistent_cart( $user_id );
|
1550 |
+
|
1551 |
+
if ( $email_sent_id > 0 && is_numeric( $email_sent_id ) ) {
|
1552 |
+
wp_safe_redirect( $url );
|
1553 |
+
exit;
|
1554 |
}
|
1555 |
} else
|
1556 |
return $template;
|
1557 |
}
|
1558 |
+
|
1559 |
/**
|
1560 |
+
* When customer clicks on the abandoned cart link and that cart is for the the guest users the it will load the guest
|
1561 |
* user's cart detail.
|
1562 |
* @globals mixed $woocommerce
|
1563 |
* @since 1.0
|
1564 |
+
*/
|
1565 |
+
function wcal_load_guest_persistent_cart() {
|
1566 |
if ( wcal_common::wcal_get_cart_session( 'user_id' ) != '' ) {
|
1567 |
global $woocommerce;
|
1568 |
$saved_cart = json_decode( get_user_meta( wcal_common::wcal_get_cart_session( 'user_id' ), '_woocommerce_persistent_cart',true ), true );
|
1570 |
$cart_contents_total = $cart_contents_weight = $cart_contents_count = $cart_contents_tax = $total = $subtotal = $subtotal_ex_tax = $tax_total = 0;
|
1571 |
if ( count( $saved_cart ) > 0 ) {
|
1572 |
foreach ( $saved_cart as $key => $value ) {
|
1573 |
+
foreach ( $value as $a => $b ) {
|
1574 |
$c['product_id'] = $b['product_id'];
|
1575 |
$c['variation_id'] = $b['variation_id'];
|
1576 |
$c['variation'] = $b['variation'];
|
1592 |
$woocommerce_cart_hash = $a;
|
1593 |
}
|
1594 |
}
|
1595 |
+
|
1596 |
if ( $saved_cart ) {
|
1597 |
+
if ( empty( $woocommerce->session->cart ) || ! is_array( $woocommerce->session->cart ) || sizeof( $woocommerce->session->cart ) == 0 ) {
|
1598 |
$woocommerce->session->cart = $saved_cart['cart'];
|
1599 |
$woocommerce->session->cart_contents_total = $cart_contents_total;
|
1600 |
$woocommerce->session->cart_contents_weight = $cart_contents_weight;
|
1620 |
}
|
1621 |
}
|
1622 |
}
|
1623 |
+
|
1624 |
/**
|
1625 |
* It will compare only guest users cart while capturing the cart.
|
1626 |
* @param json_encode $new_cart New abandoned cart details
|
1630 |
*/
|
1631 |
function wcal_compare_only_guest_carts( $new_cart, $last_abandoned_cart ) {
|
1632 |
$current_woo_cart = array();
|
1633 |
+
$current_woo_cart = json_decode( stripslashes( $new_cart ), true );
|
1634 |
$abandoned_cart_arr = array();
|
1635 |
$abandoned_cart_arr = json_decode( $last_abandoned_cart, true );
|
1636 |
$temp_variable = "";
|
1637 |
+
if ( isset( $current_woo_cart['cart'] ) && isset( $abandoned_cart_arr['cart'] ) ) {
|
1638 |
if ( count( $current_woo_cart['cart'] ) >= count( $abandoned_cart_arr['cart'] ) ) {
|
1639 |
//do nothing
|
1640 |
} else {
|
1648 |
$current_cart_product_id = $item_value['product_id'];
|
1649 |
$current_cart_variation_id = $item_value['variation_id'];
|
1650 |
$current_cart_quantity = $item_value['quantity'];
|
1651 |
+
|
1652 |
if ( isset( $abandoned_cart_arr[$key][$item_key]['product_id'] ) ){
|
1653 |
$abandoned_cart_product_id = $abandoned_cart_arr[$key][$item_key]['product_id'];
|
1654 |
} else {
|
1672 |
}
|
1673 |
}
|
1674 |
}
|
1675 |
+
}
|
1676 |
return true;
|
1677 |
}
|
1678 |
|
1683 |
* @return boolean true | false
|
1684 |
* @since 1.0
|
1685 |
*/
|
1686 |
+
function wcal_compare_carts( $user_id, $last_abandoned_cart ) {
|
1687 |
global $woocommerce;
|
1688 |
$current_woo_cart = array();
|
1689 |
$abandoned_cart_arr = array();
|
1690 |
+
$wcal_woocommerce_persistent_cart =version_compare( $woocommerce->version, '3.1.0', ">=" ) ? '_woocommerce_persistent_cart_' . get_current_blog_id() : '_woocommerce_persistent_cart' ;
|
1691 |
$current_woo_cart = get_user_meta( $user_id, $wcal_woocommerce_persistent_cart, true );
|
1692 |
$abandoned_cart_arr = json_decode( $last_abandoned_cart, true );
|
1693 |
$temp_variable = "";
|
1694 |
+
if ( isset( $current_woo_cart['cart'] ) && isset( $abandoned_cart_arr['cart'] ) ) {
|
1695 |
if ( count( $current_woo_cart['cart'] ) >= count( $abandoned_cart_arr['cart'] ) ) {
|
1696 |
//do nothing
|
1697 |
} else {
|
1701 |
}
|
1702 |
if ( is_array( $current_woo_cart ) && is_array( $abandoned_cart_arr ) ) {
|
1703 |
foreach ( $current_woo_cart as $key => $value ) {
|
1704 |
+
|
1705 |
foreach ( $value as $item_key => $item_value ) {
|
1706 |
$current_cart_product_id = $item_value['product_id'];
|
1707 |
$current_cart_variation_id = $item_value['variation_id'];
|
1708 |
$current_cart_quantity = $item_value['quantity'];
|
1709 |
+
|
1710 |
if ( isset( $abandoned_cart_arr[$key][$item_key]['product_id'] ) ) {
|
1711 |
$abandoned_cart_product_id = $abandoned_cart_arr[$key][$item_key]['product_id'];
|
1712 |
} else {
|
1713 |
$abandoned_cart_product_id = "";
|
1714 |
}
|
1715 |
if ( isset( $abandoned_cart_arr[$key][$item_key]['variation_id'] ) ) {
|
1716 |
+
$abandoned_cart_variation_id = $abandoned_cart_arr[$key][$item_key]['variation_id'];
|
1717 |
} else {
|
1718 |
$abandoned_cart_variation_id = "";
|
1719 |
}
|
1731 |
}
|
1732 |
}
|
1733 |
}
|
1734 |
+
}
|
1735 |
return true;
|
1736 |
}
|
1737 |
|
1749 |
}
|
1750 |
if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
|
1751 |
return;
|
1752 |
+
}
|
1753 |
if ( 'true' == get_user_option( 'rich_editing' ) ) {
|
1754 |
remove_filter( 'the_excerpt', 'wpautop' );
|
1755 |
add_filter( 'tiny_mce_before_init', array( &$this, 'wcal_format_tiny_MCE' ) );
|
1757 |
add_filter( 'mce_external_plugins', array( &$this, 'wcal_filter_mce_plugin' ) );
|
1758 |
}
|
1759 |
}
|
1760 |
+
|
1761 |
/**
|
1762 |
* It will create a button on the WordPress editor.
|
1763 |
* @hook mce_buttons
|
1764 |
+
* @param array $buttons
|
1765 |
* @return array $buttons
|
1766 |
* @since 2.6
|
1767 |
*/
|
1770 |
array_push( $buttons, 'abandoncart', '|' );
|
1771 |
return $buttons;
|
1772 |
}
|
1773 |
+
|
1774 |
/**
|
1775 |
* It will add the list for the added extra button.
|
1776 |
* @hook mce_external_plugins
|
1777 |
+
* @param array $plugins
|
1778 |
* @return array $plugins
|
1779 |
* @since 2.6
|
1780 |
*/
|
1783 |
$plugins['abandoncart'] = plugin_dir_url( __FILE__ ) . 'assets/js/abandoncart_plugin_button.js';
|
1784 |
return $plugins;
|
1785 |
}
|
1786 |
+
|
1787 |
/**
|
1788 |
* It will add the tabs on the Abandoned cart page.
|
1789 |
* @since 1.0
|
1790 |
*/
|
1791 |
function wcal_display_tabs() {
|
1792 |
+
|
1793 |
if ( isset( $_GET['action'] ) ) {
|
1794 |
$action = $_GET['action'];
|
1795 |
} else {
|
1796 |
+
$action = "";
|
1797 |
$active_listcart = "";
|
1798 |
$active_emailtemplates = "";
|
1799 |
$active_settings = "";
|
1800 |
$active_stats = "";
|
1801 |
+
}
|
1802 |
if ( ( 'listcart' == $action || 'orderdetails' == $action ) || '' == $action ) {
|
1803 |
$active_listcart = "nav-tab-active";
|
1804 |
+
}
|
1805 |
if ( 'emailtemplates' == $action ) {
|
1806 |
$active_emailtemplates = "nav-tab-active";
|
1807 |
}
|
1813 |
}
|
1814 |
if ( 'report' == $action ) {
|
1815 |
$active_report = "nav-tab-active";
|
1816 |
+
}
|
1817 |
+
?>
|
1818 |
<div style="background-image: url('<?php echo plugins_url(); ?>/woocommerce-abandoned-cart/assets/images/ac_tab_icon.png') !important;" class="icon32"><br>
|
1819 |
+
</div>
|
1820 |
<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
|
1821 |
<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-abandoned-cart' );?> </a>
|
1822 |
<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-abandoned-cart' );?> </a>
|
1828 |
</h2>
|
1829 |
<?php
|
1830 |
}
|
1831 |
+
|
1832 |
/**
|
1833 |
* It will add the scripts needed for the plugin.
|
1834 |
* @hook admin_enqueue_scripts
|
1841 |
|
1842 |
if ( $page === '' || $page !== 'woocommerce_ac_page' ) {
|
1843 |
return;
|
1844 |
+
} else {
|
1845 |
wp_enqueue_script( 'jquery' );
|
1846 |
wp_enqueue_script(
|
1847 |
'jquery-ui-min',
|
1859 |
false
|
1860 |
);
|
1861 |
|
1862 |
+
|
1863 |
wp_register_script( 'woocommerce_admin', plugins_url() . '/woocommerce/assets/js/admin/woocommerce_admin.min.js', array( 'jquery', 'jquery-tiptip' ) );
|
1864 |
wp_register_script( 'woocommerce_tip_tap', plugins_url() . '/woocommerce/assets/js/jquery-tiptip/jquery.tipTip.min.js', array( 'jquery') );
|
1865 |
wp_enqueue_script( 'woocommerce_tip_tap');
|
1866 |
wp_enqueue_script( 'woocommerce_admin');
|
1867 |
$locale = localeconv();
|
1868 |
+
$decimal = isset( $locale['decimal_point'] ) ? $locale['decimal_point'] : '.';
|
1869 |
$params = array(
|
1870 |
/* translators: %s: decimal */
|
1871 |
'i18n_decimal_error' => sprintf( __( 'Please enter in decimal (%s) format without thousand separators.', 'woocommerce' ), $decimal ),
|
1891 |
*/
|
1892 |
wp_localize_script( 'woocommerce_admin', 'woocommerce_admin', $params );
|
1893 |
?>
|
1894 |
+
<script type="text/javascript" >
|
1895 |
function wcal_activate_email_template( template_id, active_state ) {
|
1896 |
location.href = 'admin.php?page=woocommerce_ac_page&action=emailtemplates&mode=activate_template&id='+template_id+'&active_state='+active_state ;
|
1897 |
}
|
1898 |
</script>
|
1899 |
+
<?php
|
1900 |
+
$js_src = includes_url('js/tinymce/') . 'tinymce.min.js';
|
1901 |
wp_enqueue_script( 'tinyMce_ac',$js_src );
|
1902 |
+
wp_enqueue_script( 'ac_email_variables', plugins_url() . '/woocommerce-abandoned-cart/assets/js/abandoncart_plugin_button.js' );
|
1903 |
+
wp_enqueue_script( 'wcal_activate_template', plugins_url() . '/woocommerce-abandoned-cart/assets/js/wcal_template_activate.js' );
|
1904 |
}
|
1905 |
}
|
1906 |
+
|
1907 |
/**
|
1908 |
* It will add the parameter to the editor.
|
1909 |
* @hook tiny_mce_before_init
|
1911 |
* @return array $in
|
1912 |
* @since 2.6
|
1913 |
*/
|
1914 |
+
function wcal_format_tiny_MCE( $in ) {
|
1915 |
$in['force_root_block'] = false;
|
1916 |
$in['valid_children'] = '+body[style]';
|
1917 |
$in['remove_linebreaks'] = false;
|
1928 |
$in['wpautop'] = false;
|
1929 |
$in['apply_source_formatting'] = true;
|
1930 |
$in['cleanup'] = true;
|
1931 |
+
$in['convert_newlines_to_brs'] = FALSE;
|
1932 |
+
$in['fullpage_default_xml_pi'] = false;
|
1933 |
$in['convert_urls'] = false;
|
1934 |
// Do not remove redundant BR tags
|
1935 |
+
$in['remove_redundant_brs'] = false;
|
1936 |
return $in;
|
1937 |
}
|
1938 |
+
|
1939 |
/**
|
1940 |
* It will add the necesaary css for the plugin.
|
1941 |
* @hook admin_enqueue_scripts
|
1951 |
if ( $page != 'woocommerce_ac_page' ) {
|
1952 |
return;
|
1953 |
} elseif ( $page === 'woocommerce_ac_page' ) {
|
1954 |
+
|
1955 |
+
wp_enqueue_style( 'jquery-ui', plugins_url() . '/woocommerce-abandoned-cart/assets/css/jquery-ui.css', '', '', false );
|
1956 |
wp_enqueue_style( 'woocommerce_admin_styles', plugins_url() . '/woocommerce/assets/css/admin.css' );
|
1957 |
+
|
1958 |
wp_enqueue_style( 'jquery-ui-style', plugins_url() . '/woocommerce-abandoned-cart/assets/css/jquery-ui-smoothness.css' );
|
1959 |
wp_enqueue_style( 'abandoned-orders-list', plugins_url() . '/woocommerce-abandoned-cart/assets/css/view.abandoned.orders.style.css' );
|
1960 |
wp_enqueue_style( 'wcal_email_template', plugins_url() . '/woocommerce-abandoned-cart/assets/css/wcal_template_activate.css' );
|
1961 |
+
|
1962 |
}
|
1963 |
+
}
|
1964 |
+
|
1965 |
|
1966 |
/**
|
1967 |
+
* When we have added the wp list table for the listing then while deleting the record with the bulk action it was showing
|
1968 |
+
* the notice. To overcome the wp redirect warning we need to start the ob_start.
|
1969 |
* @hook init
|
1970 |
* @since 2.5.2
|
1971 |
*/
|
1972 |
function wcal_app_output_buffer() {
|
1973 |
ob_start();
|
1974 |
}
|
1975 |
+
|
1976 |
/**
|
1977 |
* Abandon Cart Settings Page. It will show the tabs, notices for the plugin.
|
1978 |
+
* It will also update the template records and display the template fields.
|
1979 |
* It will also show the abandoned cart details page.
|
1980 |
* It will also show the details of all the tabs.
|
1981 |
* @globals mixed $wpdb
|
1982 |
* @since 1.0
|
1983 |
*/
|
1984 |
function wcal_menu_page() {
|
1985 |
+
|
1986 |
if ( is_user_logged_in() ) {
|
1987 |
+
global $wpdb;
|
1988 |
// Check the user capabilities
|
1989 |
+
if ( ! current_user_can( 'manage_woocommerce' ) ) {
|
1990 |
wp_die( __( 'You do not have sufficient permissions to access this page.', 'woocommerce-abandoned-cart' ) );
|
1991 |
+
}
|
1992 |
?>
|
1993 |
+
<div class="wrap">
|
1994 |
<h2><?php _e( 'WooCommerce - Abandon Cart Lite', 'woocommerce-abandoned-cart' ); ?></h2>
|
1995 |
+
<?php
|
1996 |
|
1997 |
if ( isset( $_GET['ac_update'] ) && 'email_templates' === $_GET['ac_update'] ) {
|
1998 |
$status = wcal_common::update_templates_table();
|
2003 |
wcal_common::show_update_failure();
|
2004 |
}
|
2005 |
}
|
2006 |
+
|
2007 |
if ( isset( $_GET['action'] ) ) {
|
2008 |
$action = $_GET['action'];
|
2009 |
} else {
|
2013 |
$mode = $_GET['mode'];
|
2014 |
} else {
|
2015 |
$mode = "";
|
2016 |
+
}
|
2017 |
$this->wcal_display_tabs();
|
2018 |
+
|
2019 |
do_action ( 'wcal_add_tab_content' );
|
2020 |
+
|
2021 |
/**
|
2022 |
* When we delete the item from the below drop down it is registred in action 2
|
2023 |
*/
|
2048 |
$class->wcal_delete_template_bulk_action_handler_function( $id );
|
2049 |
}
|
2050 |
}
|
2051 |
+
|
2052 |
if ( isset( $_GET['wcal_deleted'] ) && 'YES' == $_GET['wcal_deleted'] ) { ?>
|
2053 |
<div id="message" class="updated fade">
|
2054 |
<p><strong><?php _e( 'The Abandoned cart has been successfully deleted.', 'woocommerce-abandoned-cart' ); ?></strong></p>
|
2055 |
</div>
|
2056 |
+
<?php }
|
2057 |
if ( isset( $_GET ['wcal_template_deleted'] ) && 'YES' == $_GET['wcal_template_deleted'] ) { ?>
|
2058 |
<div id="message" class="updated fade">
|
2059 |
<p><strong><?php _e( 'The Template has been successfully deleted.', 'woocommerce-abandoned-cart' ); ?></strong></p>
|
2060 |
</div>
|
2061 |
+
<?php }
|
2062 |
if ( 'emailsettings' == $action ) {
|
2063 |
// Save the field values
|
2064 |
?>
|
2065 |
<p><?php _e( 'Change settings for sending email notifications to Customers, to Admin etc.', 'woocommerce-abandoned-cart' ); ?></p>
|
2066 |
<div id="content">
|
2067 |
+
<?php
|
2068 |
$wcal_general_settings_class = $wcal_email_setting = $wcap_sms_settings = $wcap_atc_settings = $wcap_fb_settings = "";
|
2069 |
|
2070 |
$section = isset( $_GET[ 'wcal_section' ] ) ? $_GET[ 'wcal_section' ] : '';
|
2071 |
+
|
2072 |
switch( $section ) {
|
2073 |
|
2074 |
case 'wcal_general_settings':
|
2096 |
$wcal_general_settings_class = "current";
|
2097 |
break;
|
2098 |
|
2099 |
+
}
|
2100 |
?>
|
2101 |
<ul class="subsubsub" id="wcal_general_settings_list">
|
2102 |
<li>
|
2109 |
<a href="admin.php?page=woocommerce_ac_page&action=emailsettings&wcal_section=wcap_atc_settings" class="<?php echo $wcap_atc_settings; ?>"><?php _e( 'Add To Cart Popup Editor', 'woocommerce-ac' );?> </a> |
|
2110 |
</li>
|
2111 |
<li>
|
2112 |
+
<a href="admin.php?page=woocommerce_ac_page&action=emailsettings&wcal_section=wcap_fb_settings" class="<?php echo $wcap_fb_settings; ?>"><?php _e( 'Facebook Messenger', 'woocommerce-ac' );?> </a> |
|
2113 |
</li>
|
2114 |
<li>
|
2115 |
+
<a href="admin.php?page=woocommerce_ac_page&action=emailsettings&wcal_section=wcap_sms_settings" class="<?php echo $wcap_sms_settings; ?>"><?php _e( 'SMS', 'woocommerce-ac' );?> </a>
|
2116 |
+
</li>
|
2117 |
|
2118 |
</ul>
|
2119 |
<br class="clear">
|
2124 |
<?php settings_fields( 'woocommerce_ac_settings' ); ?>
|
2125 |
<?php do_settings_sections( 'woocommerce_ac_page' ); ?>
|
2126 |
<?php settings_errors(); ?>
|
2127 |
+
<?php submit_button(); ?>
|
2128 |
</form>
|
2129 |
+
<?php
|
2130 |
} else if ( 'wcal_email_settings' == $section ) {
|
2131 |
?>
|
2132 |
<form method="post" action="options.php">
|
2135 |
<?php settings_errors(); ?>
|
2136 |
<?php submit_button(); ?>
|
2137 |
</form>
|
2138 |
+
<?php
|
2139 |
} elseif( 'wcap_atc_settings' == $section ) {
|
2140 |
WCAP_Pro_Settings::wcap_atc_settings();
|
2141 |
} elseif( 'wcap_fb_settings' == $section ) {
|
2145 |
}
|
2146 |
?>
|
2147 |
</div>
|
2148 |
+
<?php
|
2149 |
} elseif ( $action == 'listcart' || '' == $action || '-1' == $action || '-1' == $action_two ) {
|
2150 |
+
?>
|
2151 |
<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-abandoned-cart' );?> </p>
|
2152 |
<?php
|
2153 |
$get_all_abandoned_count = wcal_common::wcal_get_abandoned_order_count( 'wcal_all_abandoned' );
|
2154 |
$get_registered_user_ac_count = wcal_common::wcal_get_abandoned_order_count( 'wcal_all_registered' );
|
2155 |
$get_guest_user_ac_count = wcal_common::wcal_get_abandoned_order_count( 'wcal_all_guest' );
|
2156 |
+
$get_visitor_user_ac_count = wcal_common::wcal_get_abandoned_order_count( 'wcal_all_visitor' );
|
2157 |
+
|
2158 |
$wcal_user_reg_text = 'User';
|
2159 |
if ( $get_registered_user_ac_count > 1 ) {
|
2160 |
$wcal_user_reg_text = 'Users';
|
2161 |
+
}
|
2162 |
$wcal_user_gus_text = 'User';
|
2163 |
if ( $get_guest_user_ac_count > 1 ) {
|
2164 |
$wcal_user_gus_text = 'Users';
|
2165 |
+
}
|
2166 |
$wcal_all_abandoned_carts = $section = $wcal_all_registered = $wcal_all_guest = $wcal_all_visitor = "" ;
|
2167 |
+
|
2168 |
if ( isset( $_GET[ 'wcal_section' ] ) ) {
|
2169 |
$section = $_GET[ 'wcal_section' ];
|
2170 |
} else {
|
2173 |
if ( 'wcal_all_abandoned' == $section || '' == $section ) {
|
2174 |
$wcal_all_abandoned_carts = "current";
|
2175 |
}
|
2176 |
+
|
2177 |
if ( 'wcal_all_registered' == $section ) {
|
2178 |
$wcal_all_registered = "current";
|
2179 |
$wcal_all_abandoned_carts = "";
|
2182 |
$wcal_all_guest = "current";
|
2183 |
$wcal_all_abandoned_carts = "";
|
2184 |
}
|
2185 |
+
|
2186 |
if ( 'wcal_all_visitor' == $section ) {
|
2187 |
$wcal_all_visitor = "current";
|
2188 |
$wcal_all_abandoned_carts = "";
|
2190 |
?>
|
2191 |
<ul class="subsubsub" id="wcal_recovered_orders_list">
|
2192 |
<li>
|
2193 |
+
<a href="admin.php?page=woocommerce_ac_page&action=listcart&wcal_section=wcal_all_abandoned" class="<?php echo $wcal_all_abandoned_carts; ?>"><?php _e( "All ", 'woocommerce-abandoned-cart' ) ;?> <span class = "count" > <?php echo "( $get_all_abandoned_count )" ?> </span></a>
|
2194 |
</li>
|
2195 |
+
|
2196 |
<?php if ( $get_registered_user_ac_count > 0 ) { ?>
|
2197 |
<li>
|
2198 |
+
| <a href="admin.php?page=woocommerce_ac_page&action=listcart&wcal_section=wcal_all_registered" class="<?php echo $wcal_all_registered; ?>"><?php printf( __( 'Registered %s', 'woocommerce-abandoned-cart' ), $wcal_user_reg_text ); ?> <span class = "count" > <?php echo "( $get_registered_user_ac_count )" ?> </span></a>
|
2199 |
</li>
|
2200 |
<?php } ?>
|
2201 |
+
|
2202 |
<?php if ( $get_guest_user_ac_count > 0 ) { ?>
|
2203 |
<li>
|
2204 |
+
| <a href="admin.php?page=woocommerce_ac_page&action=listcart&wcal_section=wcal_all_guest" class="<?php echo $wcal_all_guest; ?>"><?php printf( __( 'Guest %s', 'woocommerce-abandoned-cart' ), $wcal_user_gus_text ); ?> <span class = "count" > <?php echo "( $get_guest_user_ac_count )" ?> </span></a>
|
2205 |
</li>
|
2206 |
<?php } ?>
|
2207 |
+
|
2208 |
<?php if ( $get_visitor_user_ac_count > 0 ) { ?>
|
2209 |
<li>
|
2210 |
+
| <a href="admin.php?page=woocommerce_ac_page&action=listcart&wcal_section=wcal_all_visitor" class="<?php echo $wcal_all_visitor; ?>"><?php _e( "Carts without Customer Details", 'woocommerce-abandoned-cart' ); ?> <span class = "count" > <?php echo "( $get_visitor_user_ac_count )" ?> </span></a>
|
2211 |
</li>
|
2212 |
<?php } ?>
|
2213 |
</ul>
|
2214 |
+
|
2215 |
+
<?php
|
2216 |
global $wpdb;
|
2217 |
include_once( 'includes/classes/class-wcal-abandoned-orders-table.php' );
|
2218 |
$wcal_abandoned_order_list = new WCAL_Abandoned_Orders_Table();
|
2224 |
<input type="hidden" name="action" value="listcart" />
|
2225 |
<?php $wcal_abandoned_order_list->display(); ?>
|
2226 |
</form>
|
2227 |
+
</div>
|
2228 |
+
<?php
|
2229 |
} elseif ( ( 'emailtemplates' == $action && ( 'edittemplate' != $mode && 'addnewtemplate' != $mode ) || '' == $action || '-1' == $action || '-1' == $action_two ) ) {
|
2230 |
?>
|
2231 |
<p> <?php _e( 'Add email templates at different intervals to maximize the possibility of recovering your abandoned carts.', 'woocommerce-abandoned-cart' );?> </p>
|
2232 |
+
<?php
|
2233 |
// Save the field values
|
2234 |
+
$insert_template_successfuly = $update_template_successfuly = '';
|
2235 |
if ( isset( $_POST['ac_settings_frm'] ) && 'save' == $_POST['ac_settings_frm'] ) {
|
2236 |
$woocommerce_ac_email_subject = trim( htmlspecialchars( $_POST['woocommerce_ac_email_subject'] ), ENT_QUOTES );
|
2237 |
$woocommerce_ac_email_body = trim( $_POST['woocommerce_ac_email_body'] );
|
2242 |
$day_or_hour = trim( $_POST['day_or_hour'] );
|
2243 |
$is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
|
2244 |
$default_value = 0 ;
|
2245 |
+
|
2246 |
$query = "INSERT INTO `".$wpdb->prefix."ac_email_templates_lite`
|
2247 |
(subject, body, frequency, day_or_hour, template_name, is_wc_template, default_template, wc_email_header )
|
2248 |
VALUES ( %s, %s, %d, %s, %s, %s, %d, %s )";
|
2249 |
+
|
2250 |
$insert_template_successfuly = $wpdb->query( $wpdb->prepare( $query,
|
2251 |
$woocommerce_ac_email_subject,
|
2252 |
$woocommerce_ac_email_body,
|
2255 |
$woocommerce_ac_template_name,
|
2256 |
$is_wc_template,
|
2257 |
$default_value,
|
2258 |
+
$woocommerce_ac_email_header )
|
2259 |
+
);
|
2260 |
}
|
2261 |
+
|
2262 |
+
if ( isset( $_POST['ac_settings_frm'] ) && 'update' == $_POST['ac_settings_frm'] ) {
|
2263 |
+
|
2264 |
$updated_is_active = '0';
|
2265 |
+
|
2266 |
$email_frequency = trim( $_POST['email_frequency'] );
|
2267 |
$day_or_hour = trim( $_POST['day_or_hour'] );
|
2268 |
$is_wc_template = ( empty( $_POST['is_wc_template'] ) ) ? '0' : '1';
|
2269 |
+
|
2270 |
$woocommerce_ac_email_subject = trim( htmlspecialchars( $_POST['woocommerce_ac_email_subject'] ), ENT_QUOTES );
|
2271 |
$woocommerce_ac_email_body = trim( $_POST['woocommerce_ac_email_body'] );
|
2272 |
$woocommerce_ac_template_name = trim( $_POST['woocommerce_ac_template_name'] );
|
2273 |
$woocommerce_ac_email_header = stripslashes( trim( htmlspecialchars( $_POST['wcal_wc_email_header'] ), ENT_QUOTES ) );
|
2274 |
$id = trim( $_POST['id'] );
|
2275 |
+
|
2276 |
$check_query = "SELECT * FROM `".$wpdb->prefix."ac_email_templates_lite`
|
2277 |
WHERE id = %d ";
|
2278 |
$check_results = $wpdb->get_results( $wpdb->prepare( $check_query, $id ) );
|
2279 |
$default_value = '';
|
2280 |
|
2281 |
+
if ( count( $check_results ) > 0 ) {
|
2282 |
if ( isset( $check_results[0]->default_template ) && $check_results[0]->default_template == '1' ) {
|
2283 |
$default_value = '1';
|
2284 |
}
|
2285 |
}
|
2286 |
+
|
2287 |
$query_update_latest = "UPDATE `".$wpdb->prefix."ac_email_templates_lite`
|
2288 |
SET
|
2289 |
subject = %s,
|
2295 |
default_template = %d,
|
2296 |
wc_email_header = %s
|
2297 |
WHERE id = %d ";
|
2298 |
+
|
2299 |
$update_template_successfuly = $wpdb->query( $wpdb->prepare( $query_update_latest,
|
2300 |
$woocommerce_ac_email_subject,
|
2301 |
$woocommerce_ac_email_body,
|
2306 |
$default_value,
|
2307 |
$woocommerce_ac_email_header,
|
2308 |
$id )
|
2309 |
+
);
|
2310 |
+
|
2311 |
}
|
2312 |
+
|
2313 |
if ( 'emailtemplates' == $action && 'removetemplate' == $mode ) {
|
2314 |
$id_remove = $_GET['id'];
|
2315 |
$query_remove = "DELETE FROM `".$wpdb->prefix."ac_email_templates_lite` WHERE id= %d ";
|
2316 |
$wpdb->query( $wpdb->prepare( $query_remove, $id_remove ) );
|
2317 |
}
|
2318 |
+
|
2319 |
if ( 'emailtemplates' == $action && 'activate_template' == $mode ) {
|
2320 |
$template_id = $_GET['id'];
|
2321 |
$current_template_status = $_GET['active_state'];
|
2322 |
+
|
2323 |
if ( "1" == $current_template_status ) {
|
2324 |
$active = "0";
|
2325 |
} else {
|
2332 |
$email_day_or_hour = $get_selected_template_result[0]->day_or_hour;
|
2333 |
|
2334 |
$query_update = "UPDATE `".$wpdb->prefix."ac_email_templates_lite` SET is_active='0' WHERE frequency='" . $email_frequncy . "' AND day_or_hour='" . $email_day_or_hour . "' ";
|
2335 |
+
$wcap_updated = $wpdb->query( $query_update );
|
2336 |
}
|
2337 |
|
2338 |
$query_update = "UPDATE `" . $wpdb->prefix . "ac_email_templates_lite`
|
2340 |
is_active = '" . $active . "'
|
2341 |
WHERE id = '" . $template_id . "' ";
|
2342 |
$wpdb->query( $query_update );
|
2343 |
+
|
2344 |
wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&action=emailtemplates' ) );
|
2345 |
}
|
2346 |
|
2361 |
</strong>
|
2362 |
</p>
|
2363 |
</div>
|
2364 |
+
<?php
|
2365 |
}
|
2366 |
|
2367 |
if ( isset( $_POST['ac_settings_frm'] ) && 'update' == $_POST['ac_settings_frm'] && isset( $update_template_successfuly ) && $update_template_successfuly !== false ) { ?>
|
2381 |
</strong>
|
2382 |
</p>
|
2383 |
</div>
|
2384 |
+
<?php
|
2385 |
}
|
2386 |
?>
|
2387 |
<div class="tablenav">
|
2388 |
<p style="float:left;">
|
2389 |
<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-abandoned-cart' ); ?>
|
2390 |
+
</a>
|
2391 |
</p>
|
2392 |
+
|
2393 |
<?php
|
2394 |
/* From here you can do whatever you want with the data from the $result link. */
|
2395 |
include_once('includes/classes/class-wcal-templates-table.php');
|
2404 |
</form>
|
2405 |
</div>
|
2406 |
</div>
|
2407 |
+
<?php
|
2408 |
} elseif ( 'stats' == $action || '' == $action ) {
|
2409 |
?>
|
2410 |
<p>
|
2437 |
start_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() - 365 );
|
2438 |
end_date = new Date( today.getFullYear(), today.getMonth(), today.getDate() );
|
2439 |
}
|
2440 |
+
|
2441 |
var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
2442 |
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
2443 |
+
|
2444 |
var start_date_value = start_date.getDate() + " " + monthNames[start_date.getMonth()] + " " + start_date.getFullYear();
|
2445 |
var end_date_value = end_date.getDate() + " " + monthNames[end_date.getMonth()] + " " + end_date.getFullYear();
|
2446 |
+
|
2447 |
jQuery( '#start_date' ).val( start_date_value );
|
2448 |
jQuery( '#end_date' ).val( end_date_value );
|
2449 |
} );
|
2450 |
});
|
2451 |
</script>
|
2452 |
<?php
|
2453 |
+
|
2454 |
if ( isset( $_POST['duration_select'] ) ){
|
2455 |
$duration_range = $_POST['duration_select'];
|
2456 |
} else {
|
2457 |
$duration_range = "";
|
2458 |
+
}
|
2459 |
if ( '' == $duration_range ) {
|
2460 |
if ( isset( $_GET['duration_select'] ) ){
|
2461 |
$duration_range = $_GET['duration_select'];
|
2462 |
}
|
2463 |
}
|
2464 |
if ( '' == $duration_range ) $duration_range = "last_seven";
|
2465 |
+
|
2466 |
_e( 'The Report below shows how many Abandoned Carts we were able to recover for you by sending automatic emails to encourage shoppers.', 'woocommerce-abandoned-cart');
|
2467 |
?>
|
2468 |
<div id="recovered_stats" class="postbox" style="display:block">
|
2474 |
$sel = "";
|
2475 |
if ( $key == $duration_range ) {
|
2476 |
$sel = " selected ";
|
2477 |
+
}
|
2478 |
echo"<option value='$key' $sel> $value </option>";
|
2479 |
+
}
|
2480 |
$date_sett = $this->start_end_dates[ $duration_range ];
|
2481 |
?>
|
2482 |
</select>
|
2486 |
var formats = ["d.m.y", "d M yy","MM d, yy"];
|
2487 |
jQuery( "#start_date" ).datepicker( { dateFormat: formats[1] } );
|
2488 |
});
|
2489 |
+
|
2490 |
jQuery( document ).ready( function()
|
2491 |
{
|
2492 |
var formats = ["d.m.y", "d M yy","MM d, yy"];
|
2493 |
jQuery( "#end_date" ).datepicker( { dateFormat: formats[1] } );
|
2494 |
});
|
2495 |
+
</script>
|
2496 |
+
<?php
|
2497 |
+
include_once('includes/classes/class-wcal-recover-orders-table.php');
|
2498 |
$wcal_recover_orders_list = new WCAL_Recover_Orders_Table();
|
2499 |
$wcal_recover_orders_list->wcal_recovered_orders_prepare_items();
|
2500 |
+
|
2501 |
if ( isset( $_POST['start_date'] ) ) $start_date_range = $_POST['start_date'];
|
2502 |
else $start_date_range = "";
|
2503 |
+
|
2504 |
if ( $start_date_range == "" ) {
|
2505 |
$start_date_range = $date_sett['start_date'];
|
2506 |
}
|
2507 |
+
|
2508 |
if ( isset( $_POST['end_date'] ) ) $end_date_range = $_POST['end_date'];
|
2509 |
else $end_date_range = "";
|
2510 |
+
|
2511 |
if ( $end_date_range == "" ) {
|
2512 |
$end_date_range = $date_sett['end_date'];
|
2513 |
}
|
2514 |
+
?>
|
2515 |
<label class="start_label" for="start_day"> <?php _e( 'Start Date:', 'woocommerce-abandoned-cart' ); ?> </label>
|
2516 |
+
<input type="text" id="start_date" name="start_date" readonly="readonly" value="<?php echo $start_date_range; ?>"/>
|
2517 |
<label class="end_label" for="end_day"> <?php _e( 'End Date:', 'woocommerce-abandoned-cart' ); ?> </label>
|
2518 |
+
<input type="text" id="end_date" name="end_date" readonly="readonly" value="<?php echo $end_date_range; ?>"/>
|
2519 |
<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e( 'Go', 'woocommerce-abandoned-cart' ); ?>" />
|
2520 |
</form>
|
2521 |
</div>
|
2524 |
<div class="inside" >
|
2525 |
<?php
|
2526 |
$count = $wcal_recover_orders_list->total_abandoned_cart_count;
|
2527 |
+
$total_of_all_order = $wcal_recover_orders_list->total_order_amount;
|
2528 |
$recovered_item = $wcal_recover_orders_list->recovered_item;
|
2529 |
$recovered_total = wc_price( $wcal_recover_orders_list->total_recover_amount );
|
2530 |
?>
|
2558 |
<th> <?php _e( 'Quantity', 'woocommerce-abandoned-cart' ); ?> </th>
|
2559 |
<th> <?php _e( 'Line Subtotal', 'woocommerce-abandoned-cart' ); ?> </th>
|
2560 |
<th> <?php _e( 'Line Total', 'woocommerce-abandoned-cart' ); ?> </th>
|
2561 |
+
</tr>
|
2562 |
+
<?php
|
2563 |
$query = "SELECT * FROM `".$wpdb->prefix."ac_abandoned_cart_history_lite` WHERE id = %d ";
|
2564 |
+
$results = $wpdb->get_results( $wpdb->prepare( $query,$_GET['id'] ) );
|
2565 |
+
|
2566 |
$shipping_charges = 0;
|
2567 |
$currency_symbol = get_woocommerce_currency_symbol();
|
2568 |
+
$number_decimal = wc_get_price_decimals();
|
2569 |
if ( $results[0]->user_type == "GUEST" && "0" != $results[0]->user_id ) {
|
2570 |
+
$query_guest = "SELECT * FROM `".$wpdb->prefix."ac_guest_abandoned_cart_history_lite` WHERE id = %d";
|
2571 |
$results_guest = $wpdb->get_results( $wpdb->prepare( $query_guest, $results[0]->user_id ) );
|
2572 |
$user_email = $user_first_name = $user_last_name = $user_billing_postcode = $user_shipping_postcode = '';
|
2573 |
$shipping_charges = '';
|
2580 |
$shipping_charges = $results_guest[0]->shipping_charges;
|
2581 |
}
|
2582 |
$user_billing_company = $user_billing_address_1 = $user_billing_address_2 = $user_billing_city = $user_billing_state = $user_billing_country = $user_billing_phone = "";
|
2583 |
+
$user_shipping_company = $user_shipping_address_1 = $user_shipping_address_2 = $user_shipping_city = $user_shipping_state = $user_shipping_country = "";
|
2584 |
} else if ( $results[0]->user_type == "GUEST" && $results[0]->user_id == "0" ) {
|
2585 |
$user_email = '';
|
2586 |
$user_first_name = "Visitor";
|
2590 |
$shipping_charges = '';
|
2591 |
$user_billing_phone = '';
|
2592 |
$user_billing_company = $user_billing_address_1 = $user_billing_address_2 = $user_billing_city = $user_billing_state = $user_billing_country = "";
|
2593 |
+
$user_shipping_company = $user_shipping_address_1 = $user_shipping_address_2 = $user_shipping_city = $user_shipping_state = $user_shipping_country = "";
|
2594 |
} else {
|
2595 |
+
$user_id = $results[0]->user_id;
|
2596 |
if ( isset( $results[0]->user_login ) ) {
|
2597 |
$user_login = $results[0]->user_login;
|
2598 |
}
|
2599 |
+
$user_email = get_user_meta( $results[0]->user_id, 'billing_email', true );
|
2600 |
if ( '' == $user_email ) {
|
2601 |
$user_data = get_userdata( $results[0]->user_id );
|
2602 |
if ( isset( $user_data->user_email ) ) {
|
2605 |
$user_email = '';
|
2606 |
}
|
2607 |
}
|
2608 |
+
|
2609 |
$user_first_name = "";
|
2610 |
$user_first_name_temp = get_user_meta( $user_id, 'billing_first_name', true );
|
2611 |
if ( isset( $user_first_name_temp ) && '' == $user_first_name_temp ) {
|
2617 |
}
|
2618 |
} else {
|
2619 |
$user_first_name = $user_first_name_temp;
|
2620 |
+
}
|
2621 |
$user_last_name = "";
|
2622 |
$user_last_name_temp = get_user_meta( $user_id, 'billing_last_name', true );
|
2623 |
if ( isset( $user_last_name_temp ) && "" == $user_last_name_temp ) {
|
2629 |
}
|
2630 |
} else {
|
2631 |
$user_last_name = $user_last_name_temp;
|
2632 |
+
}
|
2633 |
$user_billing_first_name = get_user_meta( $results[0]->user_id, 'billing_first_name' );
|
2634 |
+
$user_billing_last_name = get_user_meta( $results[0]->user_id, 'billing_last_name' );
|
2635 |
|
2636 |
$user_billing_details = wcal_common::wcal_get_billing_details( $results[0]->user_id );
|
2637 |
+
|
2638 |
$user_billing_company = $user_billing_details[ 'billing_company' ];
|
2639 |
$user_billing_address_1 = $user_billing_details[ 'billing_address_1' ];
|
2640 |
$user_billing_address_2 = $user_billing_details[ 'billing_address_2' ];
|
2648 |
$user_billing_phone = $user_billing_phone_temp[0];
|
2649 |
} else {
|
2650 |
$user_billing_phone = "";
|
2651 |
+
}
|
2652 |
$user_shipping_first_name = get_user_meta( $results[0]->user_id, 'shipping_first_name' );
|
2653 |
+
$user_shipping_last_name = get_user_meta( $results[0]->user_id, 'shipping_last_name' );
|
2654 |
+
$user_shipping_company_temp = get_user_meta( $results[0]->user_id, 'shipping_company' );
|
2655 |
if ( isset( $user_shipping_company_temp[0] ) ) {
|
2656 |
$user_shipping_company = $user_shipping_company_temp[0];
|
2657 |
} else {
|
2658 |
$user_shipping_company = "";
|
2659 |
+
}
|
2660 |
$user_shipping_address_1_temp = get_user_meta( $results[0]->user_id, 'shipping_address_1' );
|
2661 |
if ( isset( $user_shipping_address_1_temp[0] ) ) {
|
2662 |
$user_shipping_address_1 = $user_shipping_address_1_temp[0];
|
2663 |
} else {
|
2664 |
$user_shipping_address_1 = "";
|
2665 |
+
}
|
2666 |
$user_shipping_address_2_temp = get_user_meta( $results[0]->user_id, 'shipping_address_2' );
|
2667 |
if ( isset( $user_shipping_address_2_temp[0] ) ) {
|
2668 |
$user_shipping_address_2 = $user_shipping_address_2_temp[0];
|
2669 |
} else {
|
2670 |
$user_shipping_address_2 = "";
|
2671 |
+
}
|
2672 |
$user_shipping_city_temp = get_user_meta( $results[0]->user_id, 'shipping_city' );
|
2673 |
if ( isset( $user_shipping_city_temp[0] ) ) {
|
2674 |
$user_shipping_city = $user_shipping_city_temp[0];
|
2675 |
} else {
|
2676 |
$user_shipping_city = "";
|
2677 |
+
}
|
2678 |
$user_shipping_postcode_temp = get_user_meta( $results[0]->user_id, 'shipping_postcode' );
|
2679 |
if ( isset( $user_shipping_postcode_temp[0] ) ) {
|
2680 |
$user_shipping_postcode = $user_shipping_postcode_temp[0];
|
2681 |
} else {
|
2682 |
$user_shipping_postcode = "";
|
2683 |
+
}
|
2684 |
$user_shipping_country_temp = get_user_meta( $results[0]->user_id, 'shipping_country' );
|
2685 |
$user_shipping_country = "";
|
2686 |
if ( isset( $user_shipping_country_temp[0] ) ) {
|
2687 |
$user_shipping_country = $user_shipping_country_temp[0];
|
2688 |
if ( isset( $woocommerce->countries->countries[ $user_shipping_country ] ) ) {
|
2689 |
+
$user_shipping_country = $woocommerce->countries->countries[ $user_shipping_country ];
|
2690 |
}else {
|
2691 |
$user_shipping_country = "";
|
2692 |
+
}
|
2693 |
}
|
2694 |
$user_shipping_state_temp = get_user_meta( $results[0]->user_id, 'shipping_state' );
|
2695 |
$user_shipping_state = "";
|
2698 |
if ( isset( $woocommerce->countries->states[ $user_shipping_country_temp[0] ][ $user_shipping_state ] ) ) {
|
2699 |
# code...
|
2700 |
$user_shipping_state = $woocommerce->countries->states[ $user_shipping_country_temp[0] ][ $user_shipping_state ];
|
2701 |
+
}
|
2702 |
+
}
|
2703 |
+
}
|
2704 |
+
|
2705 |
$cart_details = array();
|
2706 |
$cart_info = json_decode( $results[0]->abandoned_cart_info );
|
2707 |
$cart_details = (array) $cart_info->cart;
|
2708 |
$item_subtotal = $item_total = 0;
|
2709 |
+
|
2710 |
+
if ( is_array ( $cart_details ) && count( $cart_details ) > 0 ) {
|
2711 |
foreach ( $cart_details as $k => $v ) {
|
2712 |
|
2713 |
$item_details = wcal_common::wcal_get_cart_details( $v );
|
2723 |
$item_subtotal = $item_details[ 'item_total_formatted' ];
|
2724 |
$item_total = $item_details[ 'item_total' ];
|
2725 |
$quantity_total = $item_details[ 'qty' ];
|
2726 |
+
|
2727 |
$qty_item_text = 'item';
|
2728 |
if ( $quantity_total > 1 ) {
|
2729 |
$qty_item_text = 'items';
|
2730 |
}
|
2731 |
+
?>
|
2732 |
<tr>
|
2733 |
<td> <?php echo $prod_image; ?></td>
|
2734 |
<td> <?php echo '<a href="' . $product_page_url . '"> ' . $product_name . ' </a>'; ?> </td>
|
2735 |
<td> <?php echo $quantity_total; ?></td>
|
2736 |
<td> <?php echo $item_subtotal; ?></td>
|
2737 |
<td> <?php echo $item_total; ?></td>
|
2738 |
+
</tr>
|
2739 |
+
<?php
|
2740 |
$item_subtotal = $item_total = 0;
|
2741 |
}
|
2742 |
}
|
2743 |
?>
|
2744 |
</table>
|
2745 |
+
</div>
|
2746 |
</div>
|
2747 |
<div id="ac_order_customer_details" class="postbox" style="display:block">
|
2748 |
<h3 class="details-title"> <p> <?php _e( 'Customer Details' , 'woocommerce-abandoned-cart' ); ?> </p> </h3>
|
2752 |
<h3> <p> <?php _e( 'Billing Details' , 'woocommerce-abandoned-cart' ); ?> </p> </h3>
|
2753 |
<p> <strong> <?php _e( 'Name:' , 'woocommerce-abandoned-cart' ); ?> </strong>
|
2754 |
<?php echo $user_first_name." ".$user_last_name;?>
|
2755 |
+
</p>
|
2756 |
<p> <strong> <?php _e( 'Address:' , 'woocommerce-abandoned-cart' ); ?> </strong>
|
2757 |
<?php echo $user_billing_company."</br>".
|
2758 |
$user_billing_address_1."</br>".
|
2761 |
$user_billing_postcode."</br>".
|
2762 |
$user_billing_state."</br>".
|
2763 |
$user_billing_country."</br>";
|
2764 |
+
?>
|
2765 |
+
</p>
|
2766 |
<p> <strong> <?php _e( 'Email:', 'woocommerce-abandoned-cart' ); ?> </strong>
|
2767 |
<?php $user_mail_to = "mailto:".$user_email; ?>
|
2768 |
<a href=<?php echo $user_mail_to;?>><?php echo $user_email;?> </a>
|
2769 |
+
</p>
|
2770 |
<p> <strong> <?php _e( 'Phone:', 'woocommerce-abandoned-cart' ); ?> </strong>
|
2771 |
<?php echo $user_billing_phone;?>
|
2772 |
</p>
|
2773 |
+
</div>
|
2774 |
<div style="width:50%;float:right">
|
2775 |
+
<h3> <p> <?php _e( 'Shipping Details', 'woocommerce-abandoned-cart' ); ?> </p> </h3>
|
2776 |
<p> <strong> <?php _e( 'Address:', 'woocommerce-abandoned-cart' ); ?> </strong>
|
2777 |
+
<?php
|
2778 |
if ( $user_shipping_company == '' &&
|
2779 |
$user_shipping_address_1 == '' &&
|
2780 |
$user_shipping_address_2 == '' &&
|
2783 |
$user_shipping_state == '' &&
|
2784 |
$user_shipping_country == '') {
|
2785 |
echo "Shipping Address same as Billing Address";
|
2786 |
+
} else { ?>
|
2787 |
<?php echo $user_shipping_company."</br>".
|
2788 |
$user_shipping_address_1."</br>".
|
2789 |
$user_shipping_address_2."</br>".
|
2791 |
$user_shipping_postcode."</br>".
|
2792 |
$user_shipping_state."</br>".
|
2793 |
$user_shipping_country."</br>";
|
2794 |
+
?>
|
2795 |
<br><br>
|
2796 |
<strong><?php _e( 'Shipping Charges', 'woocommerce-abandoned-lite' ); ?>: </strong>
|
2797 |
<?php if ( $shipping_charges != 0 ) echo $currency_symbol . $shipping_charges;?>
|
2798 |
</p>
|
2799 |
+
<?php }?>
|
2800 |
</div>
|
2801 |
</div>
|
2802 |
</div>
|
2803 |
+
</div>
|
2804 |
<?php } elseif ( $action == 'report' ) {
|
2805 |
include_once('includes/classes/class-wcal-product-report-table.php');
|
2806 |
$wcal_product_report_list = new WCAL_Product_Report_Table();
|
2807 |
+
$wcal_product_report_list->wcal_product_report_prepare_items();
|
2808 |
?>
|
2809 |
<div class="wrap">
|
2810 |
<form id="wcal-sent-emails" method="get" >
|
2812 |
<input type="hidden" name="action" value="report" />
|
2813 |
<?php $wcal_product_report_list->display(); ?>
|
2814 |
</form>
|
2815 |
+
</div>
|
2816 |
<?php }
|
2817 |
}
|
2818 |
echo( "</table>" );
|
2819 |
+
|
2820 |
if ( isset( $_GET['action'] ) ) {
|
2821 |
$action = $_GET['action'];
|
2822 |
+
}
|
2823 |
if ( isset( $_GET['mode'] ) ) {
|
2824 |
$mode = $_GET['mode'];
|
2825 |
}
|
2826 |
+
if ( 'emailtemplates' == $action && ( 'addnewtemplate' == $mode || 'edittemplate' == $mode ) ) {
|
2827 |
if ( 'edittemplate' == $mode ) {
|
2828 |
$results = array();
|
2829 |
+
if ( isset( $_GET['id'] ) ) {
|
2830 |
$edit_id = $_GET['id'];
|
2831 |
$query = "SELECT wpet . * FROM `".$wpdb->prefix."ac_email_templates_lite` AS wpet WHERE id = %d ";
|
2832 |
$results = $wpdb->get_results( $wpdb->prepare( $query, $edit_id ) );
|
2833 |
}
|
2834 |
}
|
2835 |
+
$active_post = ( empty( $_POST['is_active'] ) ) ? '0' : '1';
|
2836 |
?>
|
2837 |
<div id="content">
|
2838 |
<form method="post" action="admin.php?page=woocommerce_ac_page&action=emailtemplates" id="ac_settings">
|
2841 |
$id_by = "";
|
2842 |
if ( isset( $_GET['id'] ) ) {
|
2843 |
$id_by = $_GET['id'];
|
2844 |
+
}
|
2845 |
+
?>
|
2846 |
<input type="hidden" name="id" value="<?php echo $id_by ;?>" />
|
2847 |
<?php
|
2848 |
$button_mode = "save";
|
2866 |
$template_name = "";
|
2867 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->template_name ) ) {
|
2868 |
$template_name = $results[0]->template_name;
|
2869 |
+
}
|
2870 |
print'<input type="text" name="woocommerce_ac_template_name" id="woocommerce_ac_template_name" class="regular-text" value="'.$template_name.'">';?>
|
2871 |
<img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter a template name for reference', 'woocommerce-abandoned-cart') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
|
2872 |
</td>
|
2873 |
</tr>
|
2874 |
+
|
2875 |
<tr>
|
2876 |
<th>
|
2877 |
<label for="woocommerce_ac_email_subject"><b><?php _e( 'Subject:', 'woocommerce-abandoned-cart' ); ?></b></label>
|
2881 |
$subject_edit = "";
|
2882 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->subject ) ) {
|
2883 |
$subject_edit= stripslashes ( $results[0]->subject );
|
2884 |
+
}
|
2885 |
print'<input type="text" name="woocommerce_ac_email_subject" id="woocommerce_ac_email_subject" class="regular-text" value="'.$subject_edit.'">';?>
|
2886 |
<img class="help_tip" width="16" height="16" data-tip='<?php _e('Enter the subject that should appear in the email sent', 'woocommerce-abandoned-cart') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
|
2887 |
</td>
|
2891 |
<th>
|
2892 |
<label for="woocommerce_ac_email_body"><b><?php _e( 'Email Body:', 'woocommerce-abandoned-cart' ); ?></b></label>
|
2893 |
</th>
|
2894 |
+
<td>
|
2895 |
<?php
|
2896 |
$initial_data = "";
|
2897 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->body ) ) {
|
2898 |
$initial_data = stripslashes( $results[0]->body );
|
2899 |
}
|
2900 |
+
|
2901 |
+
$initial_data = str_replace ( "My document title", "", $initial_data );
|
2902 |
wp_editor(
|
2903 |
$initial_data,
|
2904 |
'woocommerce_ac_email_body',
|
2911 |
),
|
2912 |
)
|
2913 |
);
|
2914 |
+
|
2915 |
?>
|
2916 |
<?php echo stripslashes( get_option( 'woocommerce_ac_email_body' ) ); ?>
|
2917 |
<span class="description">
|
2940 |
}
|
2941 |
}
|
2942 |
</script>
|
2943 |
+
|
2944 |
<tr>
|
2945 |
<th>
|
2946 |
<label for="is_wc_template"><b><?php _e( 'Use WooCommerce Template Style:', 'woocommerce-abandoned-cart' ); ?></b></label>
|
2947 |
</th>
|
2948 |
<td>
|
2949 |
<?php
|
2950 |
+
$is_wc_template = "";
|
2951 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->is_wc_template ) ) {
|
2952 |
$use_wc_template = $results[0]->is_wc_template;
|
2953 |
+
|
2954 |
if ( '1' == $use_wc_template ) {
|
2955 |
$is_wc_template = "checked";
|
2956 |
} else {
|
2958 |
}
|
2959 |
}
|
2960 |
print'<input type="checkbox" name="is_wc_template" id="is_wc_template" ' . $is_wc_template . '> </input>'; ?>
|
2961 |
+
<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-abandoned-cart' ) ; ?> >
|
2962 |
+
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-abandoned-cart' ) ; ?>>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.
|
2963 |
</td>
|
2964 |
</tr>
|
2965 |
+
|
2966 |
<tr>
|
2967 |
<th>
|
2968 |
<label for="wcal_wc_email_header"><b><?php _e( 'Email Template Header Text: ', 'woocommerce-abandoned-cart' ); ?></b></label>
|
2970 |
<td>
|
2971 |
|
2972 |
<?php
|
2973 |
+
|
2974 |
+
$wcal_wc_email_header = "";
|
2975 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->wc_email_header ) ) {
|
2976 |
$wcal_wc_email_header = $results[0]->wc_email_header;
|
2977 |
+
}
|
2978 |
if ( '' == $wcal_wc_email_header ) {
|
2979 |
$wcal_wc_email_header = "Abandoned cart reminder";
|
2980 |
}
|
2981 |
print'<input type="text" name="wcal_wc_email_header" id="wcal_wc_email_header" class="regular-text" value="' . $wcal_wc_email_header . '">'; ?>
|
2982 |
<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-abandoned-cart' ) ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
|
2983 |
</td>
|
2984 |
+
</tr>
|
2985 |
+
|
2986 |
<tr>
|
2987 |
<th>
|
2988 |
<label for="woocommerce_ac_email_frequency"><b><?php _e( 'Send this email:', 'woocommerce-abandoned-cart' ); ?></b></label>
|
2993 |
$frequency_edit = "";
|
2994 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->frequency ) ) {
|
2995 |
$frequency_edit = $results[0]->frequency;
|
2996 |
+
}
|
2997 |
for ( $i = 1; $i < 4; $i++ ) {
|
2998 |
printf( "<option %s value='%s'>%s</option>\n",
|
2999 |
selected( $i, $frequency_edit, false ),
|
3000 |
esc_attr( $i ),
|
3001 |
$i
|
3002 |
);
|
3003 |
+
}
|
3004 |
+
?>
|
3005 |
</select>
|
3006 |
|
3007 |
+
<select name="day_or_hour" id="day_or_hour">
|
3008 |
<?php
|
3009 |
$days_or_hours_edit = "";
|
3010 |
if ( 'edittemplate' == $mode && count( $results ) > 0 && isset( $results[0]->day_or_hour ) )
|
3011 |
{
|
3012 |
$days_or_hours_edit = $results[0]->day_or_hour;
|
3013 |
+
}
|
3014 |
$days_or_hours = array(
|
3015 |
'Days' => 'Day(s)',
|
3016 |
'Hours' => 'Hour(s)'
|
3024 |
);
|
3025 |
}
|
3026 |
?>
|
3027 |
+
</select>
|
3028 |
<span class="description">
|
3029 |
<?php _e( 'after cart is abandoned.', 'woocommerce-abandoned-cart' ); ?>
|
3030 |
</span>
|
3031 |
</td>
|
3032 |
</tr>
|
3033 |
+
|
3034 |
<tr>
|
3035 |
<th>
|
3036 |
<label for="woocommerce_ac_email_preview"><b><?php _e( 'Send a test email to:', 'woocommerce-abandoned-cart' ); ?></b></label>
|
3037 |
</th>
|
3038 |
+
<td>
|
3039 |
<input type="text" id="send_test_email" name="send_test_email" class="regular-text" >
|
3040 |
<input type="button" value="Send a test email" id="preview_email" onclick="javascript:void(0);">
|
3041 |
<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-abandoned-cart') ?>' src="<?php echo plugins_url(); ?>/woocommerce/assets/images/help.png" />
|
3042 |
<div id="preview_email_sent_msg" style="display:none;"></div>
|
3043 |
</td>
|
3044 |
+
</tr>
|
3045 |
</table>
|
3046 |
</div>
|
3047 |
</div>
|
3048 |
</div>
|
3049 |
<p class="submit">
|
3050 |
<?php
|
3051 |
+
$button_value = __( "Save Changes", 'woocommerce-abandoned-cart' );
|
3052 |
if ( 'edittemplate' == $mode ) {
|
3053 |
+
$button_value = __( "Update Changes", 'woocommerce-abandoned-cart' );
|
3054 |
}
|
3055 |
?>
|
3056 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e( $button_value ); ?>" />
|
3057 |
</p>
|
3058 |
</form>
|
3059 |
</div>
|
3060 |
+
<?php
|
3061 |
+
}
|
3062 |
}
|
3063 |
+
|
3064 |
/**
|
3065 |
* It will add the footer text for the plugin.
|
3066 |
* @hook admin_footer_text
|
3071 |
function wcal_admin_footer_text( $footer_text ) {
|
3072 |
|
3073 |
if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'woocommerce_ac_page' ) {
|
3074 |
+
$footer_text = __( 'If you love <strong>Abandoned Cart Lite for WooCommerce</strong>, then please leave us a <a href="https://wordpress.org/support/plugin/woocommerce-abandoned-cart/reviews/?rate=5#new-post" target="_blank" class="ac-rating-link" data-rated="Thanks :)">★★★★★</a> rating. Thank you in advance. :)', 'woocommerce-abandoned-cart' );
|
|
|
3075 |
wc_enqueue_js( "
|
3076 |
jQuery( 'a.ac-rating-link' ).click( function() {
|
3077 |
jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
|
3078 |
});
|
3079 |
+
" );
|
3080 |
+
}
|
3081 |
return $footer_text;
|
3082 |
}
|
3083 |
+
|
3084 |
/**
|
3085 |
* It will sort the record for the product reports tab.
|
3086 |
* @param array $unsort_array Unsorted array
|
3088 |
* @return array $array
|
3089 |
* @since 2.6
|
3090 |
*/
|
3091 |
+
function bubble_sort_function( $unsort_array, $order ) {
|
3092 |
$temp = array();
|
3093 |
foreach ( $unsort_array as $key => $value )
|
3094 |
+
$temp[ $key ] = $value; //concatenate something unique to make sure two equal weights don't overwrite each other
|
3095 |
asort( $temp, SORT_NUMERIC ); // or ksort( $temp, SORT_NATURAL ); see paragraph above to understand why
|
3096 |
+
|
3097 |
if ( 'desc' == $order ) {
|
3098 |
$array = array_reverse( $temp, true );
|
3099 |
} else if ( $order == 'asc' ) {
|
3102 |
unset( $temp );
|
3103 |
return $array;
|
3104 |
}
|
3105 |
+
|
3106 |
/**
|
3107 |
* It will be called when we send the test email from the email edit page.
|
3108 |
* @hook wp_ajax_wcal_preview_email_sent
|
3109 |
* @since 1.0
|
3110 |
+
*/
|
3111 |
function wcal_action_send_preview() {
|
3112 |
?>
|
3113 |
<script type="text/javascript" >
|
3114 |
jQuery( document ).ready( function( $ )
|
3115 |
{
|
3116 |
$( "table#addedit_template input#preview_email" ).click( function()
|
3117 |
+
{
|
3118 |
var email_body = '';
|
3119 |
if ( jQuery("#wp-woocommerce_ac_email_body-wrap").hasClass( "tmce-active" ) ) {
|
3120 |
email_body = tinyMCE.get('woocommerce_ac_email_body').getContent();
|
3123 |
}
|
3124 |
var subject_email_preview = $( '#woocommerce_ac_email_subject' ).val();
|
3125 |
var body_email_preview = email_body;
|
3126 |
+
var send_email_id = $( '#send_test_email' ).val();
|
3127 |
+
var is_wc_template = document.getElementById( "is_wc_template" ).checked;
|
3128 |
+
var wc_template_header = $( '#wcal_wc_email_header' ).val() != '' ? $( '#wcal_wc_email_header' ).val() : 'Abandoned cart reminder';
|
3129 |
+
var data = {
|
3130 |
subject_email_preview: subject_email_preview,
|
3131 |
body_email_preview : body_email_preview,
|
3132 |
send_email_id : send_email_id,
|
3206 |
* It will replace the test email data with the static content.
|
3207 |
* @return string email sent | not sent
|
3208 |
* @since 1.0
|
3209 |
+
*/
|
3210 |
function wcal_preview_email_sent() {
|
3211 |
if ( '' != $_POST['body_email_preview'] ) {
|
3212 |
$from_email_name = get_option ( 'wcal_from_name' );
|
3213 |
$reply_name_preview = get_option ( 'wcal_from_email' );
|
3214 |
$from_email_preview = get_option ( 'wcal_reply_email' );
|
3215 |
$subject_email_preview = stripslashes ( $_POST['subject_email_preview'] );
|
3216 |
+
$subject_email_preview = convert_smilies ( $subject_email_preview );
|
3217 |
+
$subject_email_preview = str_replace( '{{customer.firstname}}', 'John', $subject_email_preview );
|
3218 |
$body_email_preview = convert_smilies ( $_POST['body_email_preview'] );
|
3219 |
$is_wc_template = $_POST['is_wc_template'];
|
3220 |
$wc_template_header = stripslashes( $_POST['wc_template_header'] );
|
3221 |
|
3222 |
+
$body_email_preview = str_replace( '{{customer.firstname}}', 'John', $body_email_preview );
|
3223 |
$body_email_preview = str_replace( '{{customer.firstname}}', 'John', $body_email_preview );
|
3224 |
$body_email_preview = str_replace( '{{customer.lastname}}', 'Doe', $body_email_preview );
|
3225 |
$body_email_preview = str_replace( '{{customer.fullname}}', 'John'." ".'Doe', $body_email_preview );
|
3227 |
$date_format = date_i18n( get_option( 'date_format' ), $current_time_stamp );
|
3228 |
$time_format = date_i18n( get_option( 'time_format' ), $current_time_stamp );
|
3229 |
$test_date = $date_format . ' ' . $time_format;
|
3230 |
+
$body_email_preview = str_replace( '{{cart.abandoned_date}}', $test_date, $body_email_preview );
|
3231 |
$cart_url = wc_get_page_permalink( 'cart' );
|
3232 |
$body_email_preview = str_replace( '{{cart.link}}', $cart_url, $body_email_preview );
|
3233 |
+
$body_email_preview = str_replace( '{{cart.unsubscribe}}', '#', $body_email_preview );
|
3234 |
$wcal_price = wc_price( '100' );
|
3235 |
$wcal_total_price = wc_price( '200' );
|
3236 |
if ( class_exists( 'WP_Better_Emails' ) ) {
|
3248 |
</tr>
|
3249 |
<tr align="center">
|
3250 |
<td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/assets/images/shoes.jpg"/></td>
|
3251 |
+
<td>'.__( "Men's Formal Shoes", 'woocommerce-abandoned-cart' ).'</td>
|
3252 |
<td>1</td>
|
3253 |
<td>' . $wcal_price . '</td>
|
3254 |
<td>' . $wcal_price . '</td>
|
3255 |
</tr>
|
3256 |
<tr align="center">
|
3257 |
<td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/assets/images/handbag.jpg"/></td>
|
3258 |
+
<td>'.__( "Woman's Hand Bags", 'woocommerce-abandoned-cart' ).'</td>
|
3259 |
<td>1</td>
|
3260 |
<td>' . $wcal_price . '</td>
|
3261 |
<td>' . $wcal_price . '</td>
|
3283 |
</tr>
|
3284 |
<tr align="center">
|
3285 |
<td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/assets/images/shoes.jpg"/></td>
|
3286 |
+
<td>'.__( "Men's Formal Shoes", 'woocommerce-abandoned-cart' ).'</td>
|
3287 |
<td>1</td>
|
3288 |
<td>' . $wcal_price . '</td>
|
3289 |
<td>' . $wcal_price . '</td>
|
3290 |
</tr>
|
3291 |
<tr align="center">
|
3292 |
<td><img class="demo_img" width="42" height="42" src="'.plugins_url().'/woocommerce-abandoned-cart/assets/images/handbag.jpg"/></td>
|
3293 |
+
<td>'.__( "Woman's Hand Bags", 'woocommerce-abandoned-cart' ).'</td>
|
3294 |
<td>1</td>
|
3295 |
<td>' . $wcal_price . '</td>
|
3296 |
<td>' . $wcal_price . '</td>
|
3303 |
<td>' . $wcal_total_price . '</td>
|
3304 |
</tr>
|
3305 |
</table>';
|
3306 |
+
}
|
3307 |
+
$body_email_preview = str_replace( '{{products.cart}}', $var, $body_email_preview );
|
3308 |
if ( isset( $_POST['send_email_id'] ) ) {
|
3309 |
$to_email_preview = $_POST['send_email_id'];
|
3310 |
} else {
|
3311 |
$to_email_preview = "";
|
3312 |
+
}
|
3313 |
+
$user_email_from = get_option( 'admin_email' );
|
3314 |
$body_email_final_preview = stripslashes( $body_email_preview );
|
3315 |
+
|
3316 |
if ( isset( $is_wc_template ) && 'true' == $is_wc_template ) {
|
3317 |
ob_start();
|
3318 |
// Get email heading
|
3319 |
wc_get_template( 'emails/email-header.php', array( 'email_heading' => $wc_template_header ) );
|
3320 |
+
$email_body_template_header = ob_get_clean();
|
3321 |
+
|
3322 |
+
ob_start();
|
3323 |
+
wc_get_template( 'emails/email-footer.php' );
|
3324 |
+
$email_body_template_footer = ob_get_clean();
|
3325 |
|
|
|
|
|
|
|
|
|
3326 |
$final_email_body = $email_body_template_header . $body_email_final_preview . $email_body_template_footer;
|
3327 |
|
3328 |
+
$site_title = get_bloginfo( 'name' );
|
3329 |
+
$email_body_template_footer = str_replace( '{site_title}', $site_title, $email_body_template_footer );
|
3330 |
+
|
3331 |
+
wc_mail( $to_email_preview, $subject_email_preview, $final_email_body , $headers );
|
3332 |
}
|
3333 |
else {
|
3334 |
wp_mail( $to_email_preview, $subject_email_preview, stripslashes( $body_email_preview ), $headers );
|
3335 |
+
}
|
3336 |
echo "email sent";
|
3337 |
die();
|
3338 |
} else {
|
3340 |
die();
|
3341 |
}
|
3342 |
}
|
3343 |
+
}
|
3344 |
+
}
|
3345 |
$woocommerce_abandon_cart = new woocommerce_abandon_cart_lite();
|
3346 |
?>
|