November Happy Hour will be moved to Thursday December 5th.

Advanced Catalog Export/Import

Vote:
 

I want to be able to import catalog content with all related media(assets).

I decided to check how it is done in Commerce Sample site.

I've found that Install Commerce Sample.ps1 script does following steps:

1. Imports catalogs itself (via CatalogImport.exe tool). Suppose that the tool does exactly the same what can be done using CommerceManager online import/export functionality. The tool consumes zip file that contains catalog data serialized into XML. That's pretty simple.

2. Imports media(assets). Catalog media(assets) are stored at CMS site (as global media). For that Add-EpiServerData cmdlet is used:

$sampleAssetsDataFile = Join-Path $sourceContentFolder "SampleAssets.episerverdata"
$globalMediaRoot = Get-EPiContentId -ContentTypeGuidString "E56F85D0-E833-4E02-976A-2D11FE4D598C" -ConnectionString $selectedWebApplication.SiteDbConnectionString
Add-EPiServerData -ImportSource $sampleAssetsDataFile -DestinationDirectory $selectedWebApplication.PhysicalPath -VirtualDirectory $selectedWebApplication.ApplicationName -DestinationType "ExplicitPage" -DestinationPage $globalMediaRoot -TransactionTimeout (New-TimeSpan -minute 60)

Note that I can't do the same using CMS->Admin UI (that is not possible to specify GlobalMediaRoot as destination page)

3. Ties assets with catalog content. That is done by AssetImporter tool (shipped with EpiServer installation). AssetImporter tool consumes CSV file that contains association records (Variation Code -> Image ID).

 

So my questions are:

1. How to prepare Assets.episerverdata file. That will contain global media that is not associated with any "regular" content types (pages/blocks), so  it is not possible to export data by CMS->Amdin->Tools->Export data? Is it out of the box tool somewhere?

2. How to prepare CSV relation file? Is it out the box tool or sql script somewhere?

 

I understand that I can solve both my questions by writing custom tool based on CMS/Commerce API, but actually I have no time to do that right now:)

 

 

 

 

 

 

#79865
Jan 08, 2014 20:18
Vote:
 

Hi,

For your first question, yes, we have an internal tool to do that. I'll ask if we can release that tool to partners :)

For the second question, I created a query for you:

  select ce.code, cl.name
  from dbEPiServerCommerceManager.dbo.CatalogItemAsset cia
  inner join dbEPiServerCommerceManager.dbo.CatalogEntry ce
  on ce.CatalogEntryId = cia.catalogentryid
  inner join dbMyEPiServerSite.dbo.tblContent ct 
  on cia.assetkey = ct.contentguid
  inner join dbMyEPiServerSite.dbo.tblContentLanguage cl
  on ct.pkId = cl.fkContentId

Change the database's names to match yours.

Regards.

/Q

 

#79878
Edited, Jan 09, 2014 9:21
Vote:
 

Thak you, Quan!

Waiting for your decision about sharing the tool, we would really appreciate that.

#79885
Jan 09, 2014 10:14
Vote:
 

Hi,

You can contact me at Quma at episerver.com to get the tool :)

Regards.

/Q

#80111
Jan 15, 2014 10:07
Vote:
 

Sorry for the question. what is "Quma"?

#80117
Jan 15, 2014 10:50
Vote:
 

Quma is my alias :), you can send email to either quan.mai or quma

/Q

#80118
Jan 15, 2014 11:02
Vote:
 

Here are simple steps to migrate assets between servers:

  • Run "Export All Media Files" job on the source server. It will generate "ExportedMedia.episerverdata" file with exported assets and "MediaMappings.csv" file with content-asset mappings for AssetImporter.
  • Copy "ExportedMedia.episerverdata" from the source server "App_Data" dir to the target server "App_Data" dir.
  • Run "Import Media Files" job on the target server.
  • Run AssetImporter to map content with assets:
    AssetImporter.exe MediaMappings.csv -- D:\Websites\MyWebsite -mappingonly

Get the source code for import/export jobs on Gist: https://gist.github.com/whyleee/fcbff840109fc040682f.

#131414
Edited, Jul 23, 2015 17:09
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.