Introduction
This section describes aspects of mapping product media files.
Position & Cover Handling
Depending on the used data model the handling of positions and covers is different.
In the old data model the field AssetGroup::assets
is of type ArrayCollection
.
In the updated data model type was changed to an AssociativeArrayCollection
, which means that assets are stored by their identifier
as key.
In the new data model it is highly recommended to use SortableAssets
to manage the cover and position of assets.
Cover Images
The module provides an extension to set covers: Synqup\Modules\Shopware6Bundle\Document\ShopwareAssetExtension
.
Example to set an Asset as cover:
$assetExtension = new ShopwareAssetExtension(isCover: true);
$asset->setExtension($assetExtension);
If there is no asset with that extension, the first asset without deletedAt-timestamp is used as cover.
Position
In case of a SortableAsset
, the position is determined by the position field.
In case of a default Asset
the position is determined by the position of the asset in the collection.