139 lines
4.2 KiB
Markdown
139 lines
4.2 KiB
Markdown
# 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:
|
|
|
|
```env
|
|
# 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
|
|
|
|
1. **Category Structure**: The tool reads all categories from Magento 1 and builds a tree structure
|
|
2. **Level-by-Level Migration**: Categories are migrated level by level, ensuring parent categories exist before child categories
|
|
3. **Attribute Migration**: For each store mapping, category attributes (name, URL key, is_active) are migrated to the corresponding Magento 2 store view
|
|
4. **Path Building**: Category paths are automatically built to maintain the correct hierarchy
|
|
|
|
### Database Tables Used
|
|
|
|
**Magento 1:**
|
|
- `catalog_category_entity` - Category entities
|
|
- `catalog_category_entity_varchar` - Category text attributes
|
|
- `catalog_category_entity_int` - Category integer attributes
|
|
- `core_store` - Store information
|
|
- `eav_attribute` - Attribute definitions
|
|
- `eav_entity_type` - Entity type definitions
|
|
|
|
**Magento 2:**
|
|
- `catalog_category_entity` - Category entities
|
|
- `catalog_category_entity_varchar` - Category text attributes
|
|
- `catalog_category_entity_int` - Category integer attributes
|
|
- `store` - Store information
|
|
- `eav_attribute` - Attribute definitions
|
|
- `eav_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:
|
|
|
|
1. Verify database credentials in `.env`
|
|
2. Ensure both databases are accessible from your Laravel application
|
|
3. Check database table prefixes if your Magento installations use them
|
|
4. Verify network connectivity and firewall settings
|
|
|
|
### Migration Errors
|
|
|
|
If migration fails:
|
|
|
|
1. Check the migration logs in the web interface
|
|
2. Review Laravel logs: `storage/logs/laravel.log`
|
|
3. Ensure Magento 2 database has proper permissions
|
|
4. 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
|
|
|