Page tree
Skip to end of metadata
Go to start of metadata

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

Prerequisites

We assume you are familiar with Magnolia, Maven and Java.

Before configuring the connector, make sure you have:

  • A running instance of Magnolia with the Commerce Connector Pack.
  • Access to your e-commerce solution documentation (including the API documentation).
  • Administrator access to your external e-commerce solution for testing.

Configuration

Complete the steps below to configure your connector.

Create your Maven module

  1. Create your Maven module.
  2. You Maven module must depend on:

    <dependency>
      <groupId>info.magnolia.ecommerce</groupId>
      <artifactId>magnolia-ecommerce</artifactId>
      <version>1.0</version>
    </dependency>
  3. Your module class should implement ModuleLifecycle and close all client providers upon stopping the module. For reference see info.magnolia.ecommerce.magento.EcommerceMagentoModule 

Implement the provider

Implement the EcommerceClientProvider according to the connection type you want to use to connect to your external e-commerce solution:

  • RestClientProvider – REST-based client provider. For an example, see info.magnolia.ecommerce.magento.MagentoRestClientProvider and the info.magnolia.ecommerce.magento.client.MagentoHttpClient client implementation based on the org.apache.http package.
  • 3rdPartyClientProvider – External e-commerce SDK-based client provider. This provider differs for each external e-commerce solution. For an example, see info.magnolia.ecommerce.commercetools.SphereClientProvider.

Implement the data suppliers and required cart and checkout functionality

  1. Implement DataSuppliers for products and categories:
    • info.magnolia.ecommerce.common.Products – check for the required list of suppliers for products.
    • info.magnolia.ecommerce.common.Categories  – check for the required list of suppliers for categories.
      See info.magnolia.ecommerce.magento.common.MagentoCategory for an example of how to map the JSON received.
  2. Implement the required functions for the cart: info.magnolia.ecommerce.cart.CartProvider
  3. Implement the required functions for the checkout process: info.magnolia.ecommerce.checkout.CheckoutProvider
  4. Cart and checkout providers use multi-binding so they must be annotated by @Multibinding and added to the module descriptor as components for injection. For an example, see ecommerce-magento-connector.xml 

Define your connector

Using info.magnolia.ecommerce.common.DefaultEcommerceDefinition, create your connector definition configuration file under: <your-module-name>/ecommerces/<definition-name>.yaml.

For an example, see ecommerce-magento-connector/ecommerces/magento.yaml.

Conclusion

To finish:

  1. Install your connector in the Magnolia instance that contains the ecommerceecommerce-templating and ecommerce-ui modules.
  2. Set the connection parameters to your external e-commerce solution.

You can then use the default E-commerce app, ecomfn templating functions and REST endpoints.