Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Ecom 122 released
HTML Wrap
width250
alignright
classmenu
Page properties
Connector PackCommerce Connector Pack
License

Include Page
_MLA
_MLA

IssuesECOMMERCE
Maven siteECOMMERCE
Latest version

Artifact resource link
groupIdinfo.magnolia.ecommerce
rangeLowerVersion1.1
artifactIdmagnolia-ecommerce-parent
label$version
renderTypedisplay_only
resourceTypePOM

HTML Wrap
clearboth
width250
alignright
classmenu

Related topics:

The Magnolia Commerce Connector Pack modules allow you to connect your external e-commerce solution to Magnolia. You can use e-commerce content within Magnolia as if it were native Magnolia content. The modules provide access to shopping cart management and checkout functionality that directly interacts with your e-commerce solution via REST. 

Table of Contents
maxLevel4

Module structure

artifactIDDescription

magnolia-ecommerce-parent

Parent reactor.

magnolia-ecommerce

Provides the API for the e-commerce add-on.

magnolia-ecommerce-commercetools-connector

Provides a default implementation to connect to the commercetools e-commerce solution.

magnolia-ecommerce-magento-connector

Provides a default implementation to connect to the Magento e-commerce solution.

magnolia-ecommerce-salesforce-connector

Provides a default implementation to connect to the Salesforce Commerce Cloud e-commerce solution.

magnolia-ecommerce-sap-connector

Provides a default implementation to connect to the SAP Commerce Cloud e-commerce solution (formerly Hybris)

magnolia-ecommerce-templating

Provides the ecomfn templating functions

magnolia-ecommerce-ui

Provides the E-commerce app.

magnolia-ecommerce-decoration

Provides app actions and enables text classification and image recognition through decoration.

Installing

Maven is the easiest way to install the modules. Add the following dependencies to your webapp. All the other necessary dependencies will be brought in automatically:

Multiexcerpt
MultiExcerptNameInstall

Artifact maven dependencies snippet
groupIdinfo.magnolia.ecommerce
artifactIdmagnolia-ecommerce
version1.2.1

Artifact maven dependencies snippet
groupIdinfo.magnolia.ecommerce
rangeLowerVersion1.2
artifactIdmagnolia-ecommerce-ui

Artifact maven dependencies snippet
groupIdinfo.magnolia.ecommerce
rangeLowerVersion1.2
artifactIdmagnolia-ecommerce-commercetools-connector

Artifact maven dependencies snippet
groupIdinfo.magnolia.ecommerce
rangeLowerVersion1.2
artifactIdmagnolia-ecommerce-magento-connector
version1.2.1

Artifact maven dependencies snippet
groupIdinfo.magnolia.ecommerce
artifactIdmagnolia-ecommerce-sap-connector

Artifact maven dependencies snippet
groupIdinfo.magnolia.ecommerce
rangeLowerVersion1.2
artifactIdmagnolia-ecommerce-salesforce-connector

Artifact maven dependencies snippet
groupIdinfo.magnolia.ecommerce
rangeLowerVersion1.2
artifactIdmagnolia-ecommerce-templating

Artifact maven dependencies snippet
groupIdinfo.magnolia.ecommerce
rangeLowerVersion1.2
artifactIdmagnolia-ecommerce-decoration

Configuration

This section explains how to configure the connection between the E-commerce module and your external e-commerce solution.

You can create or edit the configuration in the JCR or the File System (YAML) under <module-name>/ecommerces/<definition-name>.

Before you configure the connection, make sure you know:

  • Which solution you want to connect to. Default implementations are provided for:
    • commercetools
    • Magento
    • Salesforce Commerce Cloud
    • SAP Commerce Cloud (formerly Hybris)
  • The relevant URLs to connect to your e-commerce solution.  
  • Connection credentials for your e-commerce solution.
Tip

The Commerce Connector Pack provides out-of-the-box connectors to commercetools, Magento, Salesforce Commerce Cloud and SAP Commerce Cloud. If you use another third-party e-commerce solution, you can configure your own connector.

Anchor
anc-connection-config
anc-connection-config
Connection configuration and implementation

You can add your connection configuration to the connections list (see YAML example line 15) or in the JCR under  <ecommerce-<your-third-party-solution>-connector>/ecommerces/<definition-name>/connections/<connection-name> .

If you do not want the connection definition to appear in any of the subapps, set the enabled property (YAML line 3) to false

Note that you can write your own implementation (YAML lines 4-14) or in the JCR under <module-name>/ecommerces/<definition-name>/implementation to suit your requirements, for example, to use additional features such as cross- and up-selling or custom features such as your own checkout solution.

Tip

Select the tab for your third-party e-commerce solution below. The connection properties vary.

Localtab Group
tabStyleflat
Localtab
activetrue
titlecommercetools

commercetools

Code Block
languageyml
title/ecommerce-commercetools-connector/ecommerces/commercetools.yaml
linenumberstrue
class: info.magnolia.ecommerce.common.EcommerceDefinition
type: commercetools
enabled: true
implementation:
  products:
    all: info.magnolia.ecommerce.commercetools.products.All
    byId: info.magnolia.ecommerce.commercetools.products.ById
    byCategoryId: info.magnolia.ecommerce.commercetools.products.ByCategoryId
    searchByText: info.magnolia.ecommerce.commercetools.products.SearchByText
  categories:
    all: info.magnolia.ecommerce.commercetools.categories.All
    byId: info.magnolia.ecommerce.commercetools.categories.ById
    byParentCategoryId: info.magnolia.ecommerce.commercetools.categories.ByParentCategoryId
    byProductId: info.magnolia.ecommerce.commercetools.categories.ByProductId
connections:
  connectionName:
    enabled: false
    authUrl: https://demo.commercetools.com
    parameters:
      clientId: client_id
      clientSecret: client_secret_or_path_to_password_manager
      apiUrl: https://demo.commercetools.com
      projectKey: project_key
Properties
PropertyDescription

class

required

info.magnolia.ecommerce.common.EcommerceDefinition

type

required

Your e-commerce solution: commercetools

enabled

required

true or false

connections

connectionName


authUrl

required

Authentication URL.

baseUrl

required

Base URL.

enabled

required

Shows if the connection is enabled or not: true or false

parameters


clientId

required

User name for commercetools.

clientSecret

required

Client secret for commercetools or the path to the Magnolia password manager.

apiUrl

required

API URL.

projectKey

required

The project_key from commercetools.

Localtab
titleMagento

Magento

Code Block
languageyml
titleresources/ecommerce-magento-connector/ecommerces/magento.yaml
linenumberstrue
class: info.magnolia.ecommerce.common.EcommerceDefinition
type: Magento
enabled: true
implementation:
  products:
    all: info.magnolia.ecommerce.magento.products.All
    byId: info.magnolia.ecommerce.magento.products.ById
    byCategoryId: info.magnolia.ecommerce.magento.products.ByCategoryId
    searchByText: info.magnolia.ecommerce.magento.products.SearchByText
  categories:
    all: info.magnolia.ecommerce.magento.categories.All
    byId: info.magnolia.ecommerce.magento.categories.ById
    byParentCategoryId: info.magnolia.ecommerce.magento.categories.ByParentCategoryId
    byProductId: info.magnolia.ecommerce.magento.categories.ByProductId
connections:
  connectionName:
    authUrl: http://demo.magento.com
    baseUrl: http://demo.magento.com
    enabled: false
    credentials:
      username: your_username
      password: password_or_path_to_password_manager
Using an Integration access token for Magento

You can use an Integration Access Token instead of a username and password to connect to Magento.

To do so:

  1. Request your Integration Access Token from Magento as described in the Magento documentation: https://devdocs.magento.com/guides/v2.3/get-started/authentication/gs-authentication-token.html
  2. Copy the Access Token provided by Magento.
  3. Configure your connection as follows using your token:
Code Block
languageyml
titleresources/ecommerce-magento-connector/ecommerces/magento.yaml
connections:
  connectionName:
    authUrl: http://demo.magento.com
    baseUrl: http://demo.magento.com
    enabled: true
    parameters:
      accessToken: <your-magento-access-token>
Properties
PropertyDescription

class

required

info.magnolia.ecommerce.common.EcommerceDefinition

type

required

Your e-commerce solution: magento

enabled

required

true or false

connections

connectionName


authUrl

required

Authentication URL.

baseUrl

required

Base URL.

enabled

required

Shows if the connection is enabled or not: true or false

credentials


username

required, unless an access token is used 

User name for Magento.

password

required, unless an access token is used

Password for Magento or the path to the Magnolia password manager where the password is stored.

parameters


accessToken

required, unless a username and password is used 

An access token provided by Magento.

Localtab
titleSalesforce Commerce Cloud

Salesforce Commerce Cloud

Code Block
languageyml
titleresources/ecommerce-salesforce-connector/ecommerces/salesforce-commerce.yaml
linenumberstrue
class: info.magnolia.ecommerce.common.EcommerceDefinition
type: salesforce-commerce
enabled: true
implementation:
  products:
    all: info.magnolia.ecommerce.salesforce.products.All
    byId: info.magnolia.ecommerce.salesforce.products.ById
    byCategoryId: info.magnolia.ecommerce.salesforce.products.ByCategoryId
    searchByText: info.magnolia.ecommerce.salesforce.products.SearchByText
  categories:
    all: info.magnolia.ecommerce.salesforce.categories.All
    byId: info.magnolia.ecommerce.salesforce.categories.ById
    byParentCategoryId: info.magnolia.ecommerce.salesforce.categories.ByParentCategoryId
    byProductId: info.magnolia.ecommerce.salesforce.categories.ByProductId
connections:
  connection2:
    authUrl: https://account.demandware.com/dw/oauth2/access_token
    baseUrl: https://magnolia1-tech-prtnr-eu02-dw.demandware.net/s/-/dw/data/v20_4
    enabled: true
    credentials:
      username: your_username
      password: password_or_path_to_password_manager
    parameters:
      clientId: client_id
      shopUrl: /s/RefArchGlobal/dw/shop/v20_4
      siteId: site_id
Properties
PropertyDescription

class

required

info.magnolia.ecommerce.common.EcommerceDefinition

type

required

Your e-commerce solution: salesforce-commerce

enabled

required

true or false

connections

connectionName


authUrl

required

Authentication URL.

baseUrl

required

Base URL.

enabled

required

Shows if the connection is enabled or not: true or false

credentials


username

required

User name for Salesforce Commerce Cloud.

password

required

Password for Salesforce Commerce Cloud or the path to the Magnolia password manager where the password is stored.

parameters


clientId

required

User name for Salesforce Commerce Cloud.

shopUrl

required

URL used for cart and checkout functionality for Salesforce.

siteId

required

The site_id from Salesforce.

Set this property to no-site to create a connection to all unassigned Salesforce catalogs.

Localtab
titleSAP Commerce Cloud

SAP Commerce Cloud

Code Block
languageyml
titleresources/ecommerce-salesforce-connector/ecommerces/salesforce-commerce.yaml
linenumberstrue
class: info.magnolia.ecommerce.common.EcommerceDefinition
type: sap-commerce
enabled: true
implementation:
  products:
    all: info.magnolia.ecommerce.sap.products.All
    byId: info.magnolia.ecommerce.sap.products.ById
    byCategoryId: info.magnolia.ecommerce.sap.products.ByCategoryId
    searchByText: info.magnolia.ecommerce.sap.products.SearchByText
  categories:
    all: info.magnolia.ecommerce.sap.categories.All
    byId: info.magnolia.ecommerce.sap.categories.ById
    byParentCategoryId: info.magnolia.ecommerce.sap.categories.ByParentCategoryId
    byProductId: info.magnolia.ecommerce.sap.categories.ByProductId
connections:
  connection:
    name: electronics
    authUrl: https://00.111.222.333:9002/authorizationserver/oauth/token
    baseUrl: https://00.111.222.333:9002/occ/v2
    credentials:
      username: administrator_username
      password: password_or_path_to_password_manager
    parameters:
      clientId: client_id
      clientSecret: client_secret_or_path_to_password_manager
      imagePrefix: https://00.111.222.333:9002
Properties
PropertyDescription

class

required

info.magnolia.ecommerce.common.EcommerceDefinition

type

required

Your e-commerce solution: sap-commerce

enabled

required

true or false

connections

connection


name

required

The name of the connection must match the SAP baseSiteId as described in the SAP documentation.

With the configuration in the example above, we use this URL to get catalogs:

https://00.111.222.333:9002/occ/v2/electronics/catalogs

The baseUrl (see below) is https://00.111.222.333:9002/occ/v2/

electronics is the name of the connection that corresponds to the SAP baseSiteId.

authUrl

required

Authentication URL.

baseUrl

required

Base URL.

enabled

required

Shows if the connection is enabled or not: true or false

credentials


username

required

Administrator user name for SAP Commerce Cloud.

password

required

Password for SAP Commerce Cloud or the path to the Magnolia password manager where the password is stored.

parameters


clientId

required

User name for SAP Commerce Cloud.

