Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Drupal Commerce Connector Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. 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],
    ];
    
  2. 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'
    
  3. First Use Case: Trigger the Family export (drupal_commerce_family_export) via Akeneo’s Export Job:

    • Navigate to Akeneo PIM → Export → Create Export Job.
    • Select the Family export profile (drupal_commerce_family_export).
    • Run the job to generate a Drupal Commerce product type, fields, and taxonomy vocabularies.

Implementation Patterns

Workflow Integration

  1. Product Type Synchronization:

    • Use the Family export to sync Akeneo product families to Drupal Commerce product types.
    • Map Akeneo family attributes (e.g., text, number, select) to Drupal Commerce fields (e.g., text, decimal, list).
    • Example mapping in 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'
      
  2. Product Data Export:

    • Export individual products using the Product export profile (if available or custom-built).
    • Schedule exports via Akeneo’s Cron Jobs or trigger manually for incremental updates.
  3. Taxonomy Handling:

    • The bundle auto-creates taxonomy vocabularies (e.g., for categories or attributes).
    • Customize vocabulary labels/terms via Akeneo’s Attribute Options or override in config:
      actualys_drupal_commerce_connector:
          taxonomy:
              category_vocabulary: 'products_categories'
              attribute_vocabulary: 'product_attributes'
      
  4. Media/Asset Sync:

    • For images/videos, extend the bundle or use Akeneo’s Media Export alongside this connector.
    • Store file paths in Drupal Commerce fields (e.g., image field) and reference them in Akeneo product variants.

API-Driven Extensions

  • Custom Endpoints: Extend the bundle to support additional Drupal Commerce APIs (e.g., Orders, Customers) by creating a new export profile:
    // 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']
    

Gotchas and Tips

Pitfalls

  1. Deprecated Akeneo Version:

    • The bundle was last updated in 2015 and may not support Akeneo PIM 5.x+. Test thoroughly or fork the repo for compatibility.
    • Workaround: Override deprecated services/classes in config/services.yaml or src/Kernel.php.
  2. Drupal Module Dependency:

    • Requires a custom Drupal module to handle incoming data (e.g., parsing CSV/XML exports).
    • Tip: Use the Feeds module to import Akeneo exports into Drupal.
  3. Field Mapping Errors:

    • Drupal Commerce field types (e.g., entity_reference) may not map cleanly to Akeneo attributes.
    • Debugging: Enable Akeneo’s export.log and check for DrupalCommerceConnectorException errors.
  4. Authentication Issues:

    • If using OAuth, ensure Drupal’s oauth2_server module is configured and the Akeneo client credentials are valid.
    • Fix: Verify actualys_drupal_commerce_connector.endpoints.drupal_commerce.auth in config.

Debugging Tips

  • Enable Verbose Logging:
    # config/packages/monolog.yaml
    handlers:
        akeneo_export:
            type: stream
            path: "%kernel.logs_dir%/export.log"
            level: debug
    
  • Validate Export Files: Manually inspect generated CSV/XML files (e.g., var/export/drupal_commerce_family_export.csv) for malformed data.

Extension Points

  1. Custom Exporters: Extend Actualys\DrupalCommerceConnectorBundle\Export\AbstractExport to add new export types (e.g., for promotions or inventory).

  2. 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 }
    
  3. 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,
            ]);
        }
    }
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor