Check if products exist. $aiflt_checkout_detector_data = AIFLT_Funnel_Analyzer_Logic::get_checkout_field_data(); $aiflt_funnel_data = AIFLT_Funnel_Analyzer_Logic::get_funnel_data(); // Fetch initial funnel data $aiflt_page_speed_data = AIFLT_Funnel_Analyzer_Logic::get_page_speed_alerts(); } else { // If WooCommerce is inactive, provide safe, default values to prevent warnings. $aiflt_dashboard_metrics = [ 'total_sessions' => 'N/A', 'conversion_rate' => 'N/A', 'abandoned_carts' => 'N/A', 'page_speed' => 'N/A', 'last_updated' => __('WooCommerce is inactive', 'ai-flash-tune'), ]; $aiflt_top_drop_off_metrics = [ 'page_name' => 'N/A', 'drop_off_rate' => '0', 'ai_insights' => __('Activate WooCommerce to get AI insights.', 'ai-flash-tune'), 'rage_clicks' => '0', 'scroll_stops' => '0', 'quick_bounces' => '0', 'basic_suggestion' => __('Suggestions require live data from WooCommerce. Please activate the plugin to get started.', 'ai-flash-tune'), // ---> This line was already added, ensure it's present. ]; $aiflt_ai_report = [ 'report' => __('AI report requires live data from WooCommerce.', 'ai-flash-tune'), 'next_available' => '0', ]; $aiflt_low_performing_products = []; $aiflt_has_products = false; // ---> NEW: Set default for has_products. $aiflt_checkout_detector_data = [ 'css_class' => 'ai-flash-tune-text-gray-500', 'icon_class' => 'fas fa-question-circle', 'message' => __('Requires WooCommerce', 'ai-flash-tune'), 'status' => 'N/A', ]; $aiflt_funnel_data = ['is_empty' => true]; $aiflt_page_speed_data = ['status' => 'no_data', 'alerts' => []]; // 'no_data' status prevents the warning box from showing. } $aiflt_core_pro_features = [ [ 'name' => __('Abandoned Cart Recovery Bot', 'ai-flash-tune'), 'description' => __('Automated email reminders with customizable flows to recover lost sales.', 'ai-flash-tune'), 'icon' => 'fas fa-robot', 'is_installed' => true, 'is_active' => true, ], [ 'name' => __('Full AI Drop-Off Analysis', 'ai-flash-tune'), 'description' => __('Get deep AI insights explaining why users drop off, analyzing speed, UX, trust, and more.', 'ai-flash-tune'), 'icon' => 'fas fa-brain', 'is_installed' => true, 'is_active' => false, ], [ 'name' => __('Smart Fix Suggestions Engine', 'ai-flash-tune'), 'description' => __('Receive personalized AI suggestions to fix product copy, CTAs and layout.', 'ai-flash-tune'), 'icon' => 'fas fa-magic', 'is_installed' => false, 'is_active' => false, ], [ 'name' => __('AI Checkout Optimizer', 'ai-flash-tune'), 'description' => __('The AI suggests and can apply a simplified checkout UX with fewer fields and trust boosters.', 'ai-flash-tune'), 'icon' => 'fas fa-cash-register', 'is_installed' => false, 'is_active' => false, ], [ 'name' => __('Cart Abandon Reason Predictor', 'ai-flash-tune'), 'description' => __('Uses AI to detect likely causes for abandonment like shipping costs or form issues.', 'ai-flash-tune'), 'icon' => 'fas fa-search-dollar', 'is_installed' => false, 'is_active' => false, ], [ 'name' => __('Product Performance Doctor', 'ai-flash-tune'), 'description' => __('Suggests fixes for poor-performing products based on user behavior, not just traffic.', 'ai-flash-tune'), 'icon' => 'fas fa-stethoscope', 'is_installed' => true, 'is_active' => true, ], [ 'name' => __('AI Product Copy Enhancer', 'ai-flash-tune'), 'description' => __('Rewrites product titles and descriptions based on sales psychology to boost conversions.', 'ai-flash-tune'), 'icon' => 'fas fa-pencil-alt', 'is_installed' => false, 'is_active' => false, ], [ 'name' => __('Funnel Segmentation Dashboard', 'ai-flash-tune'), 'description' => __('Filter funnel data by user type, and more for deeper insights.', 'ai-flash-tune'), 'icon' => 'fas fa-filter', 'is_installed' => true, 'is_active' => false, ], [ 'name' => __('1-Click Fix Apply', 'ai-flash-tune'), 'description' => __('Apply AI-recommended fixes to your store with one click (e.g., CTA rewrite, layout tweak).', 'ai-flash-tune'), 'icon' => 'fas fa-mouse-pointer', 'is_installed' => false, 'is_active' => false, ], ]; // ---> NEW: Filter for uninstalled features and prepare the display logic $aiflt_uninstalled_features = []; foreach ($aiflt_core_pro_features as $aiflt_feature) { if (!$aiflt_feature['is_installed']) { $aiflt_uninstalled_features[] = $aiflt_feature; } } $aiflt_show_view_all_link = count($aiflt_uninstalled_features) > 3; $aiflt_features_to_show = array_slice($aiflt_uninstalled_features, 0, 3); ?>
%
s
  • : ' . esc_html($aiflt_alert['speed']) . 's' ); ?>

0 ) : ?>
(% )

' . esc_html__( 'No report generated yet. Click ', 'ai-flash-tune' ) . '' . esc_html__( 'Generate Now', 'ai-flash-tune' ) . '' . esc_html__( ' to get your first analysis.', 'ai-flash-tune' ) . ''; } ?>

0) { ?>