clientSecret

required

Client secret for SAP Commerce Cloud or the path to the Magnolia password manager.

imagePrefix



required

The first part of the URL needed to compose the complete URL of images when using the API.

For example: https://00.111.222.333:9002

Viewing and testing connections

This section explains how to view and test the connection between the Magnolia E-commerce add-on module and your external commerce solution using the E-commerce app.

  1. Open the E-commerce app Configuration tab.
  2. Select a connection.
  3. Click View to see the details of your connection to an external e-commerce solution.

Depending on your external e-commerce solution, the connection information displayed may be:

  • Definition name – The unique definition name. This name appears in the Catalogs subapp.
  • Connection name – The unique name for the connection configured.
  • E-commerce type – The type of external e-commerce solution you are connected to.
  • Authentication URL – Authentication URL for the solution you are connected to.  
  • Base URL – Base URL for the solution you are connected to. 
  • Username and Password – Credentials to access the external solution. Passwords or client secrets can be managed in the Passwords app
  • Connection enabled – Shows if the connection is enabled or not. You may choose to disable the configuration, for example, to improve performance times or to test a connection in one environment before enabling it in another.

Click the Test connection button to check the connection configuration is correct. A message appears indicating if the test is successful or not.

Once you've tested your connection, go to the E-commerce tab. You can see the connections you have configured listed with the catalogs they contain.

Configuring the cache

By default, the content pulled from your external e-commerce solution is updated every 300 seconds (5 minutes). You can configure the cache setting via YAML:

Code Block
languageyml
titleresources/ecommerce/config.yaml
cachingDefinition:
  enabled: true
  invalidateInSeconds: 300

Configuring the images displayed in the E-commerce app

Images stored in your third-party e-commerce solution are displayed in the product detail view of the app from E-commerce module v1.1.1+.

You can configure:

  • If a single image or multiple images are displayed
  • The size of image(s) displayed.

For example:

Code Block
languageyml
titleecommerce-ui/apps/ecommerce.yaml
    form:
      properties:
        images:
          label: Product image(s)
          $type: multipleImageField
          converterClass: info.magnolia.ecommerce.app.productdetail.field.URLsToStrings
          imageRatio: 60
PropertyDescription

images

required

label

optional

Field label displayed to editors. The value can be literal or a key of a message bundle.

If you do not provide the property, Magnolia will fall back to a generated i18n key.

If you do not want to have any label, set the property to an empty string such as label: "" in YAML.

$type

required

Field type:

  • multipleImageField displays all images for the product (use with URLsToStrings converter).
  • URLImageField displays only the first image for the product (use with ListOfURLsToString converter).

converterClass

required

info.magnolia.ecommerce.app.productdetail.field.URLsToStrings converts all images for the product.

info.magnolia.ecommerce.app.productdetail.field.ListOfURLsToString converts only the first image for the product.

imageRatio

optional

Defines the ratio of displayed images to the original images in percentage. In the example above, the value 60 is 60% of the original image size.

If the property isn't set, the images are displayed in their original size.

Configuring text classification and image recognition for e-commerce content

If you have configured them, both Image Recognition and Text Classification are enabled for your e-commerce content.

To trigger the tagging operation, select a product and click Tag product in the E-commerce app action bar. You can view the tags generated in the ecommerce workspace in JCR Browser app (system properties view) or in the Tags app. You can search for products based on the tags in the find bar.

Default configuration:

Code Block
languageyml
titleecommerce-decoration/config.yaml
imageRecogniserEnabled: true
textClassifierEnabled: true
autoRecognitionEnabled: false
PropertyDescription
imageRecogniserEnabled

required, default is true

Enables image recognition functionality for e-commerce content.

Disable this functionality by setting the property to false.

textClassifierEnabled

required, default is true

Enables text classification functionality for e-commerce content.

Disable this functionality by setting the property to false.

autoRecognitionEnabled

required, default is false

Enables automatic tagging.

You can enable automatic tagging by setting the autoRecognitionEnabled property to true.

(warning) This action starts when the user opens a product list and may take a long time to execute.

Release history

E-commerce module 1.2.2

Released on November 30, 2020.

This release brings full compatibility with Magnolia 6.2.5 as well as some bug fixes.

E-commerce module 1.2.1

Released on September 16, 2020.

This release brings full compatibility with Magnolia 6.2.3 as well as some bug fixes.

E-commerce module 1.2

Released on August 20, 2020.

