Changeset 2858781
- Timestamp:
- 02/02/2023 07:12:19 AM (3 years ago)
- Location:
- cartfox
- Files:
-
- 9 added
- 2 edited
-
tags/2.9.6 (added)
-
tags/2.9.6/CartFox.php (added)
-
tags/2.9.6/assets (added)
-
tags/2.9.6/assets/cf-universe.svg (added)
-
tags/2.9.6/assets/cf_logo.png (added)
-
tags/2.9.6/assets/icon-256x256.png (added)
-
tags/2.9.6/assets/select2.min.css (added)
-
tags/2.9.6/assets/select2.min.js (added)
-
tags/2.9.6/readme.txt (added)
-
trunk/CartFox.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cartfox/trunk/CartFox.php
r2855785 r2858781 4 4 Description: Dynamic SMS abandoned cart reminders with coupons, post-purchase campaigns and various options for SMS campaigns. Available for 25 languages worldwide. 5 5 Author: CartFox 6 Version: 2.9. 56 Version: 2.9.6 7 7 */ 8 8 9 9 define('CARTFOX_INTEGRATION_PLATFORM', "WooCommerce"); 10 define('CARTFOX_INTEGRATION_VERSION', "2.9. 5");10 define('CARTFOX_INTEGRATION_VERSION', "2.9.6"); 11 11 12 12 function cartfox_add_integration_to_payload($payload){ … … 26 26 <script type="text/javascript"> 27 27 28 function setCookie(key, value, expiry) { 29 var expires = new Date(); 30 expires.setTime(expires.getTime() + (expiry * 24 * 60 * 60 * 1000)); 31 document.cookie = key + '=' + value + ';path=/;expires=' + expires.toUTCString(); 32 } 33 34 function getCookie(key) { 35 var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)'); 36 return keyValue ? keyValue[2] : null; 37 } 38 39 var cm_ajax_running = false; 40 var cm_ajax_queue = false; 41 jQuery(function($){ 42 $('.woocommerce-billing-fields input, .woocommerce-billing-fields select').on('change', function () { 43 44 45 var billing_inputs = $("input[name^=billing_], select[name^=billing_]"); 46 var cm_data = []; 47 $.each(billing_inputs, function(i, e){ 48 49 if(e.name == "billing_cf_optin"){ 50 e.value = 0; 51 if($(e).is(':checked')){ 52 e.value = 1; 28 29 var script_timeout = 0; 30 if(document.getElementById("fc-wrapper")) script_timeout = 2000; 31 setTimeout(function(){ 32 function setCookie(key, value, expiry) { 33 var expires = new Date(); 34 expires.setTime(expires.getTime() + (expiry * 24 * 60 * 60 * 1000)); 35 document.cookie = key + '=' + value + ';path=/;expires=' + expires.toUTCString(); 36 } 37 38 function getCookie(key) { 39 var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)'); 40 return keyValue ? keyValue[2] : null; 41 } 42 43 var cm_ajax_running = false; 44 var cm_ajax_queue = false; 45 46 var plugins_additional_selectors = ", .woocommerce-checkout input, .woocommerce-checkout select, .woocommerce-checkout textarea"; 47 48 jQuery(function($){ 49 $('.woocommerce-billing-fields input, .woocommerce-billing-fields select, .woocommerce-billing-fields textarea' + plugins_additional_selectors).on('change', function () { 50 var billing_inputs = $("input[name^=billing_], select[name^=billing_], input[name^=shipping_], select[name^=shipping_]"); 51 var cm_data = []; 52 $.each(billing_inputs, function(i, e){ 53 54 if(e.name == "billing_cf_optin"){ 55 e.value = 0; 56 if($(e).is(':checked')){ 57 e.value = 1; 58 } 53 59 } 60 61 cm_data[i] = {"key": e.name, "value": e.value}; 62 }); 63 64 var data = { 65 action: 'cartfox_send_data', 66 cm_data: cm_data, 67 }; 68 69 ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ) ?>'; 70 71 if($("input[name=billing_phone]").val() != ""){ 72 $.ajax({ 73 type: "POST", 74 url: ajaxurl, 75 data: data, 76 beforeSend: function() { 77 if(cm_ajax_running == true){ 78 console.log("CartFox: Request already running"); 79 cm_ajax_queue = true; 80 return false; 81 } 82 83 cm_ajax_running = true; 84 }, 85 success: function(response) { 86 var cm_response = JSON.parse(response); 87 if(cm_response.msg) console.log(cm_response.msg); 88 else console.log(cm_response); 89 if(cm_response.sid){ 90 if(!getCookie('cf_sid')){ 91 setCookie('cf_sid',cm_response.sid,'3'); 92 } 93 localStorage.setItem("cf_sid", cm_response.sid); 94 } 95 cm_ajax_running = false; 96 if(cm_ajax_queue == true){ 97 console.log("CartFox: Queue running"); 98 cm_ajax_queue = false; 99 $("input[name=billing_phone]").trigger("change"); 100 } 101 } 102 }); 103 104 //jQuery.post(ajaxurl, data, function(response) { 105 // console.log(JSON.parse(response)); 106 //}); 54 107 } 55 56 cm_data[i] = {"key": e.name, "value": e.value};57 108 }); 58 109 59 var data = { 60 action: 'cartfox_send_data', 61 cm_data: cm_data, 62 }; 63 64 ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ) ?>'; 65 66 if($("input[name=billing_phone]").val() != ""){ 67 $.ajax({ 68 type: "POST", 69 url: ajaxurl, 70 data: data, 71 beforeSend: function() { 72 if(cm_ajax_running == true){ 73 console.log("CartFox: Request already running"); 74 cm_ajax_queue = true; 75 return false; 76 } 77 78 cm_ajax_running = true; 79 }, 80 success: function(response) { 81 var cm_response = JSON.parse(response); 82 if(cm_response.msg) console.log(cm_response.msg); 83 else console.log(cm_response); 84 if(cm_response.sid){ 85 if(!getCookie('cf_sid')){ 86 setCookie('cf_sid',cm_response.sid,'3'); 87 } 88 localStorage.setItem("cf_sid", cm_response.sid); 89 } 90 cm_ajax_running = false; 91 if(cm_ajax_queue == true){ 92 console.log("CartFox: Queue running"); 93 cm_ajax_queue = false; 94 $("input[name=billing_phone]").trigger("change"); 95 } 96 } 97 }); 98 99 //jQuery.post(ajaxurl, data, function(response) { 100 // console.log(JSON.parse(response)); 101 //}); 110 if(document.getElementById("fc-wrapper")){ 111 $("input[name=billing_phone]").trigger("change"); 102 112 } 103 113 }); 104 } );114 }, script_timeout); 105 115 </script> 106 116 <?php -
cartfox/trunk/readme.txt
r2855785 r2858781 6 6 Tested up to: 6.1.1 7 7 Requires PHP: 5.6 8 Stable tag: 2.9. 58 Stable tag: 2.9.6 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 70 70 71 71 == Changelog == 72 = 2.9.6 = 73 * Added support for checkout plugin! 74 72 75 = 2.9.5 = 73 76 * Compatible with the latest WooCommerce version!
Note: See TracChangeset
for help on using the changeset viewer.