Documentation
Overview content is shown below. Use the menu to open other pages.
Akeneo → Magento 2 Integration
Purpose
Synchronize product data from Akeneo to Magento 2 reliably. IEC first imports entities into a local schema (Products, Attributes, Families, Categories) and then emits mutations to the Magento 2 Driver to create/update products.
Ingestion from Akeneo
- Config: `config/akeneo.php` (`AKENEO_API_URL`, auth profile, `AKENEO_WEBHOOK_SECRET`).
- Webhooks: `App\Http\Controllers\Ingestion\Webhook\*` endpoints validate signatures via `ValidateWebhookSignature` and trigger imports for changed entities.
- Scheduled/API sync: `php artisan akeneo:import:data {entity} {--codes=} {--full}` uses repositories:
- Akeneo PHP client: https://github.com/akeneo/php-api-client
- `AkeneoProductRepository`, `AkeneoAttributeRepository`, `AkeneoFamilyRepository`, `AkeneoCategoryRepository`
- Actions map Akeneo payloads to local models (`ImportProductAction`, `ImportProductAttributeAction`, `ImportFamilyAction`, `ImportCategoryAction`).
- Akeneo webhooks: https://api.akeneo.com/documentation/webhooks.html
- Incremental filters are built via configured builders (e.g., `UpdatedDateBuilder`) and use ISO 8601 datetimes from settings.
Local Product Model (EAV)
- `products` table with EAV values in `product_attribute_values` keyed by (attribute_code, channel, locale).
- `Product::toIntegrationPayload()` composes identifier, flags, related categories, and flattened attribute values.
Mutation Creation
- `EntityObserver` listens to create/update/delete and computes changed fields:
- Creates a `Mutation` + `MutationJob` per enabled Integration that accepts the entity type.
- Direct attribute changes from Eloquent
- EAV changes tracked by `TracksEavChanges`
Driver Execution (Magento 2)
- `Magento2Driver::handle(MutationData)` logs and delegates to a rules-based payload builder for products.
- HTTP Client: `Magento2ClientBuilder` builds a Guzzle client using Bearer token and base URI. Endpoints under `rest/V1`.
- Mapping lookup to decide `POST` (create) vs `PUT` (update) by external ID.
Magento 2 Payload Builder
- Builder: `Modules/Magento2/Services/Builder/ProductBuilder` composes product payloads and applies modular rules.
- Example rules currently enabled:
- `AttributesRule`: maps Akeneo values to Magento 2 `custom_attributes` with type casting. Now supports a configurable ignore list `config('magento2.product.attributes.mapping.ignore')` so attributes handled by specialized rules (price, assets, websites) are not duplicated.
- `WebsitesRule`: populates `extension_attributes.website_ids` from integration website mapping. Exposes its attribute key as a constant for reuse in config.
- `AssetsRule`: processes asset attributes. Exposes asset attribute codes as a constant for reuse in config.
- `PriceRule`: computes price using `automated_price` when present/valid, otherwise falls back to `selling_price_scope`. Runs only when one of those attributes is present in the change set.
- Store-scoped payloads: the builder can derive per-store requests using store mappings to respect channel/locale scoping. For store-scoped builds, diff-only updates are used only when a per-store mapping exists; otherwise a full payload is built (global "all" mapping).
- `StatusRule`, `ProductTypeRule`
- `CategoryRule`, `AssetsRule`, `WebsitesRule`, `GermanSpecialCharactersRule`
- `PriceRule` (new)
Families & Categories
- Actions:
- Response handlers:
- Category payloads include `labels` translations and `parent_id` from the local model.
- `SyncFamilyAction` (`products/attribute-sets`) updates Magento attribute sets. For updates, the payload is augmented with `attribute_set_id`.
- `SyncCategoryAction` (`categories`) updates Magento categories. For updates, the payload is augmented with `id`.
- `FamilyResponse` sets `entityField = 'attribute_set_id'` for external ID extraction.
- `CategoryResponse` sets `entityField = 'id'` for external ID extraction.
Website/Store Mapping
- Configuration has moved under the Integration’s `field_mapping`:
- Example shape:
- `integrations['<identifier>'].field_mapping.websites`
- `field_mapping.websites = { code: { id, is_default?, channel, stores: [{ id, code, locale, is_default? }] } }`
Payloads
- IEC product payload closely resembles Akeneo output but normalized:
- Drivers are responsible for transforming to Magento 2’s expected schema.
- `identifier`, `enabled`, `family`, `categories`, `values` (list of `{attribute_code, channel, locale, value, unit}`)
Queues & Retries
- MutationJobs for product changes are prioritized via the Integration’s `priority_map` (e.g., price updates as high priority).
- Retries/backoff per Integration.
External References
- Akeneo Webhooks: https://api.akeneo.com/documentation/webhooks.html
- Akeneo PHP Client: https://github.com/akeneo/php-api-client
- Magento 2 REST API: https://developer.adobe.com/commerce/webapi/rest/use-rest/
- Laravel Horizon: https://laravel.com/docs/12.x/horizon
- Laravel: https://laravel.com/
Docs Index
- Overview docs/iec/00-overview.md
- Quickstart docs/iec/01-quickstart.md
- Architecture docs/iec/02-architecture.md
- Data Model docs/iec/03-data-model.md
- Queues & Horizon docs/iec/04-queue-and-horizon.md
- CLI Commands docs/iec/05-commands.md
- Integrations & Drivers docs/iec/06-integrations-and-drivers.md
- Akeneo → Magento 2 docs/iec/07-akeneo-to-magento2.md
- Operations & Troubleshooting docs/iec/08-operations-and-troubleshooting.md
- Mutations docs/iec/09-mutations.md
- Integration Contracts docs/iec/10-integration-contracts.md
- Dashboard docs/iec/11-dashboard.md
- Maintenance & Retention docs/maintenance.md
Current file: docs/iec/07-akeneo-to-magento2.md