Salesforce B2B Commerce connector

Commerce Incubator Version 1.0.0 Magnolia 6.2 compatible Git

The Salesforce B2B Commerce connector provides a default implementation to connect to the Salesforce B2B Commerce solution.

This module is at the INCUBATOR level.

The module was developed on the sandbox provided by Salesforce at GitHub: b2b-commerce-on-lightning-quickstart.

The module is compatible with Salesforce: Commerce resources 60.0

Prerequisites

The module requires authentication via client and secret keys for a Salesforce Connected App.

Commerce connector pack

The module is built upon the Commerce Connector Pack to reuse features and mechanisms.

It requires a Commerce Connector Pack license and dependencies.

Installing with Maven

Maven is the easiest way to install the module. Add the following to your bundle:

<dependency>
  <groupId>info.magnolia.ecommerce</groupId>
  <artifactId>magnolia-ecommerce-sfb2b-connector</artifactId>
  <version>1.0.0</version>
</dependency>

DX Core bundle

For common use with a DX Core bundle, you need to build the .jar file and then copy it to lib folder.

  1. Copy magnolia-ecommerce-sfb2b-connector-1.0.0.jar to <tomcat>/webapp/ROOT/WEB-INF/lib/.

Webapp

For development use with a Webapp, you need to declare it in POM of Webapp as below

Connector pack dependencies
<dependency>
  <groupId>info.magnolia.ecommerce</groupId>
  <artifactId>magnolia-ecommerce</artifactId>
  <version>VERSION</version> (1)
</dependency>
<dependency>
  <groupId>info.magnolia.ecommerce</groupId>
  <artifactId>magnolia-ecommerce-ui</artifactId>
  <version>VERSION</version> (1)
</dependency>
<dependency>
  <groupId>info.magnolia.ecommerce</groupId>
  <artifactId>magnolia-ecommerce-templating</artifactId>
  <version>VERSION</version> (1)
</dependency>
1 See Ecommerce: Installing with maven for the latest version.

Configuration

To enable this module, you should configure the connector in your light development module as shown at Ecommerce: Configuration.

<your light module>/ecommerces/<your store>.yaml
class: info.magnolia.ecommerce.common.EcommerceDefinition
type: salesforce-b2b-commerce
enabled: false
implementation:
  products:
    all: info.magnolia.ecommerce.salesforceb2b.products.All
    byId: info.magnolia.ecommerce.salesforceb2b.products.ById
    byCategoryId: info.magnolia.ecommerce.salesforceb2b.products.ByCategoryId
    searchByText: info.magnolia.ecommerce.salesforceb2b.products.SearchByText
  categories:
    all: info.magnolia.ecommerce.salesforceb2b.categories.All
    byId: info.magnolia.ecommerce.salesforceb2b.categories.ById
    byParentCategoryId: info.magnolia.ecommerce.salesforceb2b.categories.ByParentCategoryId
    byProductId: info.magnolia.ecommerce.salesforceb2b.categories.ByProductId
  connectionValidator: info.magnolia.ecommerce.salesforceb2b.common.SalesforceB2BConnectionValidator
connections:
  connection:
    authUrl: AUTH_URL (1)
    baseUrl: BASE_URL (2)
    enabled: true
    parameters:
      org_id: ORG_ID (3)
      client_id: CLIENT_ID (4)
      client_secret: CLIENT_SECRET (5)
      apiVersion: API_VERSION (6)
      webStoreId: WEBSTORES_ID (7)
      fallbackLanguage: FALLBACK_LANGUAGE (8)
      defaultEffectiveAccountId: DEFAULT_EFFECTIVE_ACCOUNT_ID (9)
1 Required The authorization URL. Example: https://velocity-dream-7488.my.salesforce.com
2 Required The base URL. Example: https://velocity-dream-7488.my.salesforce.com/services/oauth2/token
3 Required The organization ID. Example: 00DIS000xxxxxxx
4 Required The client ID. Example: 3MVG9bZIBBVRES4FCaLxnP…​enhH4V06G4V_xxxxxxxxxxxxx
5 Required The client secret. Example: 742BCCEFD6D42673E4D4C…​FB22E3A45A93xxxxxxxxxxxxx
6 Required The API version. Example: 60.0
7 Required The ID of the web store. Example: 0ZEIS0000xxxxxxxxxxxxx
8 Required if using multiple languages. Sets the fallback language. Otherwise, it is optional. Example: en_SG
9 Required Default account ID for product pricing. Example: 001IS000002V4xxxx

Usage

Checking connection and testing

testing

Viewing categories and products

See Ecommerce: Viewing your e-commerce content for steps on viewing e-commerce content.

  • Categories

  • Products

categories
products

Templating

See Ecommerce: Using your e-commerce content for steps on using e-commerce content.

The following default components are provided and can be used as a basis to develop your own:

  • Category list - Lists all the categories for a given connection.

  • Product detail - Shows detailed information for a specific product.

  • Product list - Lists all the products for the selected category (not sub-categories).

  • Product teaser - Shows a given product image with text.

This is a sample implementation. You should develop your own, of course.

  • Pages

  • Components

page
components

Templating functions

The sfb2becomfn templating function provides access to the products from your external e-commerce solution in your FreeMarker templates.

Method Supported

Get a category by ID

Get product by ID

Get product information by product ID as a string

Get all categories

Get all categories by product ID

Get all categories by parent ID

Get all products

Get all products by category ID

Get image link

Currency and Effective Account Mapping to support multi-language and multi-currency implementations.

  1. Add currencyEffectiveAccountMapping to your config.yaml file.

    <your light module>/decorations/salesforce-b2b-commerce/config.yaml
    currencyEffectiveAccountMapping:
      definitionName:
        connectionName:
          USD: <Effective Account Id>
          EUR: <Effective Account Id>
  2. Use sfb2becomfn to executed the getEffectiveAccountByCurrency method.

    effectiveAccountId="${sfb2becomfn.getEffectiveAccountByCurrency(definitionName, connectionName, currency)}"; (1)
    1 getEffectiveAccountByCurrency takes definitionName, connectionName, and currency parameters.

License

This module is open source software licensed as MIT.

Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Salesforce B2B Commerce connector docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules