CMS Import/Export Plugin
The DmfCmsImportExport plugin enables exporting and importing CMS pages (shopping experiences) and theme configurations. Ideal for transferring content between development, staging, and production environments.
On this page:
Requirements
- Shopware 6.7.0 or higher
- PHP 8.2 or higher
- PHP Extensions:
zlib,curl
Installation
bash
composer require dmf/sw6-plugin-cmsimportexport
bin/console plugin:install --activate DmfCmsImportExport
bin/console cache:clearFeatures
- Export/Import CMS Pages: Complete shopping experiences with all blocks and elements
- Export/Import Theme Configurations: All theme settings of a sales channel
- Media Handling: Linked media is automatically exported
- Admin Integration: Export/Import directly in the backend
- CLI Support: Automation via console commands
- CI/CD Ready: Perfect for automated deployments
Console Commands
Export CMS Page
bash
bin/console dmf:cms:export --id=<cms-page-id> [--file=<filename>]| Option | Required | Description |
|---|---|---|
--id | Yes | UUID of the CMS page |
--file | No | Filename (default: export) |
Example:
bash
# Export with automatic filename
bin/console dmf:cms:export --id=a1b2c3d4e5f6789012345678
# Export with custom filename
bin/console dmf:cms:export --id=a1b2c3d4e5f6789012345678 --file=homepage-backupImport CMS Page
bash
bin/console dmf:cms:import --file=<filepath>| Option | Required | Description |
|---|---|---|
--file | Yes | Path to export file |
Example:
bash
bin/console dmf:cms:import --file=var/export/homepage-backup.gzINFO
New UUIDs are generated during import, so no conflicts with existing pages occur.
Export Theme Configuration
bash
bin/console dmf:theme:export --id=<theme-id> [--file=<filename>]| Option | Required | Description |
|---|---|---|
--id | Yes | UUID of the theme |
--file | No | Filename (default: export) |
Example:
bash
bin/console dmf:theme:export --id=b2c3d4e5f6a789012345678 --file=theme-configImport Theme Configuration
bash
bin/console dmf:theme:import --id=<theme-id> --file=<filepath>| Option | Required | Description |
|---|---|---|
--id | Yes | UUID of target theme |
--file | Yes | Path to export file |
Example:
bash
bin/console dmf:theme:import --id=c3d4e5f6a7b89012345678 --file=var/export/theme-config.gzAdmin Integration
The plugin adds export/import buttons in the Shopware Administration.
Export CMS Page (Admin)
- Open Content → Shopping Experiences
- Select the desired page
- Click Export in the toolbar
- The file is automatically downloaded
Import CMS Page (Admin)
- Open Content → Shopping Experiences
- Click Import
- Select the export file
- The page is created as a new shopping experience
CI/CD Integration
GitLab CI Example
yaml
deploy:staging:
stage: deploy
script:
# Export CMS pages from production
- bin/console dmf:cms:export --id=$HOMEPAGE_ID --file=homepage
# Export theme configuration
- bin/console dmf:theme:export --id=$THEME_ID --file=theme-config
# Save files as artifacts
artifacts:
paths:
- var/export/Deployment Workflow
bash
# 1. On source system: Export
bin/console dmf:cms:export --id=abc123 --file=homepage
bin/console dmf:theme:export --id=def456 --file=theme
# 2. Transfer files (SCP, rsync, etc.)
scp var/export/*.gz user@target:/var/www/shop/var/import/
# 3. On target system: Import
bin/console dmf:cms:import --file=var/import/homepage.gz
bin/console dmf:theme:import --id=xyz789 --file=var/import/theme.gz
bin/console cache:clearTechnical Details
Export Format
Exports are saved as compressed gzip files (.gz):
- CMS Pages: JSON with all blocks, slots, configurations, and base64-encoded media
- Theme Configurations: JSON with all theme settings
Media Handling
- Export: Linked media is base64-encoded and embedded in the export file
- Import: Media is automatically uploaded to the media library and correctly linked
UUID Handling
All UUIDs are regenerated during import to avoid conflicts. Relationships between objects (blocks, slots, media) are preserved.
Troubleshooting
Export fails
- Check if the CMS page/theme exists
- Ensure write permissions for
var/export/ - Check available disk space
Import fails
- Check file format (must be
.gz) - Ensure the file is not corrupted
- Check PHP extensions:
zlib,curl
Media missing after import
- Run
bin/console media:generate-thumbnails - Check media library for failed uploads
- Clear cache:
bin/console cache:clear