How to clone content catalog into another catalog in SAP Hybris

We often find ourselves in a situation where we need to set up a new website but don’t want to start from scratch by creating all the pages, slots, components and media files again. In such cases, we can reuse an existing site by cloning it for the new site. This helps save time for both the IT and business teams. The content team can easily rewrite or replace the required content as needed.

for this example, we wanted to clone UKContentCatalog to USAContentCatalog. We can use the below Impex and start the sync job. all pages, cms, slots, components and media will be cloned once the job is completed.



$contentCatalog=USAContentCatalog
$sourceContentCatalog=UKContentCatalog

$defaultCurrency=USD
$languages=en
$defaultLanguage=en

$stagedContent=catalogVersion(catalog(id[default=$contentCatalog]),version[default='Staged'])[unique=true,default='$contentCatalog:Staged']
$onlineContent=catalogVersion(catalog(id[default=$contentCatalog]),version[default='Online'])[unique=true,default='$contentCatalog:Online']

$sourceContentCV=sourceVersion(catalog(id[default=$contentCatalog]),version[default='Staged'])[unique=true,default='$sourceContentCatalog:Staged']
$targetContentCV=targetVersion(catalog(id[default=$contentCatalog]),version[default='Online'])[unique=true,default='$contentCatalog:Staged']

INSERT_UPDATE Catalog;id[unique=true];name[lang=en];defaultCatalog
;$contentCatalog;Freya USA Content Catalog;true

# Catalog versions for content catalogs
INSERT_UPDATE CatalogVersion;catalog(id)[unique=true];version[unique=true];active;defaultCurrency(isocode);languages(isoCode)
;$contentCatalog;Staged;false;$defaultCurrency;$languages
;$contentCatalog;Online;true;$defaultCurrency;$languages

#script to create cron job
INSERT_UPDATE CatalogVersionSyncJob;code[unique=true];$sourceContentCV;$targetContentCV;rootTypes(code)[mode = append];
#;sync USAContentCatalog:Staged->Online;;;CMSItem, CMSRelation ;

Leave a Comment

Your email address will not be published. Required fields are marked *