4.2 KiB
Magento Category Migration Tool
This Laravel application provides a web-based interface to migrate categories from Magento 1 to Magento 2 with multi-store support.
Features
- ✅ Multi-store category migration
- ✅ Web-based user interface
- ✅ Real-time migration progress
- ✅ Database connection testing
- ✅ Category preview before migration
- ✅ Detailed migration logs
Setup
1. Database Configuration
Add the following environment variables to your .env file:
# Magento 1 Database
MAGENTO1_DB_HOST=127.0.0.1
MAGENTO1_DB_PORT=3306
MAGENTO1_DB_DATABASE=magento1
MAGENTO1_DB_USERNAME=root
MAGENTO1_DB_PASSWORD=your_password
MAGENTO1_DB_PREFIX=
# Magento 2 Database
MAGENTO2_DB_HOST=127.0.0.1
MAGENTO2_DB_PORT=3306
MAGENTO2_DB_DATABASE=magento2
MAGENTO2_DB_USERNAME=root
MAGENTO2_DB_PASSWORD=your_password
MAGENTO2_DB_PREFIX=
2. Access the Migration Interface
Once your Laravel application is running, navigate to:
http://your-domain/migration
Or if using DDEV:
https://migrate.ddev.site/migration
Usage
1. Test Database Connections
Click the "Test Connections" button to verify that both Magento 1 and Magento 2 databases are accessible.
2. Map Stores
For each Magento 1 store, select the corresponding Magento 2 store from the dropdown menu. This mapping determines which store view the category attributes will be migrated to.
3. Preview Categories (Optional)
Click "Preview Categories" to see a list of categories that will be migrated from Magento 1.
4. Start Migration
Click "Start Migration" to begin the migration process. The tool will:
- Migrate category structure (parent-child relationships)
- Migrate category attributes (name, URL key, is_active) for each mapped store
- Preserve category hierarchy and positions
- Generate detailed migration logs
How It Works
Category Migration Process
- Category Structure: The tool reads all categories from Magento 1 and builds a tree structure
- Level-by-Level Migration: Categories are migrated level by level, ensuring parent categories exist before child categories
- Attribute Migration: For each store mapping, category attributes (name, URL key, is_active) are migrated to the corresponding Magento 2 store view
- Path Building: Category paths are automatically built to maintain the correct hierarchy
Database Tables Used
Magento 1:
catalog_category_entity- Category entitiescatalog_category_entity_varchar- Category text attributescatalog_category_entity_int- Category integer attributescore_store- Store informationeav_attribute- Attribute definitionseav_entity_type- Entity type definitions
Magento 2:
catalog_category_entity- Category entitiescatalog_category_entity_varchar- Category text attributescatalog_category_entity_int- Category integer attributesstore- Store informationeav_attribute- Attribute definitionseav_entity_type- Entity type definitions
Important Notes
⚠️ Backup First: Always backup your Magento 2 database before running the migration.
⚠️ Test Environment: It's recommended to test the migration on a development/staging environment first.
⚠️ Store Mapping: Ensure that store mappings are correct. Incorrect mappings may result in categories being assigned to the wrong store views.
⚠️ Root Category: The tool assumes Magento 2's root category ID is 2 (default). If your setup uses a different root category ID, you may need to adjust the code.
Troubleshooting
Connection Errors
If you see connection errors:
- Verify database credentials in
.env - Ensure both databases are accessible from your Laravel application
- Check database table prefixes if your Magento installations use them
- Verify network connectivity and firewall settings
Migration Errors
If migration fails:
- Check the migration logs in the web interface
- Review Laravel logs:
storage/logs/laravel.log - Ensure Magento 2 database has proper permissions
- Verify that required Magento 2 tables exist
Support
For issues or questions, please check:
- Laravel logs:
storage/logs/laravel.log - Migration logs displayed in the web interface
- Database connection status in the web interface