Magento2 connector

You can configure Magento2 connector with the Product Master application.

Product Master - Magento2 connector is a downstream connector for publishing the items to the Adobe Magento2 e-commerce platform.

Prerequisites

Magento Connector supports Magento 2.4 version with following prerequisites.
  • You need to configure the following Lookup tables.
    Connector Configuration Lookup Table
    Connector Configuration Lookup Table provides mapping between catalog and the Magento2 connector. Using the following format, configure catalog for the Magento publication.
    Attribute Name Description
    Catalog Name The name of the catalog for which publication is required.
    Connector The name of the connector, example Magento.
    Enable Enable connector for a selected catalog. Valid value can be True or False.
    Hierarchy Name The name of the hierarchy.
    Key Auto generated primary key of the entry.
    Publish Category

    Enable or disable category publication. Valid value can be True or False.

    Publish Format The type of product publication content. For Magento, the format is JSON.
    Queue The name of the Hazelcast Queue where products are published.
    Note: If you are configuring Magento connector for multiple catalogs, then all the catalogs should have same publishing queue.
    Root Category The full path of the root category. Only categories inside the root category are published.
    Note: If no categories are specified in the root category, then the item gets mapped to the default category of the Magento2.
    Transformer Class The custom transformation class name. If empty, signifies default transformation is used.
    For custom implementation, provide the class full package name.
    Example
    com.ibm.ipm.CustomImplementation
    Connector Category To Spec Map Lookup Table
    Connector Category To Spec Map Lookup Table is used to define Spec Map associated for a respective category. Using the following format, configure spec map to a category for the Magento publication.
    Attribute Name Description
    Catalog Name The name of the catalog for which publication is required.
    Category The full path of the category for which spec maps need to be defined.
    Connector The Lookup table reference of the Connector Configuration Lookup Table.
    Hierarchy Name The name of the hierarchy.
    Key Auto generated primary key of the entry.
    Spec Map A comma-separated list of the spec maps required to generate product JSON.
  • You need to configure a spec map. A spec map is used to prepare a product JSON that is then published at the Magento endpoint. It is used to specify mapping of the Product Master item attributes with the Magento attributes for each category. For more information, see Spec Map Console.
    Note:
    • You should map multi-occurrence attributes of the Product Master only to the multi-occurrence attribute of the Magento.
    • For adding any custom attributes in the Magento, you need to simple fields in custom attribute grouping attribute.
      For example, if you have color custom field where attribute_code=color
      you can define, simple string attribute inside Custom_attribute grouping node.
      Custom_atribute – [grouping]
         -color

    To get started with the Magento connector publication, Magento data model imports some spec maps, for example; VariantToMagentoMap, VariantToMagentoExtensionMap, VariantToMagentoMediaMap. You can update the existing spec map or create a new spec map for the selected category and update the Connector Category To Spec Map Lookup Table.

    Using the Admin UI, you can import the sample Magento data model (connectors_magento2_datamodel.zip) from the $TOP_CONNECTOR/connectors/mdmce-magento2-connector/datamodel folder.

  • Also, import the connectors_basemodel.zip file that is located in the following folder:

    $TOP_CONNECTOR/connectors

  • Magento connector uses Asynchronous Bulk APIs, hence RabbitMQ must be installed and should be running. For more information, see RabbitMQ.
  • Use the bin/magento queue:consumers:start async.operations.all command to start the consumer that handles asynchronous and bulk API messages.
  • Configure and enable Hazelcast.

Working with the Magento2 connector