SAP Commerce Cloud Connector 

This release delivers a new connector for SAP Commerce Cloud (formerly Hybris).

The connector includes a new User endpoint for SAP:

  • /users/{userId}/accessToken — To log in a user and obtain the user's access token.
  • /users/{userId}/addresses — To handle stored addresses of users.
  • /users/{userId}/paymentMethods — To handle stored payment methods of users.
Multiexcerpt
MultiExcerptNamecommerceconnectorpackrelease
Hide block
Code Block
languageyml
accessToken
@POST
@Path("/v2/users/{userId}/accessToken")

getUserAddresses
@GET
@Path("/v2/users/{userId}/addresses")

createUserAddress
@POST
@Path("/v2/users/{userId}/addresses")

deleteUserAddress
@DELETE
@Path("/v2/users/{userId}/addresses/{addressId}")

updateUserAddress
@PUT
@Path("/v2/users/{userId}/addresses/{addressId}")

getUserPaymentMethods
@GET
@Path("/v2/users/{userId}/paymentMethods")

updateUserPaymentMethod
@PUT
@Path("/v2/users/{userId}/paymentMethods/{paymentMethodId}")

deleteUserPaymentMethod
@DELETE
@Path("/v2/users/{userId}/paymentMethods/{paymentMethodId}")

Note that the documentation for the new User REST endpoint will be available shortly.

Cart and Checkout endpoint updates

This release provides a V2 of two endpoints:

  • Checkout endpoint — In v2, the checkout endpoint sets the address of a cartId to ensure the correct resource is consistently identified. For example, the v1 /checkouts/address/{cartId} becomes in v2 /checkouts/carts/{cartId}/address.

    Code Block
    languageyml
    setAddress
    @PUT
    @Path("/checkouts/cart/{cartId}/address")
    
    setShippingMethod
    @PUT
    @Path("/checkouts/cart/{cartId}/shippingmethod")
    
    createOrder
    @POST
    @Path("/checkouts/cart/{cartId}/order")
    
    getShippingMethods
    @POST
    @Path("/checkouts/cart/{cartId}/shippingmethods")
  • Cart endpoint — In v2, cartId is a path parameter instead of form parameter in the REST calls. For example the v1 /carts/items becomes in v2 /carts/{cartId}/items. The other parts of the call are unchanged.

    Code Block
    languageyml
    addItem
    @POST
    @Path("/v2/carts/{cartId}/items")
    
    removeItem
    @DELETE
    @Path("/v2/carts/{cartId}/items/{itemId}")
    
    updateItemQuantity
    @POST
    @Path("/v2/carts/{cartId}/items/{itemId}")

The ecommerce-rest-role has been updated to allow the v2 endpoints.

Note that the documentation for both v2 endpoints will be updated shortly.

Note

V1 of the Cart and Checkout endpoints are deprecated from this release on. They will be removed in the next major version of the Commerce Connector Pack.

Product chooser

This release also improves the sample template provided in the Pages app. Magnolia provides a dialog to select the connection, category and product instead of requiring you to manually enter the connection name, definition name and a product ID. If you only have one connection configured, you choose the category and product directly.

List of changes:

E-commerce module 1.1.1

Released on July 7, 2020.

This release introduces compatibility with Magnolia 6.2.2 and an improvement that means images are displayed instead of the URL now in the E-commerce app (see Configuring the images displayed in the E-commerce app). List of changes:

  • [ECOMMERCE-226] - Prod detail sub-app - image field displays image instead of path
  • [ECOMMERCE-295] - Use i18n keys instead of literals for labels in product detail view
  • [ECOMMERCE-254] - Manual tagging action should tag a product even if the product has a tag already

E-commerce module 1.1

Released on April 6, 2020.

This release delivers a new connector for Salesforce Commerce. 

E-commerce module 1.0

Released on July 9, 2019.

Initial release of the Commerce Connector Pack for connecting to e-commerce systems such as Magento and commercetools.

See Commerce Connector Pack for an overview of the functionality provided.

Commerce Connector Pack compatibility

Module versionMagnolia CMS version
1.2.26.2.5
1.2.16.2.3
1.26.2.2
1.1.16.2.2

1.1 

6.2
1.06.1

Include Page
_connector compatibility note
_connector compatibility note

Module versioncommercetools SDK
1.0Tested against 1.48.0
Module versionMagento API
1.0Tested against V1
Module versionSalesforce Commerce API
1.0Tested against 20.4