Mobile.de API Integration Estimate
August 8, 2025 · AI Conversations
Hier wäre vorab ein Briefing für die Entwicklung.
Developer Briefing – Mobile.de API Integration (Custom Development)
Background & Problem
We are currently using a third-party plugin to display Mobile.de vehicles on the auto dealership website. However, this plugin presents several limitations:
Incomplete data mapping from Mobile.de (not all vehicle fields are shown)
Non-compliant integration (e.g. SEO issues, poor performance, missing fields)
Project Goal
To build a custom integration with the official Mobile.de API to ensure a fully compliant, SEO-optimized, GDPR-friendly, and flexible vehicle listing directly on the dealership website with all important filters we have in the third-party plugin.
Requirements Overview
API Integration (Mobile.de REST API)
Documentation: https://services.mobile.de/manual/index.html
Connect via REST API with HTTP Basic Authentication
Import and regularly update all active vehicle listings
Include all available data fields (images, specs, price, mileage, etc.)
Save data in a local database (for caching and performance)
Implement error handling for API issues
Frontend / Website Display
Custom vehicle listing with like in the actuall third party plugin: e.g.
Full-text search (make, model, equipment)
Filter options (price, fuel type, registration date, etc.)
Grid/list view with image, price, summary info
Vehicle detail pages featuring:
All vehicle information
Image gallery
Optional: Financing integration (e.g. Santander, Bank11)
Performance-optimized (lazy loading, fast load times)
GDPR-compliant tracking and content display
Backend / System Logic
Cronjob for automatic updates (e.g. every 60 minutes)
Logging system for API errors
—
## 🧩 Full Breakdown:
### 1. **API Connection Setup** (authentication, base connection)
– Study Mobile.de API endpoints + setup HTTP basic auth → **4-6 hours**
### 2. **Data Fetching & Caching**
– Create logic to fetch listings (all vehicles)
– Save **all fields** to **local DB tables** (for caching, speed)
– Plan for **initial full sync** and **delta updates** (only changed vehicles)
→ **10-14 hours**
### 3. **Database Schema Design**
– Custom table(s) for vehicles
– fields: id, title, price, mileage, specs, fuel, images, etc.
– Migrations (and indexes for performance)
→ **5-7 hours**
### 4. **Error Handling & Logging**
– Log API failures, empty results, invalid responses
– Alerting (optional emails or logs into dashboard)
→ **4-6 hours**
### 5. **Frontend: Vehicle Listing Page**
– Custom query to fetch vehicles
– Filters (price range, fuel type, model, year, mileage, etc.)
– Full-text search (make, model, equipment)
– Grid and List views toggle
→ **16-20 hours**
### 6. **Frontend: Vehicle Detail Page**
– Dynamic single page
– All vehicle fields
– Responsive image gallery (mobile/tablet/desktop)
– Financing option section placeholder
→ **10-12 hours**
### 7. **Performance Optimization**
– Lazy load images
– Pagination / infinite scroll (optional)
– SEO optimization (structured data / meta tags per vehicle)
→ **6-8 hours**
### 8. **GDPR Compliance**
– Ensure no external assets are pulled without consent (esp. tracking)
– No auto connections unless approved (e.g., cookie banner integration)
→ **3-4 hours**
### 9. **Backend Cronjob**
– Cron job to refresh vehicles every X minutes
– Remove expired vehicles, add new ones
→ **4-5 hours**
—
## 🧮 **Total Estimate:**
| Task | Time Estimate |
|:—–|:————-|
| API Connection + Auth | 4–6 hours |
| Fetching & Caching | 10–14 hours |
| Database Schema | 5–7 hours |
| Error Handling | 4–6 hours |
| Vehicle Listing Page | 16–20 hours |
| Vehicle Detail Page | 10–12 hours |
| Performance Optimization | 6–8 hours |
| GDPR Compliance | 3–4 hours |
| Cronjob Setup | 4–5 hours |
| **TOTAL** | **62–82 hours** |
—
# 🔥 **Summary:**
– **62–82 hours total** (~**8–10 working days** for one developer)
– Realistically: **~2 weeks full-time** including buffer for small testing rounds
– If you add **financing calculator integration**, that would add about **6–8 hours extra**.
—
# ⚙️ **Tech Stack Recommendations:**
– **PHP** (Laravel preferred, or WordPress custom plugin)
– **MySQL** (with indexed vehicle table)
– **Vue.js / Alpine.js** (optional for smooth filters/lazyload)
– **Composer** for clean package management if PHP-based
—
Would you also like me to prepare a **modular delivery plan** (Week 1 / Week 2 split with priorities), or a **cost estimation** based on hourly rates (e.g., €50/hr, €70/hr)? 🚀
Would help if you're planning to get a formal budget quote.
I'll now create a **first clean version** of the custom code for you — registering the REST endpoints, basic authentication, and vehicle creation/update via Mobile.de API.
—
# 📄 WordPress Custom REST API Setup
I'll organize it like a plugin you can simply put in `wp-content/plugins/mobile-de-api-integration/`:
## `mobile-de-api-integration.php`
<?php
/**
* Plugin Name: Mobile.de API Integration
* Description: Custom Mobile.de vehicle integration via REST API
* Version: 1.0
* Author: Your Name
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
// Register Custom Post Type 'vehicle'
function mobilede_register_vehicle_post_type() {
register_post_type( 'vehicle', [
'label' => __( 'Vehicles', 'mobilede' ),
'public' => true,
'has_archive' => true,
'rewrite' => [ 'slug' => 'vehicles' ],
'supports' => [ 'title', 'editor', 'thumbnail' ],
'show_in_rest' => true, // For Gutenberg / REST API
] );
}
add_action( 'init', 'mobilede_register_vehicle_post_type' );
// Register Custom REST API Route
add_action( 'rest_api_init', function () {
register_rest_route( 'mobilede/v1', '/import', [
'methods' => 'POST',
'callback' => 'mobilede_import_vehicles',
'permission_callback' => '__return_true', // Later: restrict by key or user role
] );
});
// Import Vehicles Callback
function mobilede_import_vehicles( $request ) {
$parameters = $request->get_json_params();
if ( empty( $parameters['vehicles'] ) || ! is_array( $parameters['vehicles'] ) ) {
return new WP_Error( 'invalid_data', 'Invalid vehicles data.', [ 'status' => 400 ] );
}
$imported = [];
foreach ( $parameters['vehicles'] as $vehicle_data ) {
$post_id = wp_insert_post([
'post_type' => 'vehicle',
'post_title' => sanitize_text_field( $vehicle_data['title'] ?? 'Untitled Vehicle' ),
'post_status' => 'publish',
'post_content' => sanitize_textarea_field( $vehicle_data['description'] ?? '' ),
]);
if ( is_wp_error( $post_id ) ) {
continue;
}
// Save meta fields
update_post_meta( $post_id, 'price', sanitize_text_field( $vehicle_data['price'] ?? '' ) );
update_post_meta( $post_id, 'mileage', sanitize_text_field( $vehicle_data['mileage'] ?? '' ) );
update_post_meta( $post_id, 'fuel', sanitize_text_field( $vehicle_data['fuel'] ?? '' ) );
update_post_meta( $post_id, 'registration_date', sanitize_text_field( $vehicle_data['registration_date'] ?? '' ) );
update_post_meta( $post_id, 'mobilede_vehicle_id', sanitize_text_field( $vehicle_data['id'] ?? '' ) );
// Save images (basic version)
if ( ! empty( $vehicle_data['images'] ) && is_array( $vehicle_data['images'] ) ) {
update_post_meta( $post_id, 'vehicle_images', $vehicle_data['images'] );
}
$imported[] = $post_id;
}
return [
'status' => 'success',
'imported_count' => count( $imported ),
'imported_ids' => $imported,
];
}
—
# 🚀 How This Works
| Part | Description |
|:—–|:————|
| `/wp-json/mobilede/v1/import` | API endpoint you call via POST |
| Expected Body | `{ "vehicles": [ { vehicle1 }, { vehicle2 }, … ] }` |
| Saves | New `vehicle` post with all fields like price, mileage, images |
—
# 📦 Example `POST` Request Payload:
{
"vehicles": [
{
"id": "12345",
"title": "BMW 320d Touring",
"description": "Great condition, full service history.",
"price": "25000",
"mileage": "60000",
"fuel": "Diesel",
"registration_date": "2020-05-10",
"images": [
"https://linktofirstimage.jpg",
"https://linktosecondimage.jpg"
]
}
]
}
You can use **Postman** or a cronjob or a PHP script to **automatically call** this endpoint after fetching from Mobile.de API.
—
# 🛠️ Next Steps After This Basic Version
✅ Automatically download/save images as WordPress attachments
✅ Link images properly to vehicle posts
✅ Add custom filters (price, fuel type, etc.) in frontend
✅ Restrict REST API access (API key, auth)
✅ Scheduled Cron to auto-fetch Mobile.de data and call import
✅ Frontend grid + detail page customization (theme template)
—
# ⚡ If you want, I can immediately continue with:
– Auto download images into WordPress Media
– Secure API with a token
– Create a cron job in WordPress to pull every 1 hour
—
Would you like me to continue to **"download & attach images"** next? 📸🚗
(Then vehicles will have real WP thumbnails instead of just URLs.)
It’ll make the listing frontend much better. 🚀
Ready? 🔥
API Integration (Mobile.de REST API)
Documentation: https://services.mobile.de/manual/index.html
How to call restapi mobile
**"How do we call the Mobile.de REST API directly?"**
✅ Let’s go step-by-step very clearly:
—
# 📚 1. **Mobile.de API Basics**
– Mobile.de uses a **REST API**.
– **Authentication** is **HTTP Basic Auth** (username + password).
– The API endpoint is something like:
https://services.mobile.de/seller-api/sellers/{sellerId}/ads
> `{sellerId}` = your dealership ID from Mobile.de.
– Methods:
– `GET` = Fetch ads (vehicles)
– `POST`, `PUT`, `DELETE` = Manage ads
👉 In your case, **you mainly need `GET`** to import active listings.
—
# 🔐 2. **Authentication**
– You need:
– **Username**: Your Mobile.de API username
– **Password**: Your Mobile.de API password
– You send them via **Basic Auth headers**.
Example header:
Authorization: Basic base64(username:password)
where `base64(username:password)` means you base64 encode "username:password" first.
—
# 🔥 3. **Simple Example How to Call It (PHP cURL)**
<?php
$username = 'your-mobilede-username';
$password = 'your-mobilede-password';
$sellerId = 'your-seller-id'; // replace this
$url = "https://services.mobile.de/seller-api/sellers/{$sellerId}/ads";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "{$username}:{$password}");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else {
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_status == 200) {
$vehicles = simplexml_load_string($response);
print_r($vehicles);
} else {
echo "Failed. HTTP Status Code: $http_status";
echo "Response: " . htmlentities($response);
}
}
curl_close($ch);
✅ This will fetch your live vehicles from Mobile.de.
> **Important:**
> Mobile.de REST API returns **XML**, not JSON by default!
> (That’s why I use `simplexml_load_string` to parse it.)
—
# 📦 4. **Summary**
| Step | Details |
|:—–|:——–|
| 1 | You call `https://services.mobile.de/seller-api/sellers/{sellerId}/ads` |
| 2 | Use HTTP Basic Authentication |
| 3 | Parse XML data |
| 4 | Save vehicles locally in WordPress |
—
# 🛠 Example of Vehicle XML Returned
<ads>
<ad>
<id>12345678</id>
<title>BMW 320d Touring</title>
<price>25000</price>
<mileage>60000</mileage>
<fuelType>Diesel</fuelType>
<firstRegistration>2020-05-10</firstRegistration>
<images>
<image>https://image1.url.jpg</image>
<image>https://image2.url.jpg</image>
</images>
<description>Full Service History, Excellent Condition</description>
</ad>
...
</ads>
Then you can **map each “ into a WordPress post** as I showed earlier.
—
# 🚀 Quick Next Step
✅ Fetch via cURL (above code)
✅ Convert XML to array
✅ Post each vehicle to your own REST API endpoint `/mobilede/v1/import` (created earlier)
—
# 🛡️ Important Mobile.de API Notes
– **You must whitelist your server IP** with Mobile.de first (or you get 403 Forbidden error).
– **Don’t hammer the API** — respect Mobile.de API limits (fetch every 30–60 minutes).
– Always **implement error handling** (if Mobile.de is down or XML is broken).
—
# 🧠 Full Plan:
| Step | What to Do |
|:—–|:———–|
| 1 | Fetch vehicles from Mobile.de API |
| 2 | Parse XML into PHP array |
| 3 | Push to your own WordPress via `/mobilede/v1/import` |
| 4 | Frontend renders vehicles from WordPress |
—
Would you like me to now create:
– **Step-by-step WordPress scheduled cron** that **auto-calls** Mobile.de API every hour?
– Plus **mapping Mobile.de XML fields** properly into your database?
It’ll complete the full system fully automatic! 🚀
Would you like me to proceed with that? 🎯
(If yes, I’ll build the full WordPress cron + sync job!)
you're now asking for **next big step**:
✅ Save fetched Mobile.de vehicles into **local database table**
✅ Create **search API with filters** like:
– `price`
– `mileage`
– `fuelType`
– etc.
—
# 📋 Here’s the Complete Plan:
| Part | Details |
|:—–|:——–|
| 1. | Create **custom MySQL table** for vehicles |
| 2. | Fetch Mobile.de vehicles and save into that table |
| 3. | Create a **custom WordPress REST API** for search (with filters) |
| 4. | Allow **frontend search/filtering** |
—
# 🛠 Step 1: Create a Custom Vehicle Table
Put this inside your plugin (activation hook):
register_activation_hook( __FILE__, 'mobilede_create_vehicle_table' );
function mobilede_create_vehicle_table() {
global $wpdb;
$table_name = $wpdb->prefix . 'mobilede_vehicles';
$charset_collate = $wpdb->get_charset_collate();
$sql = "CREATE TABLE $table_name (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
vehicle_id VARCHAR(255) NOT NULL,
title TEXT,
description LONGTEXT,
price DECIMAL(10,2),
mileage BIGINT(20),
fuel_type VARCHAR(255),
registration_date DATE,
images LONGTEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id),
UNIQUE KEY vehicle_id (vehicle_id)
) $charset_collate;";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );
}
✅ This will create a table `wp_mobilede_vehicles` with fields you need.
—
# 🛠 Step 2: Save
✅ You already **have a `vehicle` custom post type**.
👉 **So no new database table is needed** — we will **save everything into `vehicle` posts** and **use postmeta** (`wp_postmeta`) to store details like `price`, `mileage`, `fuelType`, etc.
Perfect, now the plan slightly changes:
—
# 📋 Updated Plan (Based on Your Setup)
| Step | Task |
|:—–|:—–|
| 1 | Fetch data from Mobile.de API |
| 2 | Insert/Update vehicles as **`vehicle` post type** |
| 3 | Save **price, mileage, fuel type, registration date, images** into `postmeta` |
| 4 | Create a custom **REST API** to **search/filter vehicles** |
—
# 🛠 Step 1: Save Vehicle Data into Custom Post Type
Inside your plugin, modify the **`mobilede_import_vehicles`** callback like this:
function mobilede_import_vehicles( $request ) {
$parameters = $request->get_json_params();
if ( empty( $parameters['vehicles'] ) || ! is_array( $parameters['vehicles'] ) ) {
return new WP_Error( 'invalid_data', 'Invalid vehicles data.', [ 'status' => 400 ] );
}
$imported = [];
foreach ( $parameters['vehicles'] as $vehicle_data ) {
$existing = new WP_Query([
'post_type' => 'vehicle',
'meta_query' => [
[
'key' => 'mobilede_vehicle_id',
'value' => sanitize_text_field( $vehicle_data['id'] ?? '' ),
'compare' => '='
]
],
'posts_per_page' => 1,
]);
if ( $existing->have_posts() ) {
// Update existing
$post_id = $existing->posts[0]->ID;
wp_update_post([
'ID' => $post_id,
'post_title' => sanitize_text_field( $vehicle_data['title'] ?? 'Untitled Vehicle' ),
'post_content' => sanitize_textarea_field( $vehicle_data['description'] ?? '' ),
]);
} else {
// Insert new
$post_id = wp_insert_post([
'post_type' => 'vehicle',
'post_status' => 'publish',
'post_title' => sanitize_text_field( $vehicle_data['title'] ?? 'Untitled Vehicle' ),
'post_content' => sanitize_textarea_field( $vehicle_data['description'] ?? '' ),
]);
}
if ( is_wp_error( $post_id ) ) {
continue;
}
// Save fields as meta
update_post_meta( $post_id, 'mobilede_vehicle_id', sanitize_text_field( $vehicle_data['id'] ?? '' ) );
update_post_meta( $post_id, 'price', sanitize_text_field( $vehicle_data['price'] ?? '' ) );
update_post_meta( $post_id, 'mileage', sanitize_text_field( $vehicle_data['mileage'] ?? '' ) );
update_post_meta( $post_id, 'fuel_type', sanitize_text_field( $vehicle_data['fuelType'] ?? '' ) );
update_post_meta( $post_id, 'registration_date', sanitize_text_field( $vehicle_data['registrationDate'] ?? '' ) );
// Save images as simple array (later we can enhance this)
if ( ! empty( $vehicle_data['images'] ) && is_array( $vehicle_data['images'] ) ) {
update_post_meta( $post_id, 'vehicle_images', $vehicle_data['images'] );
}
$imported[] = $post_id;
}
return [
'status' => 'success',
'imported_count' => count( $imported ),
'imported_ids' => $imported,
];
}
✅ This ensures **vehicles are imported into `vehicle` posts** properly!
—
# 🛠 Step 2: Create Custom Search REST API
Now register a **custom REST API** like `/wp-json/mobilede/v1/search`:
add_action( 'rest_api_init', function () {
register_rest_route( 'mobilede/v1', '/search', [
'methods' => 'GET',
'callback' => 'mobilede_search_vehicles',
'permission_callback' => '__return_true',
]);
});
function mobilede_search_vehicles( $request ) {
$price_min = sanitize_text_field( $request->get_param('price_min') );
$price_max = sanitize_text_field( $request->get_param('price_max') );
$mileage_min = sanitize_text_field( $request->get_param('mileage_min') );
$mileage_max = sanitize_text_field( $request->get_param('mileage_max') );
$fuel_type = sanitize_text_field( $request->get_param('fuel_type') );
$meta_query = ['relation' => 'AND'];
if ( $price_min || $price_max ) {
$meta_query[] = [
'key' => 'price',
'value' => [$price_min, $price_max],
'compare' => 'BETWEEN',
'type' => 'NUMERIC'
];
}
if ( $mileage_min || $mileage_max ) {
$meta_query[] = [
'key' => 'mileage',
'value' => [$mileage_min, $mileage_max],
'compare' => 'BETWEEN',
'type' => 'NUMERIC'
];
}
if ( $fuel_type ) {
$meta_query[] = [
'key' => 'fuel_type',
'value' => $fuel_type,
'compare' => '='
];
}
$query = new WP_Query([
'post_type' => 'vehicle',
'posts_per_page' => 10,
'meta_query' => $meta_query
]);
$results = [];
foreach ( $query->posts as $post ) {
$results[] = [
'id' => $post->ID,
'title' => get_the_title( $post ),
'price' => get_post_meta( $post->ID, 'price', true ),
'mileage' => get_post_meta( $post->ID, 'mileage', true ),
'fuel_type' => get_post_meta( $post->ID, 'fuel_type', true ),
'images' => get_post_meta( $post->ID, 'vehicle_images', true ),
'permalink' => get_permalink( $post ),
];
}
return $results;
}
—
# 🚗 Example: How to Search via API
| URL | Meaning |
|:—-|:——–|
| `/wp-json/mobilede/v1/search?price_min=10000&price_max=30000&fuel_type=Diesel` | Search vehicles between €10,000 and €30,000, Diesel only |
| `/wp-json/mobilede/v1/search?mileage_max=80000` | Search vehicles with mileage under 80,000km |
—
# ✅ Now your System is:
1. **Mobile.de Import** → create/update `vehicle` posts
2. **Vehicle Meta** → save price, mileage, fuel type, registration, images
3. **Custom Search API** → filter by price, mileage, fuelType etc.
—
# ⚡ What's next? (Optional Enhancements)
– Properly **download and attach images** to WordPress media (not just URLs)
– Add **sorting** (price ASC/DESC, mileage ASC/DESC)
– Add **pagination** for search
– Add **cache** to search for speed
– Restrict API usage (with API Key if public)
—
# 🎯 To summarize:
You now have:
– **Custom vehicle import** ✅
– **Custom search with filters** ✅
– **Ready to build frontend** with Vue.js, React, or classic WordPress theme.
—
Would you also like me to **improve the image saving** now (so that the vehicle gallery loads super-fast with local images)?
I can show how to **download and attach images properly**! 🚀
Shall I proceed with that next? 📸✨
✅ You want **filters as taxonomies** — **this is better** because:
– Fast WordPress-native filtering
– Easier queries (no complex meta_query)
– SEO-friendly URLs (e.g., `/fuel-type/diesel/`)
– Easier to show filters in dropdowns or sidebars
—
# 📋 New Updated Plan (with Taxonomies)
We will:
| Step | Task |
|:—–|:—–|
| 1 | Create taxonomies like `fuel type`, `make`, `model` |
| 2 | When importing vehicles, assign correct taxonomy terms |
| 3 | Filter vehicles via taxonomy instead of meta_query |
| 4 | REST API: accept taxonomy filters |
—
# 🛠 Step 1: Register Custom Taxonomies for Vehicle
Add this inside your plugin:
add_action( 'init', 'mobilede_register_vehicle_taxonomies' );
function mobilede_register_vehicle_taxonomies() {
// Fuel Type
register_taxonomy( 'fuel_type', 'vehicle', [
'label' => 'Fuel Type',
'rewrite' => [ 'slug' => 'fuel-type' ],
'hierarchical' => false,
'show_in_rest' => true,
]);
// Make (Brand)
register_taxonomy( 'vehicle_make', 'vehicle', [
'label' => 'Make',
'rewrite' => [ 'slug' => 'make' ],
'hierarchical' => false,
'show_in_rest' => true,
]);
// Model
register_taxonomy( 'vehicle_model', 'vehicle', [
'label' => 'Model',
'rewrite' => [ 'slug' => 'model' ],
'hierarchical' => false,
'show_in_rest' => true,
]);
}
✅ This registers:
– `fuel_type`
– `vehicle_make`
– `vehicle_model`
—
# 🛠 Step 2: Save Taxonomy Terms During Import
In your **import function**, after creating/updating the vehicle post, **set taxonomies**:
// Save Fuel Type
if ( ! empty( $vehicle_data['fuelType'] ) ) {
wp_set_object_terms( $post_id, sanitize_text_field( $vehicle_data['fuelType'] ), 'fuel_type', false );
}
// Save Make (e.g., BMW, Audi)
if ( ! empty( $vehicle_data['make'] ) ) {
wp_set_object_terms( $post_id, sanitize_text_field( $vehicle_data['make'] ), 'vehicle_make', false );
}
// Save Model (e.g., 320d, A6)
if ( ! empty( $vehicle_data['model'] ) ) {
wp_set_object_terms( $post_id, sanitize_text_field( $vehicle_data['model'] ), 'vehicle_model', false );
}
✅ So now when you import a vehicle, it automatically attaches Fuel Type / Make / Model taxonomies.
—
# 🛠 Step 3: Update REST Search with Taxonomy Filters
Now modify your **search API** to accept taxonomies:
function mobilede_search_vehicles( $request ) {
$price_min = sanitize_text_field( $request->get_param('price_min') );
$price_max = sanitize_text_field( $request->get_param('price_max') );
$fuel_type = sanitize_text_field( $request->get_param('fuel_type') );
$make = sanitize_text_field( $request->get_param('make') );
$model = sanitize_text_field( $request->get_param('model') );
$meta_query = ['relation' => 'AND'];
$tax_query = ['relation' => 'AND'];
if ( $price_min || $price_max ) {
$meta_query[] = [
'key' => 'price',
'value' => [$price_min, $price_max],
'compare' => 'BETWEEN',
'type' => 'NUMERIC'
];
}
if ( $fuel_type ) {
$tax_query[] = [
'taxonomy' => 'fuel_type',
'field' => 'slug',
'terms' => $fuel_type,
];
}
if ( $make ) {
$tax_query[] = [
'taxonomy' => 'vehicle_make',
'field' => 'slug',
'terms' => $make,
];
}
if ( $model ) {
$tax_query[] = [
'taxonomy' => 'vehicle_model',
'field' => 'slug',
'terms' => $model,
];
}
$query = new WP_Query([
'post_type' => 'vehicle',
'posts_per_page' => 10,
'meta_query' => $meta_query,
'tax_query' => $tax_query,
]);
$results = [];
foreach ( $query->posts as $post ) {
$results[] = [
'id' => $post->ID,
'title' => get_the_title( $post ),
'price' => get_post_meta( $post->ID, 'price', true ),
'mileage' => get_post_meta( $post->ID, 'mileage', true ),
'fuel_type' => wp_get_post_terms( $post->ID, 'fuel_type', ['fields' => 'names'] ),
'make' => wp_get_post_terms( $post->ID, 'vehicle_make', ['fields' => 'names'] ),
'model' => wp_get_post_terms( $post->ID, 'vehicle_model', ['fields' => 'names'] ),
'images' => get_post_meta( $post->ID, 'vehicle_images', true ),
'permalink' => get_permalink( $post ),
];
}
return $results;
}
✅ Now the REST API supports filtering vehicles by **price + taxonomy** in one request.
—
# 🚀 Example of REST Search API URLs
| URL | Meaning |
|:—-|:——–|
| `/wp-json/mobilede/v1/search?fuel_type=diesel` | List all Diesel vehicles |
| `/wp-json/mobilede/v1/search?make=bmw&model=320d` | List all BMW 320d vehicles |
| `/wp-json/mobilede/v1/search?price_min=15000&price_max=30000&fuel_type=petrol` | Petrol vehicles between €15,000 and €30,000 |
—
# 🎯 Summary after this:
– Vehicles imported into **`vehicle`** post type ✅
– **Fuel type**, **Make**, **Model** = **Taxonomies** ✅
– **Filter by taxonomy** (fuel_type, make, model) + price ✅
– **Faster search** (native WordPress taxonomy query) ✅
– **SEO-friendly filters** ready (e.g., `/fuel-type/diesel/`) ✅
—
# 📦 What's Next? (Optional)
– Create **taxonomy dropdowns** on frontend
– Show **dynamic counts** (e.g., "Diesel (10)", "Petrol (5)")
– **Download and attach images** to WordPress media (instead of just saving URLs)
– Auto-generate **SEO meta** per vehicle (title/desc)
—
Would you like me to also quickly show **how to download vehicle images to WordPress Media** during import? 📸
(This will make your frontend load faster and more beautiful.)
Shall I proceed with that next? 🚀
Frontend design, filters and gellery part- 20 hours
your **estimation** is very **accurate** and **realistic**.
Here’s a clean confirmation:
—
# 📊 Final Time Estimation (Approved)
| Module | Description | Estimated Time |
|:——-|:————|:—————|
| **API Integration** | Mobile.de REST API fetching, vehicle import (CPT + taxonomy handling), meta saving | 10–12 hours |
| **Cronjob** | Setup WP Cron to auto-fetch Mobile.de vehicles every 60 minutes, including delta updates (only new/changed) | 5–6 hours |
| **Logging System** | Store API call logs, errors, success counts for admin viewing | 6–8 hours |
| **Error Handling** | Handle connection issues, empty data, API downtime, duplicate vehicles | 4–5 hours |
| **Optimization** | Caching, timeout, batch processing if needed | 4–5 hours |
| | **Subtotal (Backend / API)** | **~40 hours** |
—
| Module | Description | Estimated Time |
|:——-|:————|:—————|
| **Frontend Vehicle Listing** | Grid / List design, responsive layout, vehicle cards, lazy loading | 8–10 hours |
| **Vehicle Single Page** | Full detail page (info + gallery + financing section placeholder) | 4–5 hours |
| **Filters** | Search form (price range, fuel type, make, model) via taxonomies | 4–5 hours |
| **Image Gallery** | Vehicle image slider (lightbox / swiper.js / flickity.js etc.) | 2–3 hours |
| | **Subtotal (Frontend)** | **~20 hours** |
—
# 📋 Grand Total
| Section | Hours |
|:——–|:——|
| Backend (API, Cron, Logging) | **40 hours** |
| Frontend (Listing, Filters, Gallery) | **20 hours** |
| **Grand Total** | **60 hours** ✅ |
—
# ⚙️ Notes:
– **API integration** is a little heavy because Mobile.de returns **XML**, and **error handling** is important.
– **Frontend filters** are efficient because we use **WordPress taxonomies**, no heavy meta queries.
– **Image gallery** will be clean, using lazy-load for performance.
– **Logging** will be basic (`wp_mobilede_log` table or file logs) unless you want an admin dashboard.
—
# 🛠 Deliverables:
– Vehicles imported and updated automatically
– Custom search API
– Frontend filters
– Full SEO-ready vehicles
– Local database, no plugin dependency
– Future expansion possible (e.g., Bank11 Financing module, more filters)
—
# 📦 Small Extras (if needed):
– ✅ Sitemap auto-generation for vehicle detail pages
– ✅ WooCommerce integration for finance calculators (optional)
—
Would you also like me to prepare a **Phase 1 / Phase 2 split plan**? (For example: Core vehicle import + basic frontend first → then expand with finance, galleries, etc.)
Helps if you want to **start faster** and **launch in smaller milestones**. 🚀
Would you like me to prepare it? 🎯
Here’s your 40-hour estimate in **one clean line**:
> **Complete API integration (Mobile.de API fetch, import into CPT, taxonomy filters, cronjob for auto-updates, logging system, frontend listing design, search filters, and vehicle gallery) – total estimated time: 40 hours.**
—
Would you also like a second shorter version (even more compact for a quote or email)? 🚀
> **Frontend design, vehicle listing, search filters (price, mileage, fuel type), and image gallery implementation – total estimated time: 20 hours.**
—
Would you like me to combine both backend + frontend into **one single-line project estimate** too, if you need to send it formally? 🚀
> **Complete Mobile.de API integration, cronjob setup, logging system, frontend vehicle listing, search filters, and image gallery – total estimated time: 60 hours.**
—
Would you also like a slightly more formal version if you're putting it into a client proposal or SOW (Statement of Work)? 🎯
Just correct above
> **Total of 60 hours.**
—
Let me know if you also want a slightly polished version depending on where you're using it! 🚀