--- title: Use the Coveo Cartridge for B2C Commerce in Eclipse IDE slug: sal3s121 canonical_url: https://docs.coveo.com/en/sal3s121/ collection: coveo-for-commerce source_format: adoc --- # Use the Coveo Cartridge for B2C Commerce in Eclipse IDE This article explains how to use the [Coveo Cartridge for B2C Commerce](https://github.com/coveo/SFCC-Cartridge) (Coveo Cartridge) in the Eclipse IDE to push data from a Salesforce Commerce Cloud instance to a [Coveo organization](https://docs.coveo.com/en/185/). The indexed data can be used in a Coveo-powered search interface implemented in your [storefront](https://docs.coveo.com/en/p33g0410/). > **Important** > > This article focuses on installing the Coveo Cartridge in the [B2C Commerce Storefront Reference Architecture](https://developer.salesforce.com/docs/commerce/sfra) (SFRA) environment. > However, it's possible to use it in the SiteGenesis architecture. > > Most of the steps are the same for SiteGenesis; those that are different are formatted as **SiteGenesis only** notes. ## Prerequisites Make sure that your configuration meets the following criteria: . The required software is installed on your machine: ** [Java JDK 8](https://www.oracle.com/java/technologies/downloads/#java8-linux) ** The [Salesforce UX Studio plugin](https://salesforcecommercecloud.github.io/b2c-dev-doc/docs/current/LegacyDeveloperDocumentation.pdf) for the [Eclipse IDE](https://eclipseide.org/). ** [SFRA](https://trailhead.salesforce.com/content/learn/modules/b2c-developer-resources-and-tools/b2c-developer-install-config-sfra) 6.2.0 with the [Compatibility Mode](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-code-deployment.html#code-compatibility-mode) of version 22.7. > **SiteGenesis only** > > SiteGenesis 104.0.1 with the [Compatibility Mode](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-code-deployment.html#code-compatibility-mode) of version 22.7. . You have: ** Access to the [Business Manager](https://trailhead.salesforce.com/content/learn/modules/cc-digital-for-developers/cc-business-manager) (your Salesforce sandbox UI). To get access, you have to contact an account administrator within your organization. ** Downloaded the [Coveo Cartridge archive](https://github.com/coveo/SFCC-Cartridge). ## Step 1: Install the Coveo Cartridge in UX Studio . Open the UX Studio plugin in the Eclipse IDE. . Navigate to **File** → **Import** → **General** → **Existing Projects Into Workspace**. . To the right of **Select root directory**, click the **Browse** button. A modal window opens. . Navigate to the folder where you downloaded the Coveo Cartridge, then to the **cartridges** folder. . Select the **cartridges** folder. . Click the **Ok** button. The modal window closes. . In the **Projects** section, select the following projects: ** `bm_coveo` ** `int_coveo` ** `int_coveo_sfra` ** `int_coveo_sfra_changes` > **SiteGenesis only** > >
Details > > ** `bm_coveo` > > ** `int_coveo` > > ** `int_coveo_sg` > > ** `int_coveo_sg_changes` > > ![Eclipse IDE - import the SiteGenesis cartridges into a workspace](:https://docs.coveo.com/en/assets/images/coveo-for-commerce/images/eclipse-import-sg-cartridges.png) > >
. Click the **Finish** button to finish the import. ![Eclipse IDE - import the SFRA cartridges into a workspace](https://docs.coveo.com/en/assets/images/coveo-for-commerce/images/eclipse-import-sfra-cartridges.png) . The Eclipse IDE will prompt you to connect the cartridges to your sandbox. Click the **Yes** button. ## Step 2: Map the fields To enforce proper indexing, you must map the [product attributes](https://help.salesforce.com/s/articleView?id=cc.b2c_product_attributes.htm&type=5) in your Salesforce catalog to the [fields in your Coveo organization](https://docs.coveo.com/en/1833/). To do the mapping, create a mapping file and upload it to your Salesforce instance. By default, the Coveo Cartridge uses mapping located at the end of the file `int_coveo/cartridge/scripts/utils/coveoConstant.js`: ```js // ... exports.COVEO_FIELD_MAPPER = { primaryCategory: { custom: { sizeChartID: { fieldName: 'gender', fieldType: 'string' } } }, name: { <1> fieldName: 'ec_brand', <2> fieldType: 'string' }, custom: { color: { fieldName: 'ec_color', fieldType: 'string' } } }; ``` <1> The SFCC attribute `name`. <2> The Coveo field `ec_brand` that's mapped to the SFCC attribute `name`. Update this mapping as required. ## Step 3: Assign the cartridges to a site . In the Business Manager, navigate to **Administration** → **Sites** → **Manage Sites**. . Click the **Manage the Business Manager site** button. . Switch to the **Settings** tab. . In the **Cartridges** field, add the following values at the beginning: ```bash bm_coveo:int_coveo: ``` . Click the **Apply** button. . Navigate to **Administration** → **Sites** → **Manage Sites**. . Click the name of the required site. . Switch to the **Settings** tab. . In the **Cartridges** field, add the following values at the beginning: ```bash int_coveo_sfra_changes:int_coveo_sfra:int_coveo ``` > **SiteGenesis only** > > ```bash int_coveo_sg_changes:int_coveo_sg:int_coveo ``` . Click the **Apply** button. . Navigate to **Administration** → **Site Development** → **Code Deployment**. . Select the checkbox to the left of the code version that you want to activate. . Click the **Activate** button to activate the code version. ## Step 4: Configure indexing . In the Business Manager, click the **Select a Site** drop-down menu. . Click the name of the target site. . Navigate to **Merchant Tools** → **Site Preferences** → **Custom Preferences**. . In the **ID** column, click the **Coveo Configs** link. . Fill in the fields as follows: [%header,cols="1,3"] |=== |Name |Value |Coveo Enabled |`Yes` |Coveo Search Enabled |`Yes` |Coveo Chunk Mode Enabled a|* `Yes` if your [catalog data](https://docs.coveo.com/en/obcf0333/) JSON file is larger than 256 MB. See [Uploading large catalog data files](https://docs.coveo.com/en/p4eb0129#uploading-large-catalog-data-files). * `No` if your catalog data JSON file doesn't exceed 256 MB. |Coveo API Key a|The API key to index the Salesforce catalog and send its data to a source in your Coveo organization. This API key should have the following privileges: [%header, cols="1,1,3"] !=== !Service !Privilege !Access level !Content !Sources a!`Edit all`[.footnote]^[[1](#edit-all-footnote1)]^ !Organization !Organization !`View` !=== See [Manage API keys](https://docs.coveo.com/en/1718/) and [Manage privileges](https://docs.coveo.com/en/3151/). |Coveo Anonymous search API Key a|The API key to use on a Salesforce search page. This API key should have the following privileges: [%header, cols="1,1,1"] !=== !Service !Privilege !Access level !Analytics !Analytics data !`Push` !Search !Execute queries !`Allowed` !=== See [Use API key authentication with the Search API](https://docs.coveo.com/en/105/) and [Manage privileges](https://docs.coveo.com/en/3151/). |Coveo Organization Id |[The ID of your Coveo organization](https://docs.coveo.com/en/n1ce5273/). |Coveo Source ID |[The ID](https://docs.coveo.com/en/3390#copy-a-source-name-or-id) of a [Catalog source](https://docs.coveo.com/en/n8of0593/) in your Coveo organization. |Coveo Atomic CSS URL |Don't fill in this value to use the default URL, `https://static.cloud.coveo.com/atomic/v2/themes/coveo.css`. |Coveo Atomic JS URL |Don't fill in this value to use the default URL, `https://static.cloud.coveo.com/atomic/v2/atomic.esm.js` |Coveo Catalog Last Sync |The last date and time when the catalog data was indexed. Only the products added on or after this date will be indexed. |Coveo Search Response Fields |Add created search fields that you added in your project. For example, `ec_rating`, `ec_color`. |Coveo Search Hub |The name of the [search hub](https://docs.coveo.com/en/1342/) that's used for the search page. |=== -- 1. You can also set the `Custom` access level. Once you set it, you'll need to select the `Edit` access level for the targeted push source and the `View` access level for the other sources. -- ## Step 5: Import the Coveo service, profile, and credentials The Coveo Cartridge contains an archive with the metadata of the Coveo services, profiles, and credentials that you must use. To import the metadata archive, perform the following steps: . In the Business Manager, navigate to **Administration** → **Site Development** → **Site Import & Export**. . Make sure that the **Local** option is selected. . Click the **Choose File** button. . Navigate to the folder where you downloaded the Coveo Cartridge, then to the `metadata` folder and select the `metadata.zip` file. . You'll see a new entry in the table, `instance/metadata.zip`. Select this entry, and then click **Import**. . Once the archive is imported, your sandbox will have new entries added in Services, Profiles, and Credentials sections. .. Navigate to **Administration** → **Operations** → **Services** and switch to the **Services** tab. Check that the `int.coveo.http.api` service is present in the list of services. You don't need to change the service's parameters, but make sure they're as follows: ![A Coveo service added to the Salesforce sandbox](https://docs.coveo.com/en/assets/images/coveo-for-commerce/images/sf-coveo-service.png) .. Switch to the **Profiles** tab. Check that the `int.coveo.api.profile` entry is present in the list of profiles. You don't need to change the profile's parameters, but make sure they're as follows: ![A Coveo profile added to the Salesforce sandbox](https://docs.coveo.com/en/assets/images/coveo-for-commerce/images/sf-coveo-profile.png) .. Switch to the **Credentials** tab. Check that the `int.coveo.api.cred` entry is present in the list of credentials. Click the **int.coveo.api.cred** link to open the credential's details. You don't need to change the parameters, but make sure they're as follows: ![The Coveo credentials added to the Salesforce sandbox](https://docs.coveo.com/en/assets/images/coveo-for-commerce/images/sf-coveo-creds.png) The **User** and **Password** fields are default sandbox fields and not used by the Coveo Cartridge, so their values don't matter. ## Step 6: Push the catalog to Coveo Once the `metadata.zip` archive is imported, there are two jobs available in your Salesforce sandbox: * `ProductsFeedExportFull`: the job to push the entire catalog to Coveo. It suits the first time when you need to index your catalog. * `ProductsFeedExportDelta`: the job to push only the products that were updated or added after the date set in the `Coveo Catalog Last Sync` field. See [Configure indexing](#step-4-configure-indexing). To make the jobs operational, do the following: . Navigate to **Administration** → **Operations** → **Jobs**. . Click the required job to open its settings. . Switch to the **Job Steps** tab. . Next to the **Scope** label, click **X Sites Assigned**. . In the modal window that appears, select the checkbox to the left of the required site. Optional: you may select or clear the checkboxes for other available sites, if required. . Click the **Assign** button. . While at the job's settings, you can: ** Run the job manually by clicking **Run Now**. ** Schedule the job to run automatically on the **Schedule and History** tab.