Use a custom product repository name or location

Abstract

If you do not use the standard name and location for the product repository, you need to adjust the configuration.

When you set up Sitecore to integrate with an external commerce system that uses product synchronization, you must create a product repository. The default name and location for the product repository is /sitecore/content/Product Repository. If you want to use a custom product repository name or location, you must adjust the configuration.

Note

It is best practice to store the product repository in its own folder under /sitecore/content to avoid getting it mixed up with the websites that are typically stored under /sitecore/content/.

To use a custom product repository name or location:

  1. In the /App_Config/Include/Sitecore.Commerce.Products.config file, edit the following attribute:

    <paths productRepository="/sitecore/content/Product Repository">

  2. To change the configuration of the two index files for the Lucene indexing engine, update the lines marked in bold in the following samples:

    Note

    If you use the Solr indexing engine, then you must modify the Sitecore.Commerce.Products.Solr.Index.Master.config and Sitecore.Commerce.Products.Solr.Index.Web.config files instead.

    • In the Sitecore.Commerce.Products.Lucene.Index.Master.config file:

    <index id="commerce_products_master_index" 
    type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, 
    Sitecore.ContentSearch.LuceneProvider">
        <param desc="name">$(id)</param>
        <param desc="folder">$(id)</param>
        <!-- This initializes index property store. The ID has to be set to the index 
        id -->
        <param desc="propertyStore" ref="contentSearch/databasePropertyStore" 
          param1="$(id)" />
        <strategies hint="list:AddStrategy">
        <!-- NOTE: order of these is controls the execution order -->
        <strategy ref="contentSearch/indexUpdateStrategies/manual" />
        </strategies>
        <commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, 
          Sitecore.ContentSearch">
        <policies hint="list:AddCommitPolicy">
            <policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, 
              Sitecore.ContentSearch" />
        </policies>
        </commitPolicyExecutor>
        <locations hint="list:AddCrawler">
            <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, 
              Sitecore.ContentSearch">
                <Database>master</Database>
              <Root>/sitecore/content/Product Repository/Products</Root>
            </crawler>
        </locations>
    </index>
    
    • In the Sitecore.Commerce.Products.Lucene.Index.Web.config file:

    <index id="commerce_products_web_index" 
    type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, 
    Sitecore.ContentSearch.LuceneProvider">
        <param desc="name">$(id)</param>
        <param desc="folder">$(id)</param>
        <!-- This initializes index property store. The ID has to be set to the index 
        id -->
        <param desc="propertyStore" ref="contentSearch/databasePropertyStore" 
        param1="$(id)" />
        <strategies hint="list:AddStrategy">
        <!-- NOTE: order of these is controls the execution order -->
        <strategy ref="contentSearch/indexUpdateStrategies/onPublishEndAsync" />
        </strategies>
        <commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, 
          Sitecore.ContentSearch">
        <policies hint="list:AddCommitPolicy">
            <policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, 
              Sitecore.ContentSearch" />
        </policies>
        </commitPolicyExecutor>
        <locations hint="list:AddCrawler">
            <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, 
              Sitecore.ContentSearch">
                <Database>web</Database>
              <Root>/sitecore/content/Product Repository/Products</Root>
            </crawler>
        </locations>
    </index>
    
  3. If you change the ID of the index for the master database from the default commerce_products_master_index, you must also replace the ID in the ProductSynchronization.ProductIndexes setting in the Sitecore.Commerce.Products.Config file.

    The setting contains a list of index IDs that will be paused, resumed, and rebuilt during product synchronization:

    <!--  PRODUCT INDEXES.
            The indexes used to store synchronized products.
            Can be stopped, resumed and rebuilt automatically during product synchronization.
    -->
    <setting name="ProductSynchronization.ProductIndexes" value="sitecore_master_index, commerce_products_master_index" />