on 07-28-2014 6:48 PM
Currently we maintain 11 different content catalogs in our code base for individual websites we support. If we create a new component, then we have to add this component to the impex file(s) in all 11 content catalogs. For the most part these content catalogs are the same (the business then customizes them later via the cockpit and/or hmc). So my question is how can we roll these into a single generic content catalog? The individual catalogs seem to be necessary due to the header variables, $contentCatalog for example. Is there a way to pass in header variables either via bean shell or java? If not is there a way to pass a variable from one impex file to another?
You can have beanshell code in your impex that's executed upon import. That way you can create a website specific impex file, that contains only macro definition headers, like $contentCatalog. After the section defining the header macros you just do a "include" of the generic impex file.
I should have a code sample of this, will look it up later and paste it here.Ok, try this:
#%import java.io.FileInputStream
#%impex.enableCodeExecution(true)
#%impex.enableExternalSyntaxParsing(true)
#%impex.includeExternalData(System.getProperty("HYBRIS_BIN_DIR") + "/ext-custom/xyzsampledata/resources/xyz/import/site/de/AT/impex/header-at.impex", "UTF-8", 0)
In the file "header-at.impex" you would now find any macros that set up an Austria (AT) environment, like:
$locale=de_AT
$languages=de
$language=de
$country=AT
$defaultTranslation=de
$websiteName=xyz-at
$websiteTitle=xyz.at
$deliveryCountries=at
$defaultCurrency=EUR
In the file where you have the above mentioned include ("includeExternalData") you would then use these macros like this:
$contentCatalog=$websiteName-ContentCatalog
$productCatalog=$websiteName-ProductCatalog
$online=Online
$staged=Staged
$serverConfigName=$websiteName-SolrServerConfig
$indexConfigName=$websiteName-SolrIndexConfig
$searchConfigName=$websiteName-SearchConfig
$facetSearchConfigName=$websiteName-Index
$facetSearchConfigDescription=$websiteName Solr Index
$searchIndexNamePrefix=$websiteName
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks again, it's starting to come together. For us the preferred method would be to have a website specific header file and to include the generic file. I tried this approach and got stuck on this error: no current header for value line: INSERT_UPDATE I think I'm missing something. The header file is as you describe above and I'm trying to includeExternalData with a file that has a bunch of INSERT_UPDATE statements. I also tried adding enableExternalImpExSyntaxParsing and enableExternalDataCodeExecution (both set to true). No luck. What am I missing?
This thread from the old forums may have the answer https://wiki.hybris.com/display/forum/Include+secondary+impex+files
Specifically the reply from
Note: The second/last "0" in the statements above is critical to this working! I missed it out and continued to get the "no current header" error.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.