Magento Connector
Overview
Applicable versions
The following Magento version has currently been tested and are approved for this version of the Perfion Connector:
Magento Open Source 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.7
Magento Commerce / Magento Commerce Cloud 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.7
The basics of what this connector does
The connector (depicted in a very simplified way in Figure 1) works as follows:
Magento asks Perfion for data based on the configured channels. Data can be attributes, categories, and products. Perfion will provide that data in the way that it has been mapped in Perfion for the given Ecommerce Channel. The Perfion Connector will process the received data and create the attributes, categories, and products.
Installation
Prerequisites
Before installing the connector make sure, you have the following prerequisites set up:
You have a running Magento 2 installation with the latest version of PHP 8.1 (or higher) running. Please
consult official Magento 2 system requirements for your version:
a. Magento 2.4: https://experienceleague.adobe.com/en/docs/commerce-operations/installationguide/system-requirementsComposer (https://getcomposer.org/) installed and executable on the server.
You have a Perfion Database v. 5.0 (or newer).
You have a Perfion API set up on IIS Perfion running at least 5.0 (or newer). The Perfion API endpoint must
be accessible from the Magento server.
a. Please note: If a firewall protects your Perfion instance in your infrastructure setup, please put all
Magento server IPs in the allow list of your firewall.Your Perfion license must include licenses for the Perfion Ecommerce API with at least one Ecommerce
Channel and the Magento 2 connector.
Ecommerce API in Perfion
All configuration for the Ecommerce API if found under “Feature Data” in Perfion. Go to “Feature Data”, then expand the “String”-features node and finally expand the “ECommerce Features”-node. Here you will find seven selectable features where some needs to be filled out by you and the rest can and should be left as is.
Below is an overview on what each of the ECommerce-features on the left-hand side contains:
ECommerce Channel: Here you create all the channels you needed. Roughly speaking, you will need a channel per output channel. For the Magento Connector you are likely to need one channel per store .
ECommerce Entity: Here are a list of all entities supported currently by the ECommerce API: Site, Category, Product, Variant and Language Deviation. This is used internally by the connector and should not be modified.
ECommerce Mapping: Here you find all mappings from Perfion to some Channel (that is, to Magento). A mapping is a way of expressing that “X in Perfion is called Y in Magento”. All mappings can be edited by clicking this node. This is where the main part of the configuration of the connector will take place, and we will do that in section 3.1.5.
ECommerce Output Kind: Here is a list of all the Output Kinds, that is, ways of expressing how the “Y” from previous item should be output knowing “X”.
ECommerce Settings: Here you find the settings needed to set up the Connector.
ECommerce System: Here you will find a list of ECommerce Systems to pick from. Version 4.5.52 auto creates four ECommerce Systems: Shopify, Ucommerce, Sana and Magento, since these are the systems recognized by Perfion and the systems for which Perfion provides a connector. If you are making your own output from the ECommerce API, it makes good sense to add a new ECommerce System to this list.
Note: From version 4.5.52, when accessing the ECommerce API for data belonging to one of the known channels, it is checked that the Perfion license does include a license to connector used.ECommerce Type: This is just a selectable feature that you will need if you want to use support for variants. The two values here “Product” and “Variant” should not be modified in any way. Support for variants is described in Magento Connector | Mapping variants
Installing the connector in Magento
An installation via Composer is the only valid way to properly install and manage the connector in a Magento 2 instance.
For installation, please login to your server via SSH on your command line interface (CLI) and navigate to the directory with the Magento installation.
Installing the connector on Magento Open Source
Require necessary packages in the project and install the packages
composer require perfion/perfion-magento-connector
php bin/magento setup:upgrade
Enable the connector modules and run the database migrations
php bin/magento module:enable Perfion_ObjectDataImporter
php bin/magento module:enable Perfion_Connector
php bin/magento setup:upgrade
Installing the connector on Magento Commerce / Magento Cloud
Require necessary packages in the project and install the packages
composer require perfion/perfion-magento-connector
composer require perfion/perfion-objectdata-importer-magento2-commerce
php bin/magento setup:upgrade
Enable the connector modules and run the database migrations
php bin/magento module:enable Perfion_Connector
php bin/magento module:enable Perfion_ObjectDataImporterCommerce
php bin/magento setup:upgrade
Updating the connector in Magento
Updating the connector in Magento 2 only requires a straightforward command after you’ve logged onto the server and navigated to the path of your Magento installation.
Important: It may be possible that you need to modify the version of the connector in the composer.json file of Magento as well for you to receive a new major version of the connector. Perfion will communicate such a change accordingly with the release notes.
Updating the connector on Magento Open Source
composer update perfion/perfion-magento-connector
php bin/magento setup:upgrade
Updating the connector on Magento Commerce / Magento Commerce Cloud
composer update perfion/perfion-magento-connector
composer update perfion/perfion-objectdata-importer-magento2-commerce
php bin/magento setup:upgrade
Configuring the connector
This chapter takes you through all configuration needed for setting up the connector for the first time. First section will take you through the necessary steps in the Magento backend interface. The next section will take you through the steps needed in Perfion.
When you have completed this chapter, you have a very basic setup of Magento 2 with the Perfion Connector.
Configuration in Perfion
The next sections will take you through all the necessary steps to set up an entire configuration for a connector for a website in Perfion.
Set up a website feature for your Magento instance
To get started, you need to create a dedicated feature for your Magento store.
You simply can name the new feature “Magento”. But if you plan to connect multiple Magento stores to your Magento store, it is recommended to name the feature based on the name of your store.
After that, click on the three dots at the main menu at the bottom and open the section designer menu. In the section “Website” add a new option by clicking on the grey cell above “Sana Commerce” and create a new option either via right-click and “Add New” or by hitting CTRL+N on your keyboard.
After that, go to Channels in the Administration menu and create a new channel as below. Make sure that the appropriate users has access to the new channel
Set up your category structure
While you could just use the default category structure for the Magento Connector, it is highly recommended to create your own category structure. It is required to set it up like this if you plan to connect your Perfion instance to more than one Magento store.
The following example in Figure 5 shows the default category structure on the left-hand side at the top and a custom category structure on the left-hand side at the bottom.
After you’ve set up the category structure, you can simply add the products via drag and drop from the right-hand side to the category on the left-hand side.
Create Ecommerce Channel
A Channel is the ECommerce API equivalence of a store (aka storeview) in Magento. Please go to “Feature Data” - “String” - “ECommerce Features” - “ECommerce Channel” in Perfion and create a new channel for your Magento store as shown in Figure 6:
Create Ecommerce Search
For an ecommerce channel to only retrieve the products that are assigned to a specific store, you need to configure an ecommerce search beforehand.
The following example only retrieves the products from the new feature (Magento) that we just created:
Create Ecommerce Mappings
The following mappings must be configured:
Language Deviation
Category
Product
Important information for creating the Ecommerce Mapping:
Magento has fixed rules about the attribute code names, which will be created automatically based on the Perfion features. When you specify the field names in the Ecommerce Mapping, please keep the following rules in mind:
Max. 60 characters
Start with a letter
Only contain letters and numbers
Lowercase (Magento connector takes care of that in case you forget)
No whitespace (Magento connector takes care of that in case you forget)
These rules are essential especially if you’re using the Wildcard selector in the Perfion Ecommerce Mapping, where Perfion will use the Feature name as the field name.
If a Feature/Field name doesn’t match the criteria mentioned above, the connector will not create the attribute.
Magento has a fixed set of default attributes that can be used in the Ecommerce Mapping. If you plan to do that, please make sure that the data types match.
Example: In Magento, the “color” attribute is a single select attribute. If you have the same attribute in Perfion but as a “multi-value” feature, the data types won’t match, and there will be a conflict during import. In this case, do not map your “color” feature to the “color” attribute of Magento but specify a custom field name (e.g. customername_color).
Language Deviation Mapping
The Language Deviation mapping is used to store the product data for a specific store view in Magento. Please specify all Perfion-internal language codes that you want to use in Magento to the specific Magento store-view codes.
Please note:
You must specify the store view code in the Ecommerce Mapping exactly the same as you created the store view codes in Magento.
If you, for example, have multiple store views in Magento that should use English language, you can map one language in Perfion to multiple store views. Please make sure to always map you’re default language to “admin” so that Magento has values on global scope as well.
If you only use one language in Perfion, please specify the mapping for “admin”, which represents the global scope of Magento.
Category Mapping
In the Ecommerce Mapping, please create a new “Context” for Ecommerce Entity “Category” and add features/fields to the mapping.
Please note that as “feature” name you must enter the name of the new feature you just created for the store. In our example it would be “Magento”.
Please make sure that you always map the following mandatory fields:
Field | Description |
perfion_id | The Perfion internal ID of an entity. |
name | The name of the category. |
store | Must contain the store view code from Magento where the categories should be assigned to. In a default Magento installation this is “default”. |
is_active | If a category is enabled/disabled. You must provide “1” for enabled or “2” for disabled. |
included_in_menu | If a category should be included in the Magento category navigation. You must provide “1” if it should be included or “2” if it should be hidden. |
is_anchor | If a category should show the products of the child categories. You must provide “0” for “No” or “1” for “Yes”. |
meta_title | Optional: If not filled in, it leaves seo data in Magento as-is |
meta_description | Optional: If not filled in, it leaves seo data in Magento as-is |
meta_keywords | Optional: If not filled in, it leaves seo data in Magento as-is |
Image | Optional: The image for that category only one image is allowed |
enable_category_image | Optional: If the connecter should use the image send from perfion or use the one in magento. You must provide "0" or not set it if you want to use magento images and "1" if you want to use the image from perfion. This setting is checked for every category. |
Important: If you don’t have a dedicated feature for one of these mandatory fields you must provide a default value. If you have a dedicated feature, please make sure that it has a default value as well.
Product Mapping
In the Ecommerce Mapping, please create a new “Context” for Ecommerce Entity “Product” and add features/fields to the mapping.
As feature name you please specify “Product/WebDetail/NAME_OF_YOUR_ECOMMERCE_SERACH” to receive only products in the mapping that are assigned to the categories for this store.
Mandatory fields:
Field | Description |
perfion_id | The Perfion internal ID of an entity. |
sku | The SKU of the product. This must be a unique value! |
name | The name of the product. |
websites | Must contain the website code from Magento where the categories should be assigned to. In a default Magento installation this is “base”. |
status | If a product is enabled/disabled. You must provide “1” for enabled or “2” for disabled. Please note, products that are set to 2 will not get a URL generated in Magento, since the product is not accessible. |
visibility | The visibility of the product in the store must be one of these options:
Please note, products that are set to 1 will not get a URL generated in Magento, since the product is not accessible directly. |
image | Magento has 3 different types of images for products . You can either select the same image for all three images or select an individual image for either one of the image types. |
small_image | |
thumbnail | |
categories | The assigned categories for a product. |
product_store | The store view code. The product information will be assigned to this store vi |