=== AutoGrid – Make Model Year ===
Contributors: zahoorkhan
Tags: car, automotive, csv-import, csv-export
Donate link: https://profiles.wordpress.org/zahoorkhan/
Requires at least: 5.8
Tested up to: 7.0
Stable tag: 1.0.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manage car Make, Model, and Year data with bulk CSV import/export supporting 100,000+ records.

== Description ==

**AutoGrid – Make Model Year** is a lightweight yet powerful plugin that lets you store, manage, search, and export vehicle data (Make → Model → Year) directly from your WordPress dashboard.

= Key Features =

* Custom database table for high-performance storage
* Add, edit, and delete car Makes, Models, and Years
* **Bulk Export to CSV** — handles 100,000+ records using chunked streaming (no PHP memory limit issues)
* **Bulk Import via CSV** — import large datasets with batch processing
* Search and filter from the admin list view
* Pagination for large datasets
* REST API endpoints for headless and external access
* Shortcode to display a vehicle selector on the frontend
* WP-CLI commands for server-side operations
* Compatible with WordPress Multisite
* No external dependencies — pure WordPress APIs

= How It Works =

The plugin creates a dedicated database table with proper indexes for fast queries, even with 1,000,000+ rows. Export uses PHP output buffering with chunked streaming so it never loads all records into memory. Import processes rows in configurable batches for reliability.

= Shortcode =

Display a cascading vehicle selector on any page:

`[car_selector]`

Optional attributes:

`[car_selector show_year="true" show_search="true" redirect="/results/"]`

= REST API =

Full REST API under the `cmmy/v1` namespace:

* `GET /wp-json/cmmy/v1/vehicles` — List vehicles (paginated)
* `GET /wp-json/cmmy/v1/makes` — List all unique makes
* `GET /wp-json/cmmy/v1/models?make=Toyota` — List models for a make
* `GET /wp-json/cmmy/v1/years?make=Toyota&model=Corolla` — List years
* `POST /PUT /DELETE` endpoints for authenticated users

== Installation ==

1. Upload the `autogrid-make-model-year` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. A new **Car Data** menu item will appear in your admin sidebar.

On activation, the plugin automatically creates a custom database table for vehicle storage.

== Frequently Asked Questions ==

= Will this slow down my site? =

No. The plugin only loads its scripts and styles on its own admin pages and on pages that use the `[car_selector]` shortcode. It has zero frontend impact otherwise.

= Can I import duplicate entries? =

By default, duplicates (same make + model + year) are skipped during import. You can allow duplicates in **Car Data → Settings**.

= What is the maximum number of records supported? =

The plugin has been tested with 500,000 records. Export and import work via chunking, so there is no hard limit.

= Does it work with WooCommerce or other plugins? =

Yes. The plugin is self-contained and does not conflict with WooCommerce, Elementor, or other popular plugins.

= Can I use WP-CLI for large imports? =

Yes. Use `wp cmmy import /path/to/file.csv --batch=1000` for server-side imports that avoid browser timeout issues.

== Screenshots ==

1. Admin list view — paginated table with Make, Model, Year columns and search bar.
2. Add New form — simple form to add a single vehicle entry.
3. Export page — filter options and Export Now button.
4. Import page — file upload with progress summary.
5. Frontend shortcode — vehicle selector dropdown rendered on a page.

== Changelog ==

= 1.0.0 =
* Initial release
* Custom database table with indexed columns
* Admin CRUD interface with pagination and search
* Chunked CSV export for large datasets
* Batch CSV import with validation
* REST API (read and write)
* `[car_selector]` shortcode
* WP-CLI support
* Multisite compatible

== Upgrade Notice ==

= 1.0.0 =
Initial release. No upgrade steps required.
