function pp_generate_insights(){ global $wpdb; $prices = $wpdb->prefix . 'pp_prices'; $products = $wpdb->prefix . 'pp_products'; $stores = $wpdb->prefix . 'pp_stores'; $clicks = $wpdb->prefix . 'pp_clicks'; $insights = []; // Total clicks per store $store_clicks = $wpdb->get_results(" SELECT s.store_name, COUNT(c.id) as total FROM $clicks c JOIN $stores s ON c.store_id = s.id GROUP BY c.store_id ORDER BY total DESC "); if($store_clicks){ $top = $store_clicks[0]; $insights[] = "🔥 {$top->store_name} is your top performing store."; } // Products with zero clicks $dead_products = $wpdb->get_results(" SELECT p.name FROM $products p LEFT JOIN $clicks c ON p.id = c.product_id WHERE c.id IS NULL "); foreach($dead_products as $dp){ $insights[] = "⚠ {$dp->name} has zero clicks."; } // Products with no price $no_price = $wpdb->get_results(" SELECT pr.name FROM $products pr LEFT JOIN $prices p ON pr.id = p.product_id WHERE p.price IS NULL OR p.price = 0 GROUP BY pr.id "); foreach($no_price as $np){ $insights[] = "💸 {$np->name} missing price data."; } return $insights; } Plastic – pricepair.in

Plastic

Filter
Added to wishlistRemoved from wishlist 0
Add to compare
- 22%
Buy HP Victus 15-FA1411TX Intel Core i7 12th Gen Gaming Laptop (16GB, 512GB SSD, Windows 11 Home, 4GB Graphics, 15.6 inch 144 Hz Full HD IPS Display, NVIDIA GeForce RTX 3050, MS Office Home & Student 2021, Performance Blue, 2.29 KG) Online - Croma

HP Victus 15-FA1411TX Intel Core i7 12th Gen Gaming Laptop

Original price was: ₹91,543.00.Current price is: ₹71,490.00.
Added to wishlistRemoved from wishlist 0
Add to compare
- 9%
Buy OnePlus Nord Buds 3 Pro TWS Earbuds with Active Noise Cancellation (IP55 Water Resistant, Fast Charging, Starry Black) Online - Croma

OnePlus Nord Buds 3 Pro TWS Earbuds with Active Noise Cancellation

Original price was: ₹3,299.00.Current price is: ₹2,999.00.
pricepair.in
Logo
Compare items
  • Total (0)
Compare
0