MuleSoft Accelerator for Salesforce B2C Commerce Cloud
Use case 1 - Products
Overview
The following use case is covered:
- Products (PIM -> B2B Commerce & B2C Commerce)
This use case enables the integration of incremental updates made to products in a PIM, not the initial bulk upload of the product catalog. The B2C Commerce Product Catalog import page describes how to do the initial bulk import into B2C Commerce.
On a (configurable) scheduled basis, build the product list from the PIM database and push changes in product data since the previous load into B2C Commerce.
Assumptions:
- The Products Process API has been configured to push product updates to both B2B Commerce and B2C Commerce.
- The initial load of products into B2B and B2C Commerce Systems has already occurred.
- All new products from the delta load will be associated with the Standard Catalog (B2C Commerce).
- Delta is loaded into the B2C Commerce System staging environment with the assumption that additional attributes and categorization will need to take place before it is published to the production environment. The promotion of products from staging into production should be handled within B2C Commerce itself: it is not addressed by this Accelerator.
- Only products of type 'master' are pushed to B2B Commerce.
- The entities ProductCategory, ProductCatalog, ProductImage, PriceBook and CommerceEntitlementPolicy must already exist in B2B Commerce.
Note:
This Accelerator supports the standard product type within B2C Commerce (standalone products).
High-level architecture
Workflow
- At a configured schedule, the Product Process API calls PIM System API to query PIM for new or updated products.
- The Products Process API calls the B2B Commerce System API to upsert the product details into B2B Commerce if the product type is 'master'.
- The Products Process API calls the B2C Commerce System API to upsert the product details into B2C Commerce.
Sequence diagram
Systems involved
- PIM: contains all required information about products (product codes, pricing, images, etc.). This system is simulated with an Oracle database.
- B2B Commerce: Mule publishes product information into B2B Commerce with default values as configured in this process API.
- B2C Commerce: Mule publishes product information into the staging environment of B2C Commerce.
Setup instructions
Product Information Management (PIM) system configuration
Perform the following steps to configure the PIM:
- Create products table using the sql scripts provided in the Mule project
- Insert products data into the products table.
Please refer to this template for sql scripts. Scripts are located under "src/test/resources/db scripts".
Mule projects
Follow the readme instructions of the following Mule application projects to set
up and deploy the projects into Anypoint Platform for this use case.
- PIM System API | API Specification | Implementation Template
- B2B Commerce System API | API Specification | Implementation Template
- B2C Commerce System API | API Specification | Implementation Template
Configurable Properties in the YAML file
Name | Value |
---|---|
demandware.oAuth.refresh-interval | B2C Commerce login token refresh interval. This value is set as 29 minutes; typically the token expires after 30 minutes. |
- Products Process API | API Specification | Implementation Template
B2C Commerce components & configurations
- Create a catalog in B2C Commerce where the products from PIM will be inserted.
- Use the B2C Commerce OCAPI to insert products: https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2FOCAPI%2Fcurrent%2Fdata%2FResources%2FProducts.html=0_12_4_34
PIM components & configurations
The PIM consists of a single database table with product information for demonstration purposes.
Product data elements
Element Name | Data Type | Description |
---|---|---|
brand | String | The brand of the product. |
creation_date | Date | Returns the value of attribute 'creationDate'. |
product_id | String | The ID (SKU) of the product. |
image_path | String | The path to the image file |
min_order_quantity | String | Minimum order quantity of the product |
in_store_pickup | Char | Whether in store pickup available or not |
in_stock | Boolean | The flag that indicates if the product is in stock, or not. This is a calculated value. |
is_searchable | SiteSpecific \(Boolean)) | The site specific searchable status of the product. |
last_modified | Date | Returns the value of attribute 'lastModified'. |
long_description | Localized \(MarkupText\) | The localized long description of the product. |
global_product_id | String | The global identifier of the product. This is applicable for product types "variation_group" and "variant" only. |
owning_catalog_id | String | The ID of the catalog that owns the product. |
original_retail_price | Decimal | The price of the product. |
price_currency | String | Currency for the product's price. |
primary_category_id | String | The id of the products primary category. |
product_name | Localized \(String\) | The localized name of the product. |
product_type | String | The type of the product. It can be 'master', 'product' or 'variant' |
sale_unit | String | The sales unit of the product. |
short_description | String | The localized short description of the product. |
step_qnty | String | The step quantity. |
tax_class_id | String | Tax class Id of the product |
upc | String | The Universal Product Code of the product. |
variation_attribute_key1 | String | The variation attribute key1. |
variation_attribute_key2 | String | The variation attribute key2. |
variation_attribute_value1 | String | The variation attribute value1. |
variation_attribute_value2 | String | The variation attribute value2. |
vendor_number | String | The vendor number of the product. |
vendor_name | String | The name of the product's vendor. |
vendor_sku | String | The SKU of the product's vendor. |