After you have configured Drupal with your chosen languages, and configured Magento with the locales and store views that will match up to those languages, you must map the Drupal languages to Magneto store views as a pair in the Commerce Connector Service, enabling them to communicate with each other and synchronize product information.
To create a mapped pair:
Obtain a User ID, key, and secret from your Acquia Administrator, such as your Onboarding Success Engineer.
Create authorizations for your systems. Drupal language and Magento store views are systems.
Add the systems using either your site or user keys, and then link them to the auth details created in the previous step. There must be one system for each Drupal language and one system for each Magento store view.
Create a mapping that links Magento to Drupal using either your site or user key and secret.
Note
All endpoints are secured with
HMAC authentication. You can
use Postman to include a pre-request
script to perform the HMAC authentication for you. Acquia has an example
Postman file, prerequestscript.js
, available for download.
Contact your Acquia Administrator for additional details.
Each request to the Commerce Connector Service must use the following HMAC headers:
Authorization:{{acqHmacHeader}}
X-Authorization-Timestamp:{{acqHmacTimestamp}}
// If the request includes a body then you must also include:
X-Authorization-Content-SHA256:{{acqHmacContentSha}}
Acquia will provide the user ID
, hmac_key
, and hmac_secret
for the created user.
Add the systems
Next, you will add system definitions for Magento and Drupal.
Add a Magento store view as a system
Repeat this API call for each Magento store view to be configured.
API Endpoint:
${CONNECTOR_URL}/v2/config/system/create
Request type
Request body
POST
{ "name":"${BACKEND_SYSTEM_NAME}", // Magento system name "description":"${BACKEND_SYSTEM_DESC}", \ //Magento system description "type":"${BACKEND_TYPE}", // System type, in this case "magento" "url":"${BACKEND_URL}", // Full system URL, INCLUDING a trailing slash, such as https://your-magento-host-url.com/rest/store_view_code/V1/" "uuid":"${BACKEND_UUID}", // The language used, such as en_US "site_id":${SITE_ID}, // The Magento site_id from before "auth_id":${AUTH_ID}, // The auth_id created earlier "token_url":"${BACKEND_TOKEN_URL}", "skip_ssl":${SKIP_SSL} }
This request returns a
system_id
for the Magento system created. You will need thesystem_id
and the store view when creating the mapping.Add a Drupal system
Next, you create a Drupal system for a given language. You must repeat this API call for each language you wish to add.
API Endpoint:
${CONNECTOR_URL}/v2/config/system/create
Request type
Request body
POST
{ "name":"${FRONTEND_SYSTEM_NAME}", // Drupal system name "description":"${FRONTEND_SYSTEM_DESC}", // Drupal System description "site_id":${SITE_ID}, // The site_id from previous steps "auth_id":${AUTH_ID}, // Your Drupal system auth_id "type":"${FRONTEND_TYPE}", // The system type, in this case 'drupal' "url":"${FRONTEND_URL}", // URL for your Drupal host, without a trailing slash. "uuid":"${FRONTEND_UUID}", // The ACM ID for this language "token_url":"${FRONTEND_TOKEN_URL}", "skip_ssl":${SKIP_SSL} }
This request returns a system_id
for the Drupal system created. You
will need the list of all returned system_id
responses, and
languages they correspond to, when creating the mapping.
Map the systems together
Finally, configure the Commerce Connector Service to map a specific Magento store view to a specific Drupal language configuration. Repeat this API call for each Drupal language to Magento store view mapping required.
API Endpoint: ${CONNECTOR_URL}/v2/config/mapping/create
Request type | Request body |
---|---|
| {
"name":"${MAPPING_NAME}", // The name of the mapping, such as 'Drupal EN to Magento EN'
"description":"${MAPPING_DESC}", // Description of the mapping
"backend_id":${BACKEND_SYSTEM_ID}, // The Magento system_id
"frontend_id":${FRONTEND_SYSTEM_ID}, // The Drupal system_id
"site_id":${SITE_ID} // The site_id
}
|
A mapping example
If you have a store with three languages, in three locations, your configuration process would look like this example:
One Drupal installation with three languages:
EN
- EnglishFR
- FrenchES
- Spanish
One Magento installation with three locales:
en_US
- US Englishfr_CA
- French Canadianes_MX
- Mexican Spanish
When the Drupal and Magento installations are mapped appropriately, then within the Commerce Connector Service you will have created the following setup, which connects your store in all three languages:
One site
Two authorizations - one to connect to Drupal’s OAuth and one to connect to Magento’s OAuth
Three Drupal systems - one for each language
Three Magento systems - one for each store view (locale)
Three mappings - one for each language-locale pair