actualys/drupal-commerce-connector-bundle
Akeneo PIM bundle to export families, attributes, categories, and products to Drupal Commerce. Supports full or delta product exports, creates product types, fields and taxonomy vocabularies/terms, and integrates with a custom Drupal module for data mapping.
Installation:
composer require actualys/drupal-commerce-connector-bundle
Add the bundle to config/bundles.php in your Symfony/Akeneo PIM project:
return [
// ...
Actualys\DrupalCommerceConnectorBundle\ActualysDrupalCommerceConnectorBundle::class => ['all' => true],
];
Configuration:
Define export profiles in config/packages/actualys_drupal_commerce_connector.yaml:
actualys_drupal_commerce_connector:
endpoints:
drupal_commerce:
host: 'https://your-drupal-site.com'
auth: 'basic' # or 'oauth' if configured
username: 'your_username'
password: 'your_password'
First Use Case:
Trigger the Family export (drupal_commerce_family_export) via Akeneo’s Export Job:
drupal_commerce_family_export).Product Type Synchronization:
text, number, select) to Drupal Commerce fields (e.g., text, decimal, list).config/actualys_drupal_commerce_connector.yaml:
actualys_drupal_commerce_connector:
field_mappings:
drupal_commerce_family_export:
text: 'text_field'
number: 'decimal_field'
select: 'list_text_field'
Product Data Export:
Taxonomy Handling:
actualys_drupal_commerce_connector:
taxonomy:
category_vocabulary: 'products_categories'
attribute_vocabulary: 'product_attributes'
Media/Asset Sync:
image field) and reference them in Akeneo product variants.// src/Service/Export/DrupalCommerceOrderExport.php
class DrupalCommerceOrderExport extends AbstractExport
{
public function __construct(array $options) { /* ... */ }
public function export(): void { /* Implement order export logic */ }
}
Register it in services.yaml:
services:
actualys_drupal_commerce_connector.export.drupal_commerce_order:
class: App\Service\Export\DrupalCommerceOrderExport
tags: ['akeneo_pim_export.export']
Deprecated Akeneo Version:
config/services.yaml or src/Kernel.php.Drupal Module Dependency:
Field Mapping Errors:
entity_reference) may not map cleanly to Akeneo attributes.export.log and check for DrupalCommerceConnectorException errors.Authentication Issues:
oauth2_server module is configured and the Akeneo client credentials are valid.actualys_drupal_commerce_connector.endpoints.drupal_commerce.auth in config.# config/packages/monolog.yaml
handlers:
akeneo_export:
type: stream
path: "%kernel.logs_dir%/export.log"
level: debug
var/export/drupal_commerce_family_export.csv) for malformed data.Custom Exporters:
Extend Actualys\DrupalCommerceConnectorBundle\Export\AbstractExport to add new export types (e.g., for promotions or inventory).
Pre/Post-Export Hooks:
Use Akeneo’s export.pre and export.post events to modify data before/after export:
// src/EventListener/ExportListener.php
class ExportListener
{
public function onExportPre(ExportPreEvent $event) {
$data = $event->getData();
// Modify $data (e.g., transform units)
}
}
Register the listener in services.yaml:
services:
App\EventListener\ExportListener:
tags:
- { name: kernel.event_listener, event: akeneo_pim_export.pre, method: onExportPre }
Webhook Integration:
Replace file-based exports with Drupal REST API calls by extending the DrupalCommerceClient:
// src/Client/DrupalCommerceApiClient.php
class DrupalCommerceApiClient extends AbstractClient
{
public function createProductType(array $data): array {
return $this->httpClient->post('/api/product-types', [
'json' => $data,
]);
}
}
How can I help you explore Laravel packages today?