This is part two of the four-part crash course aiming to introduce teams and individuals to the Akeneo-Magento stack with a dedicated connector module. In a step-by-step manner, the guide allows to learn and get a practical experience with
- General set-up and basic entities,
- Data migration from Magento to Akeneo,
- Connector module functionality, import/export verification,
- Akeneo data manipulation using .csv files.
In this part, you will learn to transfer data between Akeneo and Magento using default import/export functionality.
Note: Before proceeding, make sure you have completed pt.1 of the current guide.
In Akeneo, set up some products with 100% completion.
Import them into Magento: bin/magento akeneoimport:product
.
Reset Akeneo:
Open terminal in Akeneo root directory.
Remove all Akeneo containers: docker-compose down.
Start a fresh Akeneo: make prod.
Make a new Akeneo admin user (user: admin, password: admin):
docker-compose run --rm php php bin/console pim:user:create admin admin [email protected] Admin Admin en_US --admin -n --env=prod
Run the job daemon:
docker-compose run --rm php php bin/console akeneo:batch:job-queue-consumer-daemon
Export data from Magento:
Execute Magento import commands:
bin/magento akeneoexport:attribute
bin/magento akeneoexport:category
bin/magento akeneoexport:config
bin/magento akeneoexport:product
To find folders with CSV exports, go to <M2 root>/var/akeneo/export
.
Import data into Akeneo:
The exports directory contains the following folders:
- attribute_groups
- attribute_options
- attributes
- category
- channels
- currency
- family
- family_variant
- locales
- product
- product_model
For each of these, you need to create an import file.
- To do it manually in Akeneo, go to
Imports > create import profile
- To do it by running a SQL query: from Akeneo root directory, log into MySQL
docker-compose exec mysql mysql -u akeneo_pim -pakeneo_pim
- And execute the following query:
USE akeneo_pim; INSERT INTO `akeneo_batch_job_instance` (`code`, `label`, `job_name`, `status`, `connector`, `raw_parameters`, `type`) VALUES
('csv_product_import', 'Demo CSV product import', 'csv_product_import', '0', 'Akeneo CSV Connector', 'a:17:{s:8:\"filePath\";s:16:\"/tmp/product.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;s:16:\"decimalSeparator\";s:1:\".\";s:10:\"dateFormat\";s:10:\"yyyy-MM-dd\";s:7:\"enabled\";b:1;s:16:\"categoriesColumn\";s:10:\"categories\";s:12:\"familyColumn\";s:6:\"family\";s:12:\"groupsColumn\";s:6:\"groups\";s:17:\"enabledComparison\";b:1;s:18:\"realTimeVersioning\";b:1;}', 'import'),
('csv_product_model_import', 'Demo CSV product model import', 'csv_product_model_import', '0', 'Akeneo CSV Connector', 'a:16:{s:8:\"filePath\";s:22:\"/tmp/product_model.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;s:16:\"decimalSeparator\";s:1:\".\";s:10:\"dateFormat\";s:10:\"yyyy-MM-dd\";s:7:\"enabled\";b:1;s:16:\"categoriesColumn\";s:10:\"categories\";s:19:\"familyVariantColumn\";s:13:\"familyVariant\";s:17:\"enabledComparison\";b:1;s:18:\"realTimeVersioning\";b:1;}', 'import'),
('csv_product_export', 'Demo CSV product export', 'csv_product_export', '0', 'Akeneo CSV Connector', 'a:10:{s:8:\"filePath\";s:38:\"/tmp/export_%job_label%_%datetime%.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;s:16:\"decimalSeparator\";s:1:\".\";s:10:\"dateFormat\";s:10:\"yyyy-MM-dd\";s:10:\"with_media\";b:1;s:7:\"filters\";a:2:{s:4:\"data\";a:3:{i:0;a:3:{s:5:\"field\";s:7:\"enabled\";s:8:\"operator\";s:1:\"=\";s:5:\"value\";b:1;}i:1;a:3:{s:5:\"field\";s:10:\"categories\";s:8:\"operator\";s:11:\"IN CHILDREN\";s:5:\"value\";a:1:{i:0;s:6:\"master\";}}i:2;a:4:{s:5:\"field\";s:12:\"completeness\";s:8:\"operator\";s:2:\">=\";s:5:\"value\";i:100;s:7:\"context\";a:1:{s:7:\"locales\";a:3:{i:0;s:5:\"fr_FR\";i:1;s:5:\"en_US\";i:2;s:5:\"de_DE\";}}}}s:9:\"structure\";a:2:{s:5:\"scope\";s:6:\"mobile\";s:7:\"locales\";a:3:{i:0;s:5:\"fr_FR\";i:1;s:5:\"en_US\";i:2;s:5:\"de_DE\";}}}}', 'export'),
('csv_product_model_export', 'Demo CSV product model export', 'csv_product_model_export', '0', 'Akeneo CSV Connector', 'a:10:{s:8:\"filePath\";s:38:\"/tmp/export_%job_label%_%datetime%.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;s:16:\"decimalSeparator\";s:1:\".\";s:10:\"dateFormat\";s:10:\"yyyy-MM-dd\";s:10:\"with_media\";b:1;s:7:\"filters\";a:2:{s:4:\"data\";a:0:{}s:9:\"structure\";a:2:{s:5:\"scope\";s:6:\"mobile\";s:7:\"locales\";a:3:{i:0;s:5:\"fr_FR\";i:1;s:5:\"en_US\";i:2;s:5:\"de_DE\";}}}}', 'export'),
('csv_category_import', 'Demo CSV category import', 'csv_category_import', '0', 'Akeneo CSV Connector', 'a:9:{s:8:\"filePath\";s:17:\"/tmp/category.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'import'),
('csv_category_export', 'Demo CSV category export', 'csv_category_export', '0', 'Akeneo CSV Connector', 'a:6:{s:8:\"filePath\";s:17:\"/tmp/category.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'export'),
('csv_association_type_import', 'Demo CSV association type import', 'csv_association_type_import', '0', 'Akeneo CSV Connector', 'a:9:{s:8:\"filePath\";s:25:\"/tmp/association_type.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'import'),
('csv_association_type_export', 'Demo CSV association type export', 'csv_association_type_export', '0', 'Akeneo CSV Connector', 'a:6:{s:8:\"filePath\";s:25:\"/tmp/association_type.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'export'),
('csv_attribute_import', 'Demo CSV attribute import', 'csv_attribute_import', '0', 'Akeneo CSV Connector', 'a:9:{s:8:\"filePath\";s:18:\"/tmp/attribute.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'import'),
('csv_attribute_export', 'Demo CSV attribute export', 'csv_attribute_export', '0', 'Akeneo CSV Connector', 'a:6:{s:8:\"filePath\";s:18:\"/tmp/attribute.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'export'),
('csv_attribute_option_import', 'Demo CSV option import', 'csv_attribute_option_import', '0', 'Akeneo CSV Connector', 'a:9:{s:8:\"filePath\";s:15:\"/tmp/option.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'import'),
('csv_family_import', 'Demo CSV family import', 'csv_family_import', '0', 'Akeneo CSV Connector', 'a:9:{s:8:\"filePath\";s:15:\"/tmp/family.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'import'),
('csv_family_variant_import', 'Demo CSV family variant import', 'csv_family_variant_import', '0', 'Akeneo CSV Connector', 'a:9:{s:8:\"filePath\";s:23:\"/tmp/family_variant.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'import'),
('csv_attribute_option_export', 'Demo CSV option export', 'csv_attribute_option_export', '0', 'Akeneo CSV Connector', 'a:6:{s:8:\"filePath\";s:15:\"/tmp/option.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'export'),
('csv_product_quick_export2', 'CSV product quick export', 'csv_product_quick_export', '0', 'Akeneo CSV Connector', 'a:14:{s:8:\"filePath\";s:38:\"/tmp/export_%job_label%_%datetime%.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;s:7:\"filters\";N;s:19:\"selected_properties\";N;s:10:\"with_media\";b:1;s:6:\"locale\";N;s:5:\"scope\";N;s:9:\"ui_locale\";N;s:15:\"filePathProduct\";s:54:\"/tmp/1_products_export_%locale%_%scope%_%datetime%.csv\";s:20:\"filePathProductModel\";s:60:\"/tmp/2_product_models_export_%locale%_%scope%_%datetime%.csv\";}', 'quick_export'),
('csv_product_grid_context_quick_export2', 'CSV product quick export grid context', 'csv_product_grid_context_quick_export', '0', 'Akeneo CSV Connector', 'a:14:{s:8:\"filePath\";s:38:\"/tmp/export_%job_label%_%datetime%.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;s:7:\"filters\";N;s:19:\"selected_properties\";N;s:10:\"with_media\";b:1;s:6:\"locale\";N;s:5:\"scope\";N;s:9:\"ui_locale\";N;s:15:\"filePathProduct\";s:67:\"/tmp/1_products_export_grid_context_%locale%_%scope%_%datetime%.csv\";s:20:\"filePathProductModel\";s:73:\"/tmp/2_product_models_export_grid_context_%locale%_%scope%_%datetime%.csv\";}', 'quick_export'),
('csv_family_export', 'Demo CSV family export', 'csv_family_export', '0', 'Akeneo CSV Connector', 'a:6:{s:8:\"filePath\";s:15:\"/tmp/family.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'export'),
('csv_family_variant_export', 'Demo CSV family variant export', 'csv_family_variant_export', '0', 'Akeneo CSV Connector', 'a:6:{s:8:\"filePath\";s:23:\"/tmp/family_variant.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'export'),
('csv_channel_export', 'Demo CSV channel export', 'csv_channel_export', '0', 'Akeneo CSV Connector', 'a:6:{s:8:\"filePath\";s:38:\"/tmp/export_%job_label%_%datetime%.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'export'),
('csv_currency_export', 'Demo CSV currency export', 'csv_currency_export', '0', 'Akeneo CSV Connector', 'a:6:{s:8:\"filePath\";s:38:\"/tmp/export_%job_label%_%datetime%.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'export'),
('csv_locale_export', 'Demo CSV locale export', 'csv_locale_export', '0', 'Akeneo CSV Connector', 'a:6:{s:8:\"filePath\";s:38:\"/tmp/export_%job_label%_%datetime%.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'export'),
('csv_attribute_group_export', 'Demo CSV attribute group export', 'csv_attribute_group_export', '0', 'Akeneo CSV Connector', 'a:6:{s:8:\"filePath\";s:38:\"/tmp/export_%job_label%_%datetime%.csv\";s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:10:\"withHeader\";b:1;s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'export'),
('csv_currency_import', 'Demo CSV currency import', 'csv_currency_import', '0', 'Akeneo CSV Connector', 'a:9:{s:8:\"filePath\";N;s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'import'),
('csv_channel_import', 'Demo CSV channel import', 'csv_channel_import', '0', 'Akeneo CSV Connector', 'a:9:{s:8:\"filePath\";N;s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'import'),
('csv_locale_import', 'Demo CSV locale import', 'csv_locale_import', '0', 'Akeneo CSV Connector', 'a:9:{s:8:\"filePath\";N;s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'import'),
('csv_attribute_group_import', 'Demo CSV attribute_group import', 'csv_attribute_group_import', '0', 'Akeneo CSV Connector', 'a:9:{s:8:\"filePath\";N;s:9:\"delimiter\";s:1:\";\";s:9:\"enclosure\";s:1:\"\"\";s:6:\"escape\";s:1:\"\\\";s:10:\"withHeader\";b:1;s:13:\"uploadAllowed\";b:1;s:25:\"invalid_items_file_format\";s:3:\"csv\";s:14:\"user_to_notify\";N;s:21:\"is_user_authenticated\";b:0;}', 'import');
Expected result: After adding the profiles, your imports page should look similar to this:
Now you can start importing data from your exports. You must however do it in a specific order:
- currency
- locales
- category
- channels
- attribute_groups
- attributes
- attribute_options
- family
- family_variant
- product_model
- product
Select the appropriate import profile (i.e. for Currency select Demo CSV currency import
) and upload the .csv file from your exports folder (for Currency – <M2 root>/var/akeneo/export/currency/<currencyexport>.csv
).
When all is imported, open the products section, mass-select all products, and set the price attribute.
Connect Akeneo with Magento:
In Akeneo open System > Connections
and create a new connection, setting the flow type as Data Destination
.
After creating the connection, in Magento go to ‘Profile’ > ‘Connector’ > Configuration
, and fill in the new credentials.
Clear Magento cache and test the connection.
Verify That All Products Were Imported Correctly
Follow the steps listed under the section Test Product Deletion in pt. 3 of this guide.
Have you found this information helpful? Make sure to check out the rest of the guide: pt.1, pt.3, and pt.4. Do you consider implementing Akeneo PIM in your business? Let us help you! Any questions? Feel free to get in touch: book a free consultation or schedule a call!
Share on: