Search code examples
sap-commerce-cloud

CatalogVersion with catalogId 'xxxProductCatalog' and version 'Staged' not found


i follow that tutorial

https://wiki.hybris.com/pages/viewpage.action?pageId=294094418&showComments=true

first i changed impex names to mystore name.

Then i went to hac console and updated only my extension, mystoreinitialdata.

But it gives those errors:

Creating project data for mystoreinitialdata ...
Begin importing common data for [mystoremystoreinitialdata]
Begin importing product catalog data for [xxx]
Begin importing content catalog data for [xx]
Begin synchronizing Product Catalog [xxx]




Error creating sample data for mystoreainitialdata. See console output.

ERROR [hybrisHTTP39] [Initialization] de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException: CatalogVersion with catalogId 'xxxProductCatalog' and version 'Staged' not found!

i searched and there is no xxxProductCatalog in my code.

What can i do?


Solution

  • Make sure the ImportData created in your InitialDataSystemSetup has valid names for ProductCatalog and Content Catalog attributes. Like this:

    final List<ImportData> importData = new ArrayList<ImportData>();
    
    final ImportData sampleImportData = new ImportData();
    sampleImportData.setProductCatalogName("mystore");
    sampleImportData.setContentCatalogNames(Arrays.asList("mystore"));
    sampleImportData.setStoreNames(Arrays.asList("mystore"));
    importData.add(sampleImportData);
    
    getCoreDataImportService().execute(this, context, importData);
    getEventService().publishEvent(new CoreDataImportedEvent(context, importData));
    
    getSampleDataImportService().execute(this, context, importData);
    getEventService().publishEvent(new SampleDataImportedEvent(context, importData));
    

    Also make sure, that catalogs with the names "mystoreContentCatalog" and "mystoreProductCatalog" are created in the impex files in the following files:

    /mystoreinitialdata/resources/mystoreinitialdata/import/coredata/contentCatalogs/mystoreContentCatalog/catalog.impex

    $contentCatalog=mystoreContentCatalog
    $languages=ja,en,de,zh
    
    INSERT_UPDATE ContentCatalog;id[unique=true]
    ;$contentCatalog
    
    INSERT_UPDATE CatalogVersion;catalog(id)[unique=true];version[unique=true];active;languages(isoCode)
    ;$contentCatalog;Staged;false;$languages
    ;$contentCatalog;Online;true;$languages
    

    /mystoreinitialdata/resources/mystoreinitialdata/import/coredata/productCatalogs/mystoreProductCatalog/catalog.impex

    $productCatalog=mystoreProductCatalog
    $catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
    $languages=ja,en,de,zh
    
    INSERT_UPDATE Catalog;id[unique=true]
    ;$productCatalog
    
    INSERT_UPDATE CatalogVersion;catalog(id)[unique=true];version[unique=true];active;languages(isoCode);readPrincipals(uid)
    ;$productCatalog;Staged;false;$languages;employeegroup
    ;$productCatalog;Online;true;$languages;employeegroup