Introduction

This section of the documentation is intended to show you how the module maps media for different types of documents. Individual features and details of an entity are discussed on each page.

Media Mapping Configuration / Subsection

The configuration of the media subsections (products and categories so far) follow more or less the same pattern. On this page you will find all configuration settings that are used for every subsection.

Activate Subsection

{
    "subsections": {
        "product": {
            "enabled": true
        }
    }
}

Use the key subsections.{subsection}.enabled to activate a subsection.

Delete Configuration

{
    "subsections": {
        "delete": {
            "deleteMode": "hard|soft|null",
            "removeOrphanAssociations": true
        }
    }
}

subsections.{subsection}.delete.deleteMode

  • Allowed values are hard, soft or null.
  • If any value other than hard or soft is used, no delete-operations will be performed
  • soft & hard: the corresponding Shopware entity will lose its reference to the media-entity that belongs to an asset with deletedAt-timestamp
  • hard only: the file will be removed from Shopware, if the asset is not used at other documents without deletedAt-timestamp

subsections.{subsection}.delete.removeOrphanAssociations

Defines whether the module will delete media associations without association to an asset. Only the association will be deleted, not the media entity itself.

Json Filter

Please refer to the documentation of the output module: JSON-Filter The media module supports json filter as well.

Example configuration:

{
    "subsections": {
        "product": {
            "filter": {
                "query": "{\"identifier\": {\"$nin\": [\"_620077\"]}}",
                "operator": "and"
            }
        }
    }
}

Identifier Whitelist

You can define a whitelist of identifiers the module is allowed to handle in the next execution:

{
    "subsections": {
        "product|category": {
            "identifierWhitelist": [
                "...",
                "..."
            ]
        }
    }
}

This is considered to be a debugging functionality. Since the module synchronizes every asset of every document it can run for quite a while. If you experience problems with a certain product or category this allows you to troubleshoot problems way faster. An empty list is equal to allowing every document to be handled.

Filename Configuration

You can use the following configuration for filenames (the example contains the default values of the module):

{
    "subsections": {
        "{subsection}": {
            "filenames": {
                "keepOriginalFilenames": true,
                "forbiddenCharacters": [
                    "\\",
                    "/",
                    ":",
                    "*",
                    "?",
                    "\"",
                    "'",
                    "<",
                    ">",
                    "|",
                    "*"
                ],
                "defaultReplacementCharacter": "_",
                "characterReplacementMap": [],
                "prefix": "..."
            }
        }
    }
}
  • subsections.{subsection}.filenames.keepOriginalFilenames: Defines whether the files will be uploaded with their original names defined at Asset.fileSystemUri.name. Otherwise, the name at the Asset is used (Asset.name). Important: Keep in mind that filenames must be globally unique in Shopware.
  • subsections.{subsection}.filenames.forbiddenCharacters: Contains all characters that are forbidden in filenames.
  • subsections.{subsection}.filenames.defaultReplacementCharacter: The character that replaces all forbidden characters by default.
  • subsections.{subsection}.filenames.characterReplacementMap: Defines the replacement chars, that replace the forbidden characters in filenames. The key is a forbidden character, the value is the character the key should be replaced with.
  • subsections.{subsection}.filenames.prefix: A prefix that is added to every file uploaded for this entity.

Asset Group Configuration

{
    "subsections": {
        "{subsection}": {
            "assetGroupTypes": [],
            "coverAssetGroupTypes": []
        }
    }
}
  • subsections.{subsection}.assetGroupTypes: Contains the asset group types that the module will read assets from. Assets from asset groups, whose type is not part of this config, will be ignored by the module.
  • subsections.{subsection}.coverAssetGroupTypes: Contains the asset group types that the module will read cover-assets from. You can leave this empty, then the same asset group types as defined in the key above will be used.

You can find examples for asset group type keys in Elio\CommerceBundle\Definition\Product\ProductAssetGroupTypeDefinition or Elio\CommerceBundle\Definition\Category\CategoryAssetGroupTypeDefinition

Media Folder Configuration

By default, product images will be uploaded to the 'Product Media' folder, category images to 'Category Media'. You can change the media-folder to which the subsection will upload its images:

{
    "subsections": {
        "mediaFolderName": "...",
        "mediaFolderId": "..."
    }
}

You can either set the name or the uuid of the folder. If both values are set, the id is used.