connect_error) { die("Connection failed: " . $conn->connect_error); } $conn->set_charset("utf8mb4"); // Pagination $limit = 9; $page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1; $search = isset($_GET['search']) ? trim($_GET['search']) : ''; $start = ($page - 1) * $limit; // Build query $where_conditions = ["s.status=1"]; $params = []; $types = ""; if (!empty($search)) { $where_conditions[] = "(s.scooter_name LIKE ? OR s.scooter_headline LIKE ? OR s.scooter_description LIKE ?)"; $search_param = "%$search%"; $params = array_merge($params, [$search_param, $search_param, $search_param]); $types .= "sss"; } // Count total $count_query = "SELECT COUNT(DISTINCT s.scooter_id) as total FROM scooters s WHERE " . implode(" AND ", $where_conditions); $stmt = $conn->prepare($count_query); if (!empty($params)) { $stmt->bind_param($types, ...$params); } $stmt->execute(); $total = $stmt->get_result()->fetch_assoc()['total']; $stmt->close(); $pages = max(1, ceil($total / $limit)); // Get scooters for current page with colors and images $query = "SELECT s.*, (SELECT MIN(price) FROM scooter_colors WHERE scooter_id = s.scooter_id) as min_price, (SELECT MAX(price) FROM scooter_colors WHERE scooter_id = s.scooter_id) as max_price, (SELECT COUNT(*) FROM scooter_colors WHERE scooter_id = s.scooter_id) as color_count, (SELECT sc.color_code FROM scooter_colors sc WHERE sc.scooter_id = s.scooter_id LIMIT 1) as first_color, (SELECT si.image_path FROM scooter_colors sc LEFT JOIN scooter_images si ON sc.color_id = si.color_id AND si.is_primary = 1 WHERE sc.scooter_id = s.scooter_id LIMIT 1) as primary_image FROM scooters s WHERE " . implode(" AND ", $where_conditions) . " ORDER BY s.scooter_id DESC LIMIT ?, ?"; $stmt = $conn->prepare($query); if (!empty($params)) { $stmt->bind_param($types . "ii", ...array_merge($params, [$start, $limit])); } else { $stmt->bind_param("ii", $start, $limit); } $stmt->execute(); $result = $stmt->get_result(); $scooters = []; if ($result && $result->num_rows > 0) { while ($row = $result->fetch_assoc()) { // Get all colors for this scooter $color_sql = "SELECT color_name, color_code, price FROM scooter_colors WHERE scooter_id = ? ORDER BY price"; $color_stmt = $conn->prepare($color_sql); $color_stmt->bind_param("i", $row['scooter_id']); $color_stmt->execute(); $color_result = $color_stmt->get_result(); $row['colors'] = []; while ($color = $color_result->fetch_assoc()) { $row['colors'][] = $color; } $color_stmt->close(); $scooters[] = $row; } } $stmt->close(); // WhatsApp number $whatsapp_number = "919345994249"; ?> TVS Scooters - Premium Collection | Vijai TVS
Opening WhatsApp...
PREMIUM COLLECTION 2024

Discover Your Perfect Ride

Experience the perfect blend of style, performance, and comfort with our exclusive range of TVS scooters

50K+
Happy Riders
200+
Service Centers
15+
Award Winning

Premium Models

query("SELECT COUNT(DISTINCT color_name) as cnt FROM scooter_colors")->fetch_assoc()['cnt']; ?>

Color Options

15+

Industry Awards

50k+

Happy Customers

Our Collection

Premium Scooter Range

$scooter): ?>
Bestseller
prepare($img_sql); $img_stmt->bind_param("i", $scooter['scooter_id']); $img_stmt->execute(); $img_result = $img_stmt->get_result(); if ($img_result && $img_result->num_rows > 0) { $img = $img_result->fetch_assoc(); $image_path = "uploads/scooters/colors/" . $img['image_path']; if (file_exists($image_path)) { $display_image = $image_path; } } $img_stmt->close(); } ?> <?php echo htmlspecialchars($scooter['scooter_name']); ?>
Color Options

Available Colors:
5): ?>
+ more colors
Starting from
- ₹
1): ?>

No Scooters Found

We couldn't find any scooters matching your search criteria. Try adjusting your search.

Ready for Your Test Ride?

Experience the thrill of TVS scooters firsthand. Book your test ride today!

Schedule Your Ride
close(); ?>