Magento2 connector provides a simple way to publish an item to the Magento2 marketplace right from catalog. Configure Connector configuration by using Lookup tables and select any item from the respective catalog in the single-edit or multi-edit page. A Publish button is visible that lists number of configured endpoints where the item needs to be published. Select Magento and item is sent for further processing of publication. During publication, item flows through many processing stages and respective state are updated in the Publication Details of the item.
Status Description
REQUEST_INITIATED Item details are being processed. The product JSON file is prepared, and sent to the Magento connector for publication.
REQUEST_INPROGRESS Item details and product JSON file are being read by connector for further processing.
REQUEST_SUCCESSFUL Item successfully published at the Magento endpoint.
REQUEST_FAILED Item failed to publish at the Magento endpoint.
Tip: If your catalog items have images, update the value of the max_allowed_packet=100M property in the my.ini file (Windows) or my.cnf file (Linux®) in the Magento endpoint. By default, the Magento connector sends 10 items in a single batch to the Magento endpoint. If the sizes of images are large, then calculate the size of the max_allowed_packet property depending on the bulk.export.batch.size property in the application.properties file and number of images.

Installing the connector

Proceed as follows to install the connector:

  1. Browse to the $TOP_CONNECTOR/connectors folder.
  2. Locate and extract the ipm12_connectors_12.0.0.X_YYYYDDMMZZZ.tar.gz base file.
  3. Set the $TOP_CONNECTOR environment variable to point to the extracted folder:
    export $TOP_CONNECTOR=/opt/connectors/mdmce-connectors
  4. Enable the connector in the $TOP_CONNECTOR/conf/connector_settings.ini file.
  5. Run the installer script.
    cd $TOP_CONNECTOR
    cd bin ./install.sh
  6. Update the application.properties file located in the following folder:

    $TOP_CONNECTOR/connectors/mdmce-magento2-connector/conf

    For more information, see Updating properties file.
  7. Start the connector from the $TOP_CONNECTOR/connectors/bin folder:
    ./start_connectors.sh magento2
    ./start_connectors.sh -all
    Stop the connector through the following command:
    ./stop_connectors.sh -all or ./stop_connectors.sh magento2
  8. Check status of the connector through the following command:
    ./status_connectors.sh -all or ./status_connectors.sh magento2
Message archive service starts and stops automatically depending on the connection status of the Magento connector. If needed, message archive service can also be started manually. For more information, see Message archive service.

Updating properties file

You need to update the following parameters in the application.properties file.
MDM company configuration
mdm.company.user=<user_name>
mdm.company.password=<password>
mdm.company.company=<company>
MDM Server configuration
mdm.server.topDir=<$TOP>
mdm.server.etcDir=<$TOP>/etc
Database-related parameters
app.datasource.url=jdbc:db2://<hostname>:<port>/<databasename>
app.datasource.username=<username>
app.datasource.password=<password>
Hazelcast client configuration
mq.groupName=mdmce-hazelcast-instance
mq.networkIpAddress=<hazelcasthostaddress>:5702
mq.requestQueueUri=hazelcast-seda:magento2_connector_item_publish_queue?pollTimeout=1000&concurrentConsumers=5&transferExchange=false&transacted=false&hazelcastInstance=#hazelcastInstance
mq.bulkUUIDQueueUri=hazelcast-seda:magento2_connector_put_bulk_uuid_queue?pollTimeout=1000&concurrentConsumers=5&transferExchange=false&transacted=false&hazelcastInstance=#hazelcastInstance
Magento2 configuration
magento2.accessTokenUrl=http://<magentohost>/magento2/rest/V1/integration/admin/token
magento2.username=
magento2.password=
magento2.product.bulk.request.url=http://<magentohost>/magento2/rest/default/async/bulk/V1/products
magento2.product.bulk.request.stats.url=http://<magentohost>/magento2/rest/V1/bulk/%s/detailed-status
magento2.category.create.request.url=http://<magentohost>/magento2/rest/V1/categories?fields=id,parent_id,name
magento2.category.search.request.url=http://<magentohost>/magento2/rest/V1/categories/list

Installing and configuring Hazelcast

For more information, see Installing Hazelcast.

Troubleshooting

The logs for the connector are created in the $TOP_CONNECTOR/logs folder.

  1. If there is a Consumer is not authorized to access error, then verify your Magento URL and credentials.
  2. If there is an Invalid product data error on publishing an item, then verify the values of mandatory attributes set in the item.