Select Page

Setting up the Akeneo Connector in Magento 2: Part 2 – Running the Jobs

February 24, 2021


  • This article assumes that you have already done the initial setup of your Akeneo Connector. If you have not yet configured the connector please follow the steps in Part 1 before returning here.
  • This article refers to v101.0.0 and beyond of the Akeneo Connector module. If you are using a different version the information here may not apply.

Now that you have your connector setup in Magento 2, it is time to run the jobs and sync your data. The jobs are listed at System > Akeneo Connector > Import in the Magento Admin Panel. From there you will see buttons for the following jobs: CategoryFamilyAttributeOption, and Product.

Each job will sync the related information from Akeneo.

The Category job syncs the category data from Akeneo. Only one category tree will be imported with this command. The imported category tree is determined by the channel designated in the Admin Website Channel field in Magento. Only the main category tree of that channel will be synced. Other category trees in Akeneo will be ignored.

The Family job brings over the data for all families in Akeneo.

The Attribute job pulls new and updated attribute information from Akeneo.

The Options job creates attribute options from Akeneo and adds them to Magento for each new or updated simple select and multi-select attribute.

Lastly, the Product job pulls all your Product, Product Model, and Family Variant values from Akeneo into Magento.

Initially you will want to run the jobs in the following order:

  • Attribute
  • Option
  • Family
  • Category
  • Product

This order ensures that all dependencies for the data being imported are met. After your initial data load, you do not need to rerun all jobs. Instead, you can just run the job for the related data that was updated. For example, let’s say you added a new family to Akeneo. If the new family contains new attributes you will need to run the Attribute and Option (if the new attribute is simple or multi-select) jobs. If the family only has old attributes you can ignore the Attribute and Options jobs and just run the Family job.

All five jobs can also be run from the command line. Running the jobs from the command line is beneficial for two reasons. First, it allows you to run longer jobs without risking a timeout. Second, it allows you to set the jobs to run automatically on a schedule. The command to run these import jobs is added to the existing Magento command list when you install the Akeneo Connector module.

Running the command will look something like this:

/usr/bin/php /magento_root_directory/bin/magento akeneo_connector:import--code=product

The first section is the route to php. The second section is the route to Magento root. The third section is the command. The fourth section is the desired job to run. If you would like to run multiple jobs you can provide a comma separated list to the code parameter (ex. –code=attribute,family,product).

Though powerful, these jobs are not perfect. All the jobs only support adding and updating data. They do not support deleting data. As an example, let’s imagine you add a new product into Akeneo with SKU 1234. The first time you run the product job product 1234 will be added to Magento. If you change attribute values on product 1234 in Akeneo, then run the product job again, those values will sync. However, if you delete product 1234 in Akeneo, running the product job will not remove product 1234 from Magento.

Sometimes the import jobs fail. Each time you run a job it generates a report. These reports are located at System > Akeneo Connector > Import. Looking at a failure report is a great starting point for trying to figure out what caused a job to fail.

There are several reasons why a job can fail. One of those reasons is the MyISAM engine. The MyISAM storage engine is very fast for data calls with a lot of reads and few writes. This is great because it speeds up the data reads that need to happen when transferring information from Akeneo to Magento. However, not all hosting platforms support MyISAM. If your database hosting platform does not support MyISAM you will have to comment out the code $table->setOption(‘type’, ‘MYISAM’); from line 264 in the file vendor/akeneo/module-magento2-connector-community/Helper/Import/Entities.php. Commenting out this line will prevent the MyISAM engine from being forced and will use your system’s default engine instead.

With this article, you can now populate Magento 2 with your entire Akeneo catalog.

What if you don’t want every single product to be sent to Magento? Perhaps you want to sync enabled products or to only send products that are 100% complete. The Akeneo connector provides some wonderful filtering options that you can use to control the data flow between your two systems.

Check out Part 3 of this series (coming soon) to learn more about filtering.

You May Also Like…