8 Hybris HMC Media
8 Hybris HMC Media
• Any product in commerce site has images and these are called media
• To add any product to a commerce site, we have to create media with that image
• Hybris support media objects. Media item is a reference to any sort of physical file stored on local /
remote. It can be picture / text / flash / zip / …
• A media item in Hybris Commerce is not a physical file, but a reference to that file.
A media item has an URL that points to the location of the actual file. To reference a file in an SAP
Hybris Commerce application, you need to retrieve and use the media item's URL.
• A media is linked to only 1 file, but file can be linked to >1 media. A media item is defined by: -
Location on the disk or remote location Unique identifier URL
Folder Catalog version
Mime type Format
Media container Location hash
Meta data’s Security rules
• OOB Media type has multiple sub types for specialized objects like Impex, Log and Email.
• Medias are not localized, so have localized reference to medias. U need to declare an attribute this
way: localized:Media in items.xml file
• Hybris provides 2 OOB MediaStorageStrategy
o LocalFileMediaStorageStrategy = Default. Files stored along with Hybris under Data Directory
o S3MediaStorageStrategy = Files are stored within Amazon AWS S3 Buckets.
• Depending on media storage strategy, you need to select appropriate MediaURLStrategy, OOB have: -
o LocalMediaWebURLStrategy
o S3MediaURLStrategy
• Media can be created using different tools like HMC or via Impex.
→ hMC → Multimedia → Media
Unique Identifier = Enter the unique identifier for your media.
Catalog Versions = Enter the catalog version
Note If you do not mention catalog version of media same as the catalog version of product, media is
not linked to product.
• Media Contexts = Hybris is multi-channel platform, you can load medias in different context (Mobile,
Desktop, and so on).
Media context is a mapping container, it maps source format to target format, so proper image is
loaded.
Secured Media (By default media access is not secure) → media.default.secured=false (Make it to True
to secure all media). If you want to secure only 1 folder then → media.folderName.secured=true
• Q: How to Search media that you have just created?
Use different filter options under Search. You can also select checkbox for Subtypes in Search option.
The following Search Criteria are shown in the following image −
Identifier Mime Type Folder Catalog Version
• Synchronization of Media Items
During synchronization of a catalog version, all the media items in the source catalog version are
copied. After synchronization, every media item is available twice: once in the source catalog version,
and once in the target catalog version.
However, the files referenced by media items will not be duplicated and are available only once.
Instead of creating an individual copy of a Media-item-referenced file in target catalog version, Media
item in target catalog version holds a reference to original file. The concept is similar to symbolic links.