Skip to content

CMS Import/Export Plugin

View 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:clear

Features

  • 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>]
OptionRequiredDescription
--idYesUUID of the CMS page
--fileNoFilename (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-backup

Import CMS Page

bash
bin/console dmf:cms:import --file=<filepath>
OptionRequiredDescription
--fileYesPath to export file

Example:

bash
bin/console dmf:cms:import --file=var/export/homepage-backup.gz

INFO

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>]
OptionRequiredDescription
--idYesUUID of the theme
--fileNoFilename (default: export)

Example:

bash
bin/console dmf:theme:export --id=b2c3d4e5f6a789012345678 --file=theme-config

Import Theme Configuration

bash
bin/console dmf:theme:import --id=<theme-id> --file=<filepath>
OptionRequiredDescription
--idYesUUID of target theme
--fileYesPath to export file

Example:

bash
bin/console dmf:theme:import --id=c3d4e5f6a7b89012345678 --file=var/export/theme-config.gz

Admin Integration

The plugin adds export/import buttons in the Shopware Administration.

Export CMS Page (Admin)

  1. Open ContentShopping Experiences
  2. Select the desired page
  3. Click Export in the toolbar
  4. The file is automatically downloaded

Import CMS Page (Admin)

  1. Open ContentShopping Experiences
  2. Click Import
  3. Select the export file
  4. 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:clear

Technical 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

  1. Check if the CMS page/theme exists
  2. Ensure write permissions for var/export/
  3. Check available disk space

Import fails

  1. Check file format (must be .gz)
  2. Ensure the file is not corrupted
  3. Check PHP extensions: zlib, curl

Media missing after import

  1. Run bin/console media:generate-thumbnails
  2. Check media library for failed uploads
  3. Clear cache: bin/console cache:clear