Changeset 3279369
- Timestamp:
- 04/22/2025 06:38:15 PM (11 months ago)
- Location:
- cart-tracking-for-woocommerce/trunk
- Files:
-
- 3 edited
-
admin/admin.php (modified) (2 diffs)
-
cart-tracking.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cart-tracking-for-woocommerce/trunk/admin/admin.php
r3252296 r3279369 118 118 $ids = ( isset( $cart ) ? $cart : array() ); 119 119 if ( is_array( $ids ) ) { 120 $ids = implode( ',', $ids ); 120 // $ids = implode(',', $ids); 121 // $id_array = array_filter(array_map('intval', explode(',', $raw_ids))); // sanitize IDs 122 $ids = array_map( 'intval', $cart ); 123 // sanitize every element 124 } else { 125 // split string by comma, sanitize, and remove empty values 126 $ids = array_filter( array_map( 'intval', explode( ',', $cart ) ) ); 121 127 } 122 128 if ( !empty( $ids ) ) { 123 $ids = sanitize_text_field( $ids ); 124 $wpdb->query( "DELETE FROM {$table_cart_name} WHERE id IN({$ids})" ); 125 $wpdb->query( "DELETE FROM {$table_name} WHERE cart_number IN({$ids})" ); 129 //$ids = sanitize_text_field($ids); 130 $placeholders = implode( ',', array_fill( 0, count( $ids ), '%d' ) ); 131 $wpdb->query( $wpdb->prepare( "DELETE FROM {$table_cart_name} WHERE id IN({$placeholders})", ...$ids ) ); 132 $wpdb->query( $wpdb->prepare( "DELETE FROM {$table_name} WHERE cart_number IN({$placeholders})", ...$ids ) ); 126 133 } 127 134 //wp_die('Items deleted!'); … … 190 197 } 191 198 } 199 if ( isset( $results[$key]['customer_id'] ) && is_string( $results[$key]['customer_id'] ) && filter_var( $results[$key]['customer_id'], FILTER_VALIDATE_IP ) && class_exists( '\\WC_Geolocation' ) ) { 200 $geolocation = new \WC_Geolocation(); 201 $user_ip = filter_var( $results[$key]['customer_id'], FILTER_VALIDATE_IP ); 202 $location = $geolocation->geolocate_ip( $user_ip ); 203 // Get geolocation data 204 $country = ( isset( $location['country'] ) ? $location['country'] : '' ); 205 if ( $country ) { 206 $results[$key]['customer_id'] = $results[$key]['customer_id'] . ' (Country: ' . $country . ')'; 207 } 208 } 192 209 } 193 210 $total_items = $wpdb->get_var( "SELECT COUNT(*) FROM {$table_cart_name}" ); -
cart-tracking-for-woocommerce/trunk/cart-tracking.php
r3252296 r3279369 5 5 * Plugin URI: https://wpsimpleplugins.wordpress.com/ 6 6 * Description: Keep track of what people are adding or removing from their cart. See top added/removed products. 7 * Version: 1.0.1 77 * Version: 1.0.18 8 8 * Author: Simple Plugins 9 9 * Author URI: https://wpsimpleplugins.wordpress.com/ -
cart-tracking-for-woocommerce/trunk/readme.txt
r3252296 r3279369 4 4 Requires at least: 4.0 5 5 Tested up to: 6.7 6 Stable tag: 1.0.1 76 Stable tag: 1.0.18 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.