Akeneo - Installation and Configuration


To install AkeneoPim, add AkeneoPimMiddlewareConnector by running the console command. Set akeneo/api-php-client version that you need.

composer require akeneo/api-php-client:^4.0.0 spryker-eco/akeneo-pim:^1.0.0 spryker-eco/akeneo-pim-middleware-connector:^1.0.0

Global Configuration

Add SprykerMiddleware to your project’s core namespaces:

$config[KernelConstants::CORE_NAMESPACES] = [

To set up the Akeneo initial configuration, use the credentials you received from your PIM:

$config[AkeneoPimConstants::HOST] = '';
$config[AkeneoPimConstants::USERNAME] = '';
$config[AkeneoPimConstants::PASSWORD] = '';
$config[AkeneoPimConstants::CLIENT_ID] = '';
$config[AkeneoPimConstants::CLIENT_SECRET] = '';

Next, specify your paths to the additional map files:

$config[AkeneoPimMiddlewareConnectorConstants::LOCALE_MAP_FILE_PATH] = APPLICATION_ROOT_DIR . '/data/import/maps/locale_map.json';
$config[AkeneoPimMiddlewareConnectorConstants::ATTRIBUTE_MAP_FILE_PATH] = APPLICATION_ROOT_DIR . '/data/import/maps/attribute_map.json';
$config[AkeneoPimMiddlewareConnectorConstants::SUPER_ATTRIBUTE_MAP_FILE_PATH] = APPLICATION_ROOT_DIR . '/data/import/maps/super_attribute_map.json';

This being done, specify the ID of the category template that should be assigned to the imported categories:

$config[AkeneoPimMiddlewareConnectorConstants::FK_CATEGORY_TEMPLATE] = 1;

Next, specify the name of a tax set for the imported products:

$config[AkeneoPimMiddlewareConnectorConstants::TAX_SET] = 1;

Finally, specify the locales that should be imported to shops and stores in which imported products are to be available, and specify how prices should be mapped according to locales:

$config[AkeneoPimMiddlewareConnectorConstants::LOCALES_FOR_IMPORT] = [
$config[AkeneoPimMiddlewareConnectorConstants::ACTIVE_STORES_FOR_PRODUCTS] = [
$config[AkeneoPimMiddlewareConnectorConstants::LOCALES_TO_PRICE_MAP] = [
	'de_DE' => [
		'currency' => 'EUR',
		'type' => 'DEFAULT',
		'store' => 'DE',
	'en_US' => [
		'currency' => 'USD',
		'type' => 'DEFAULT',
		'store' => 'US',

Dependency Configuration

Add Middleware Process console command to src/Pyz/Zed/Console/ConsoleDependencyProvider.php in your project:

use SprykerMiddleware\Zed\Process\Communication\Console\ProcessConsole;
protected function getConsoleCommands(Container $container)
   $commands = [
       new ProcessConsole(),
   return $commands;

Create ProcessDependencyProvider on a project level for specifying ConfigurationPlugins. Add src/Pyz/Zed/Process/ProcessDependencyProvider.php file:

namespace Pyz\Zed\Process;
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Communication\Plugin\Configuration\AkeneoPimConfigurationProfilePlugin;
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Communication\Plugin\Configuration\DefaultAkeneoPimConfigurationProfilePlugin;
use SprykerMiddleware\Zed\Process\Communication\Plugin\Configuration\DefaultConfigurationProfilePlugin;
use SprykerMiddleware\Zed\Process\ProcessDependencyProvider as SprykerProcessDependencyProvider;
class ProcessDependencyProvider extends SprykerProcessDependencyProvider
     * @return \SprykerMiddleware\Zed\Process\Dependency\Plugin\Configuration\ConfigurationProfilePluginInterface[]
    protected function getConfigurationProfilePluginsStack(): array
        $profileStack = parent::getConfigurationProfilePluginsStack();
        $profileStack[] = new DefaultConfigurationProfilePlugin();
        $profileStack[] = new AkeneoPimConfigurationProfilePlugin();
        $profileStack[] = new DefaultAkeneoPimConfigurationProfilePlugin();
        return $profileStack;

Import Configuration

Firstly, extend the AkeneoPimMiddlewareConnector module on a project level. Create src/Pyz/Zed/AkeneoPimMiddlewareConnector folder.

Inside the module, implement plugins for writing data (categories, attributes, abstract and concrete products) into the shop. Add the following plugins to src/Pyz/Zed/AkeneoPimMiddlewareConnector/Communication/Plugin:

  • AttributeDataImporterPlugin
  • CategoryDataImporterPlugin
  • ProductAbstractDataImporterPlugin
  • ProductDataImporterPlugin

Find an examplary plugin implementation below.

Implement your own DataImporter for importing products to the shop database. It can be a business module inside the AkeneoPimMiddlewareConnector module. Example:

Implement facade methods for the AkeneoPimMiddlewareConnector module. Example:

class AkeneoPimMiddlewareConnectorFacade extends SprykerAkeneoPimMiddlewareConnectorFacade implements AkeneoPimMiddlewareConnectorFacadeInterface
     * @param array $data
    public function importProductsAbstract(array $data): void

Dataset Step Broker and Writer

Business Factory method is used for Importer creation. Determine the data writing approach and how you want to broke the payload. The AkeneoImporter you implemented usually expects the implementation of \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerInterface.

For better understanding, see the example of the AkeneoDataImporter creation for importing abstract products in AkeneoPimMiddlewareConnectorBusinessFactory.

As you can see, in DataSetStepBroker, you can add your own steps for preparing data for writers. You can find ready made steps in the DataImport module or implement your own steps. Example:

You can change default data mappers and translators for overriding keys or values. By default, Akeneo has a list of predefined mappers, translators and validators for each import type, but it can be adjusted to meet your requirements. Check the middleware documentation for more details.

You also need to take care of that data that is to be written to the database. Two approaches can be used for that.

For attributes and categories, Spryker has implemented writer steps, so no plugins are required for that. Example:

The example demonstrates how you can skip adding plugins for writing data to the database.

Product import is a more complex operation, so Spryker provides bulk insertion plugins for that. They are faster than the writer steps.

You can use the existing plugins or create your own. The right way to add external plugins is to use dependency providers. We have two types of writer plugins: Propel plugins and PDO plugins. Check the examples for both of them below.

When we use only ProductAbstractPropelWriterPlugin, ProductStores, ProductPrices, etc are not imported. If you want to import something other than products, you need to add more writer plugins.

For example, if you want to import a product store, provide one more plugin in dependency provider.

In case you add more writer plugins, you might have to add more steps to dataset step broker.

Console Commands

Now the following console commands are available in your project. Run them one by one.

1) Command to import super attributes:
vendor/bin/console middleware:process:run -p SUPER_ATTRIBUTE_IMPORT_PROCESS -o data/import/maps/super_attribute_map.json
2) Command to prepare locale mapping:
vendor/bin/console middleware:process:run -p LOCALE_MAP_IMPORT_PROCESS -o data/import/maps/locale_map.json
3) Command to prepare products attributes mapping:
vendor/bin/console middleware:process:run -p ATTRIBUTE_MAP_PROCESS -o data/import/maps/attribute_map.json
4) Command to import categories:
vendor/bin/console middleware:process:run -p DEFAULT_CATEGORY_IMPORT_PROCESS
5) Command to import products attributes:
vendor/bin/console middleware:process:run -p ATTRIBUTE_IMPORT_PROCESS
6) Command to prepare product models data in local file:
vendor/bin/console middleware:process:run -p PRODUCT_MODEL_PREPARATION_PROCESS -o data/import/maps/product_models.json
7) Command to import product model data (abstract products):
vendor/bin/console middleware:process:run -p DEFAULT_PRODUCT_MODEL_IMPORT_PROCESS -i data/import/maps/product_models.json
8) Command to prepare products data in local file:
vendor/bin/console middleware:process:run -p PRODUCT_PREPARATION_PROCESS -o data/import/maps/products.json
9) Command to import product model data (abstract products):
vendor/bin/console middleware:process:run -p DEFAULT_PRODUCT_IMPORT_PROCESS -i data/import/maps/products.json


See also:


Last review date: Apr 1, 2019