Changeset 2975548
- Timestamp:
- 10/06/2023 12:03:48 PM (2 years ago)
- Location:
- pushalert-web-push-notifications/trunk
- Files:
-
- 2 edited
-
pushalert.php (modified) (9 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pushalert-web-push-notifications/trunk/pushalert.php
r2908671 r2975548 6 6 * Author: PushAlert 7 7 * Author URI: https://pushalert.co 8 * Version: 2.8. 08 * Version: 2.8.1 9 9 */ 10 10 … … 923 923 924 924 function pa_custom_updated_cart(){ 925 $total_items = sizeof( WC()->cart->get_cart());925 $total_items = WC()->cart->get_cart_contents_count(); 926 926 if(current_filter()=="woocommerce_cart_item_removed" && $total_items==0){ 927 927 //handled by woocommerce_cart_is_empty … … 940 940 function pa_custom_cart_quantity_zero($cart_item_key){ 941 941 942 $total_items = sizeof( WC()->cart->get_cart());942 $total_items = WC()->cart->get_cart_contents_count(); 943 943 if($total_items-1>0){ 944 944 //pa_clear_abandoned_cart(); … … 1032 1032 } 1033 1033 1034 if(get_option('pushalert_large_image', 0)){ 1035 $user_info['image'] = pushalert_get_product_image_url(); 1036 } 1037 1038 $user_info['total_items'] = (!$total_items ? sizeof(WC()->cart->get_cart()) : $total_items); 1034 $product_info = pushalert_get_cart_product_info(); 1035 if(get_option('pushalert_large_image', 0) && $product_info['image']!=""){ 1036 $user_info['image'] = $product_info['image']; 1037 } 1038 $user_info['product_name'] = $product_info['title']; 1039 1040 $user_info['total_items'] = (!$total_items ? WC()->cart->get_cart_contents_count() : $total_items); 1039 1041 $pa_check_cookie = filter_input(INPUT_COOKIE, 'pushalert_'.pa_encrypt($curr_user->ID, get_option('pushalert_encrypt_key'))); 1040 1042 if($curr_user->ID!=0 && isset($pa_check_cookie) && $pa_check_cookie=='1'){ … … 1051 1053 } 1052 1054 1053 function pushalert_get_product_image_url(){ 1055 function pushalert_get_cart_product_info(){ 1056 $titles = []; 1054 1057 $images = []; 1055 1058 if (!WC()->cart->is_empty()) { … … 1057 1060 $_product = $cart_item['data']; 1058 1061 //$link = $_product->get_permalink(); 1059 //$title = $_product->get_title();1062 $title = $_product->get_title(); 1060 1063 //$price = $_product->get_price(); 1061 1064 $image_id = $_product->get_image_id(); … … 1068 1071 } 1069 1072 $images[] = $image; 1073 $titles[] = $title; 1070 1074 } 1071 1075 } 1072 1076 1073 1077 if (count($images) > 0) { 1074 return $images[array_rand($images)]; 1078 $sel_index = array_rand($images); 1079 return array("title"=>$titles[$sel_index], "image"=>$images[$sel_index]); 1075 1080 } else { 1076 return "";1081 return array("title"=>"", "image"=>""); 1077 1082 } 1078 1083 } … … 1241 1246 1242 1247 global $woocommerce; 1243 $total_items = sizeof( WC()->cart->get_cart());1248 $total_items = WC()->cart->get_cart_contents_count(); 1244 1249 if($total_item>0){ 1245 1250 pa_clear_abandoned_cart(); … … 1284 1289 1285 1290 global $woocommerce; 1286 $total_items = sizeof( WC()->cart->get_cart());1291 $total_items = WC()->cart->get_cart_contents_count(); 1287 1292 if($total_items>0){ 1288 1293 pa_clear_abandoned_cart(); -
pushalert-web-push-notifications/trunk/readme.txt
r2943849 r2975548 5 5 Requires at least: 2.7 6 6 Tested up to: 6.3 7 Stable tag: 2.8. 07 Stable tag: 2.8.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 84 84 85 85 == Changelog == 86 87 = 2.8.1 = 88 * Added support for Product Name in abandoned cart notifications. 86 89 87 90 = 2.8.0 =
Note: See TracChangeset
for help on using the changeset viewer.