For more details see how the Import and Export for Magento 2 extension works.
Import and Export for Magento 2 is the solution for data migration and synchronization. Connect your Magento store with ERP/CRM systems and third-party sources like marketplaces. The extension is not based on Magento import and export functionality, which makes it more flexible and adjustable for any third-party software.
This guide fully describes the solution Premium version, which includes all Import and Export functionalities and by now, allows you to manage the following entities:
Also, here you can choose the Lite or Pro solution versions, which will provide you with facilitated feature sets according to your specific business needs.
Lite version includes the following functionalities:
Pro version includes the following functionalities:
Amasty Import and Export solution has 3 separate interfaces that cover different migration tasks:
Thus, you can use the solution both for multiple integrations and non-regular data transferring.
The solution has multiple options for performance optimization. The settings are different for import and export so that you could flexibly configure both processes according to your server capabilities. Also, the settings are split by entities, e.g. you can make the export of products faster than the export of orders.
Go to Stores → Configuration → Amasty Extensions → Export Orders/Products/Customers.
Enable module - select Yes to activate the extension.
Export Batch Size - set the number of orders that will be processed in an iteration.
Log Auto-Cleaning - choose Yes to clean logs automatically. The records will be removed from Export History after the period specified below.
Log Auto-Cleaning Period (Days) - define the period after which export history will be cleaned.
Export Files Auto-Cleaning - if enabled, the generated export files will be automatically removed from the server after the period specified below.
Export Files Auto-Cleaning Period (Days) - identify the period after which the files will be removed from the server.
Enable Multi-Process Export - set to Yes to speed up the export of orders. Remember, that this option is added specifically for orders.
Number of Parallel Processes - specify the number of processes according to your server capabilities. The more parallel processes are set, the faster the export process goes, but the higher the server loads.
You can also configure the setting for additional interfaces separately.
To configure the basic options for One-time Export, navigate to Stores → Configuration → Amasty Extensions → Export.
Enable Multi-Process Export - set to Yes to speed up the export.
Number of Parallel Processes - specify the number of processes according to your server capabilities. The more parallel processes are set, the faster the export process goes, but the higher the server loads.
Before building import profiles, configure the basic import performance options.
Go to Stores → Configuration → Amasty Extensions → Import Orders.
Import Batch Size - set number of orders that will be processed in an iteration.
Import History Auto-Cleaning - choose Yes to clean logs automatically. The records will be removed from Import History after the period specified below.
Auto-Cleaning Period (Days) - define the period after which import history will be cleaned.
Enable Multi-Process Import - enable this option to perform import in multiple threads and speed up the import process.
Number of Parallel Processes - if the previous option is enabled, specify the number of processes according to your server capabilities. The more parallel processes are set, the faster the import process goes, but the higher the load on the server is.
The same options can be enabled for non-regular imports separately. Navigate to Stores → Configuration → Amasty Extensions → Import.
The extended order export functionality allows you to create flexible profiles for export and execute it on regular basis. To view all the profiles, proceed to System → Export Orders/Products/Customers → Profiles.
You can view, delete, add new profiles or run any of them manually right from the grid.
To create a new one, hit the Add New Profile button and follow a profile setup steps.
In the first tab adjust the general information of the profile.
Profile Name - specify the name of the profile for internal usage. This name will be displayed in the grid.
Export Only New Entities - the previously exported orders will be skipped if the setting is enabled. The option is useful in case you export the profile regularly and only newly created orders are needed.
Batch Size - set the number of orders that will be processed in an iteration. You may configure batch size for each profile separately or specify the value in general configuration and use this default value.
You can also automatically execute particular actions when the orders are exported.
Change Processed Orders Status To - specify the status that exported orders will get.
Add Comment to Status History - comment would be added to the order status history after exporting.
Invoice, Ship or Cancel orders after the export if needed. When any of these actions are enabled, you can additionally notify customers.
Proceed to the configuration of output options.
File Name - specify the title for the export file.
Compress Export File With Gzip - enable the toggle to compress the file and save extra space on a server.
Specify where to export the profile: on internal or external server, send the exported file by email or using API.
If Store Exported File On Server is enabled, provide File Path and File Name on Server. The file will be saved in Magento 'var' directory relative to the specified path.
If you want to Upload Exported File By FTP / SFTP, you will need to fill the following fields:
For FTP you can also enable a Passive Mode.
In case you want to Send Exported File to Email, provide:
If you are using Send to Rest Api Endpoint, provide:
To export to Dropbox, you will need to provide the access token. Follow the steps below to get the token.
1. Go to https://www.dropbox.com/developers and sign in.
2. Hit the Create Apps button.
3. Choose an API, a type of access you need and specify the title for your folder.
Agree with the terms & conditions and click Create App. You will be automatically redirected to the folder configuration.
4. Proceed to the Permissions tab.
Grant the permissions to write the files and click Submit.
5. Return to the Settings tab.
6. Find the OAuth 2 section and hit the Generate button below the Generated access token field.
7. Copy the token and paste it into the Generated Access Token field.
To set the integration with Google Drive, you need a specific API key. To get the key and configure this output option correctly, follow the steps below.
1. First of all, you need to install Google APIs Client Library on your Magento instance. Click here and install composer require google/apiclient:“^2.0”
.
2. Go here and choose a project or create a new one if necessary.
3. When the required project is chosen, return to this page and enable Google Drive API.
4. If everything is correct, you will see the following status:
5. Click Manage and proceed to APIs & Services → Credentials. There click Create Credentials →Service account.
6. Provide Service account details. You can skip Step 2 and Step 3.
Click Done.
7. Navigate to the Service accounts tab and find the required service. Expand the Actions dropdown and hit the Manage keys option.
8. Expand the Add Key dropdown and select Create new key.
9. Choose JSON file format and hit the Create button.
The file will be automatically generated and downloaded.
10. Proceed to the Details tab and copy the email.
11. Go to My Drive. Create a folder to which export files will be output from Magento. Specify the title.
12. Now click Share and insert the email that you've copied. Click Done.
13. Return to the admin panel. Upload a JSON file, provide the path to the created folder and specify an export file naming with or without data format.
The configuration is ready. Run export profile and check the file in the Drive folder.
In the following step, you need to choose the required file type and configure its general settings.
The following formats are available:
For CSV, ODS and XLSX formats you can:
Add Header Row - column titles will be displayed in this row.
Merge Rows into One - data from multiple rows will be merged into one cell if enabled. The character that delimits each field of the child rows is customizable. Check the GIF in a demo to see how it works.
For a CSV file you can additionally set:
For an XML file you can customize:
For JSON specify:
For Template:
Using the Template option, you can build a unique file suitable for specific needs. Thanks to the integrated Twig PHP template engine, you can create any template you want to:
The extensions offers templates for .CSV and .JSON file types. To help you export subentities via .CSV using Twig template engine, please follow the steps below.
1. Enable the required subentity (‘Order Item’ for example) and add the fields you would like to export (‘sku’).
2. Determine the property name of each entity element in the chain. For example, for ‘Order Item’ subentity, the property name will be ‘sales_order_item’ of the root entity variable ‘item’ (item.sales_order_item).
The property name of the required entity can be found in the corresponding entity definition file. For example, for the subentity ‘Order Item’ it will be the file etc/entity/sales_order_item.xml
(path is relative to ‘Amasty_OrderExportEntity’ extension files). The file can be found by the entity name contained in the name
element, for example ‘<name>Order Item</name>’. Next, the required entity relation should be found in the file. In our case, ‘Order (root entity)’ → ‘Order Item’. Information about relations is contained in the elements ‘relation’ and the essence of relations is described in the attribute ‘code’. So we find the element ‘<relation code=“order_order_item”>’. The child element ‘sub_entity_field_name’ will contain the name of the property we are interested in (‘sales_order_item’).
3. Then use the loops to get information from subentities. To access the subentity ‘Order Item’ (‘sales_order_item’), use the following construction of the Twig template engine: {% for order_item in item.sales_order_item %}
As a result, the ‘sku’ property of the ‘order_item’ variable will contain the necessary information (‘order_item.sku’).
4. You can also use the filter ‘join (',')’ Twig to join an array of elements into a string.
{# Comment: You should enable Order Item subentity and add sku field. #} {% set order_items = [] %} {% for order_item in item.sales_order_item %} {% set order_items = order_items|merge([order_item.sku]) %} {% endfor %} {% set order_items_ouput = order_items|join(',') %} "{{ "#{ order_items_ouput }" }}"
5. To access more nested entities, you need to use several loops. For example, to access the subentity ‘Shipment Item’, you need to go through the chain of entities ‘Order (root entity)’ → ‘Shipment’ → ‘Shipment Item’.
In this tab, you can start building your export file by choosing the data to export. The functionality has a tree structure. Thus, you can add any entity, any field within a particular entity, customize prefixes/tags/delimiters and so on to match the requirements of the system you are exporting to.
See how the tree-structures file is built:
Step 1. Add root entities
First, you need to configure the basic order entity and select the fields that will be added to the file on the root level.
Click Add Fields button and choose the relevant data to add to the export file.
Use a search window right in the popup to find the required fields faster. Click Add Selected Fields.
When a field is added, you can customize a column title that will be displayed in the exported file. Moreover, use the Add Static Filed button to create columns that will remain unchanged in the file.
Also, for each file level, you can set a custom entity key, delimiter and a field name. Check how it works:
Step 2. Add subentities
Then you can go down the entity list and enable any you need.
Just hit the Enabled toggle and Add Fileds button. As it was described above, a popup will appear and you will be able to add all required fields concerning a particular entity. For example, for the Order Item entity, you may add product type, sku, price, etc.
The same can be done for the entities with a lower level, such as Order Item Attribute or Order Item Custom Option.
Also, the extension support MSI functionality. You can find the required fields on the Shipment level in the Inventory Source tab.
To include particular product attributes into the export profile, navigate to Stores → Attributes → Product.
For example, we want to add a manufacture attribute. So, we open a particular attribute and proceed to the Order Export tab.
Choose Yes in the Add to Options field and Save the attribute.
Check the result. You will see the manufacture attribute in the Fields configuration tab of the export profile (Order Item → Order Item Attribute section).
Also, now you can filter orders by the added product attribute.
Now you can use modifiers to change the values in the export file. For example, you can change the date format, add any text and apply various mathematical actions to prices (e.g. rounding, multiplication, etc.).
Modifiers are added right during the fields configuration.
Hit the Add Modifier button and choose the required action in a dropdown.
Types of modifiers you can use:
Append - Adds the text after the value in the column. The text is specified in an additional field that appears when this modifier is selected.
Prepend - Adds text before the value in the column. The text is specified in an additional field that appears when this modifier is selected.
Capitalize - After selecting this modifier, the value in the column is capitalized.
Lower Case - After selecting this modifier, the whole word is written in lowercase.
Upper Case - After selecting this modifier, the entire word in a value field is capitalized.
Capitalize Each Word - After selecting this modifier, each word starts with a capital letter.
Strip Html Tags - Modifier removes all HTML tags from the string (the modifier is useful when exporting meta titles, descriptions, etc.).
Replace - After choosing this modifier, 2 fields appear: in the first one we indicate the word that needs to be replaced, and in the second one - the word to be replaced with.
Replace First - the same as Replace, but for the first case only.
Default value - When this modifier is selected, indicate the value that is added to the corresponding column by default (there is already a defaultValue
).
Trim - This modifier removes spaces from the beginning and the end of the string (there is already a trim
).
Price - Modifier adds currency to the value in the column.
Absolute Value - Modifier changes the negative value in the column to positive. Example: was -5 → now is 5.
Round To - When this modifier is selected, an additional field appears, in which we indicate the number of decimal places to which we round the number in the column. Example: 33.75 → enter 1 → get 33.8.
Plus - When this modifier is selected, indicate the number that is added to the number in the column.
Minus - Indicate the number that is subtracted from the number in the column.
Multiplied By - Specify the number that is multiplied by the number in the column.
Divided By - Provide the number by which the number in the column is divided.
Modulo - Indicate the number by which the number in the column is divided, and when division occurs, we get the remainder of the division in the export file. Example: we have 10, entered the number 3, received 1 in the file.
Truncate - Modifier removes decimal numbers without rounding. For example: 33.75 → Truncate → 33.
Ceil - Modifier allows you to round a number up to the nearest whole number.
Floor - Modifier allows you to round a number down to the nearest whole number.
Date Format - Specify the date format that is applied to the date in the file.
Сustom modifiers replace the output of the value of one field with the value of another. For example, Value to Label: instead of value, the label will be displayed. Or, for instance, set id to set name: instead of id, the name will be displayed.
In the next tab, you can define which orders should be exported using filtering. For example, you may add only configurable products to the export file. Filtering also has a tree structure and is on the same level as export fields.
Expand the necessary entity, click Add Filter and specify the value you need to export.
Additionally, you can Exclude Parent Entity Row If No Results Found. It means that the parent entity row will be excluded from the export file if the child entity doesn't have filter results relative to the parent entity.
Check how it works:
Set the frequency to run the profile. 2 modes to run a profile are available:
For exporting by cron, you need to set one of the ready-made schedules or create a custom one.
For exporting by event, choose the particular event that will trigger a profile export.
Using this tab, you can enable email notifications about errors for a particular profile.
Enable Email Alert - set to Yes to notify the recipients about failed exports.
Email Sender - choose the contact that will send automatic emails.
Email Recipients - set to whom the emails will be sent.
Email Template - select the template for failure notifications.
For each profile a separate export history is available. Check the statuses, dates, logs and the exported number of orders. Download a file if necessary.
You may also check the logs for all exported profiles of all entities (not only orders but also products and customers) in one place. Navigate to System → Amasty Export → Export History. See the statues and check details to get a full picture.
With the extension, you can link the data generated by 3rd party extensions to the export functionality. All created connections are displayed in the System → Export Orders/Products/Customers → 3rd Party Connections tab.
Hit the Add New Connection button to create a new link.
Name - specify the connection title for internal usage.
Table to Join - indicate a table name that needs to be joined.
Parent Entity - choose the entity table to which the foreign table will be joined.
Referenced Table Key - the field from the foreign table, by which the table chosen in 'Table to join' will be joined to the parent entity table.
Base Table Key - specify the field from the parent entity table which will be used for joining with the foreign table.
Save the changes. Now you can add this entity to the export file.
The extended order import functionality allows you to create flexible profiles for import and execute it on regular basis. To view all the profiles, proceed to System → Import Orders → Profiles.
Here you can see all existing profiles, their IDs, names, file formats, execution types and the dates of the last run/update.
Profile Name - specify the name of the profile for internal usage. This name will be displayed in the grid.
Batch Size - set the number of orders that will be processed in an iteration. You may configure batch size for each profile separately or specify the value in general configuration and use this default value.
You can also automatically execute particular actions when the orders are imported.
Change Processed Orders Status To - specify the status that imported orders will get.
Change Only New Orders Status - if enabled, the action will only apply to new orders that were created during the import process and not affect the orders that were just updated.
Actions that can be applied to order documentation:
All these actions can also be applied to newly-created orders only. Additionally, you can send automatic notifications to customers.
Now we need to choose the required file type and configure its settings.
The following formats are available:
For CSV, ODS and XLSX formats you can:
Add Header Row - column titles will be displayed in this row.
Rows Merged into One - enable this option if the rows in the import files are merged.
For a CSV file you can additionally set:
For a XML file specify the path to the node in the Data XPath field, e.g. if you have <items><item>1</item><item>2</item></items>, the path will be items/item.
We've chosen a CSV format.
Now choose a suitable import source.
Available sources:
For Local Directory specify a File Path relative to Magento installation (e.g. var/import/import.csv).
For File Upload select the file to import. Make sure your file isn't more than 2M and it is saved in UTF-8 encoding for proper import.
If you want to use FTP / SFTP for import, you will need to fill the following fields:
For FTP you can also enable a Passive Mode.
For URL source, apart from the URL itself, provide Basic Authentication Username and Password.
https://example/download?id=19&file=-1.xml
(here we use XML format). It is necessary since in Google Cloud the link to the file is used without an extension, and the Import Orders extension can't validate it. Thus, you need to add the format. Additionally, if the access is shared for all users, then the username and password fields are not required. If only certain users can see the file, then you need to enter their credentials for access.
For Google Sheets specify the required URL.
For REST API Endpoint provide the endpoint (e.g. https://magento.instance/rest/all/V1/some/endpoint
) and choose the required authentication method.
To import using Dropbox, you will need to provide the access token. Follow the steps below to get the token.
1. Go to https://www.dropbox.com/developers and sign in.
2. Hit the Create Apps button.
3. Choose an API, a type of access you need and specify the title for your folder.
Agree with the terms & conditions and click Create App. You will be automatically redirected to the folder configuration.
4. Proceed to the Permissions tab.
Grant the permissions to write the files and click Submit.
5. Return to the Settings tab.
6. Find the OAuth 2 section and hit the Generate button below the Generated access token field.
7. Copy the token and paste it into the Generated Access Token field.
To set the integration with Google Drive, you need a specific API key. To get the key and configure this import source correctly, follow the steps below.
1. First of all, you need to install Google APIs Client Library on your Magento instance. Click here and install composer require google/apiclient:“^2.0”
.
2. Go here and choose a project or create a new one if necessary.
3. When the required project is chosen, return to this page and enable Google Drive API.
4. If everything is correct, you will see the following status:
5. Click Manage and proceed to APIs & Services → Credentials. There click Create Credentials →Service account.
6. Provide Service account details. You can skip Step 2 and Step 3.
Click Done.
7. Navigate to the Service accounts tab and find the required service. Expand the Actions dropdown and hit the Manage keys option.
8. Expand the Add Key dropdown and select Create new key.
9. Choose JSON file format and hit the Create button.
The file will be automatically generated and downloaded.
10. Proceed to the Details tab and copy the email.
11. Go to My Drive. Create a folder from which the files will be imported to Magento. Specify the title.
12. Now click Share and insert the email that you've copied. Click Done.
13. Return to the admin panel. Upload a JSON file, provide the path to the created folder and file title.
The configuration is ready. Run import profile and check the result.
As we already have a CSV file to import, we've chosen the File Upload option.
In this tab, you can adjust import behavior.
Import Behavior - choose a suitable behavior for import:
Enable Autofill for Typical Use Cases - if enabled, Fields Configuration will be automatically filled in with the settings to perform the typical use cases for importing orders from third-party systems. The setting can be used only during new profile creation.
The required data for add behavior: Order, Order Item, Payment, Shipping Address, Billing Address.
Please, enable the autofill option to avoid errors during import and map fields properly.
Order Identifier - choose Order Entity ID or Order Increment ID as an identifier.
Validation Strategy - you can either stop the import process if any error appears (Stop On Error option) or skip invalid data and continue importing (Skip Error Entities option).
If you choose Stop on Errors option, the status will be 'Failed'.
Allowed Errors Count - specify the number of errors to halt the import process.
Customer Mode - select the strategy to deal with customers:
As we want to import orders from Amazon for the first time, we've selected the Only Add import behavior and a Guest Order If Customer Doesn’t Exist strategy.
In this tab, you need to choose the required entities and map fields. If you enabled the Autofill for Typical Use Cases option previously, the required fields will be automatically added and you can proceed to mapping. If the option was not enabled, you need to add the entities and fields manually.
The functionality has a tree structure. Thus, you can add any entity, any field within a particular entity, customize entity keys/field names/delimiters and so on to match the requirements of the import.
See how the tree-structure configuration is created:
Below you can see all available for importing entities:
Apart from adding required entities and fields, you need to map all required fields and additional fields that you want to import from the file.
Let's see how to configure the mapping.
First of all, open your import file and check how it is configured. Pay attention to column names and delimiters.
As we see, in our file all columns have a custom entity key - amazon.
In this case, we need to provide the same entity key in the fields configuration.
Then we check the delimiters. In our file we have a slash as the delimiter:
Thus, we need to specify the same delimiter in the configuration:
If ready, proceed to column names.
In the configuration, we see that the entity_id, state and status are the required fields (as they were autofilled).
Now we check if we have the same columns in our import file.
Here we see that the columns are present, but they have a different column name, e.g. instead of entity_id we have just entity. In this case, we should match the title from the import file with the title in Magento.
If the titles are identical (as we have for the state column), just leave the Import File Field empty.
If you check all fields and see that some of the required ones are absent in the import file, set the Default Value. For example, Magento requires store_id column, but we don't have this one in our file as Amazon doesn't have this parameter. In this case, we can just provide the required ID in the Default Value field (e.g. 1).
This way, you need to check all fields and map the titles so that the extension could import orders properly. Add any entities and provide custom entity keys if needed.
To add the fields, click Map Fields and choose the necessary ones in the modal window. Use the search field to speed up configuration.
When the configuration is ready, upload the file in the Import Source tab. Click Save and Continue Edit.
Now you can Validate the file.
The extension will display validation progress and results in a popup window.
If the configuration was incorrect, you will see an error.
In case of successful validation, you can start the import.
If you have configured the mapping and the orders were imported successfully, you can set the automatic import of future orders.
Run Profile by Cron - if enabled, the import will be initiated automatically by cron according to the schedule specified.
Frequency - choose a suitable import schedule.
If you choose a custom one, provide the schedule manually.
Using this tab, you can enable email notifications about errors for a particular profile.
Enable Email Alert - set to Yes to notify the recipients about failed imports.
Email Sender - choose the contact that will send automatic emails.
Email Recipients - set to whom the emails will be sent.
Email Template - select the template for failure notifications.
For each profile a separate import history is available. Check the statuses, dates and logs.
You may also check the logs for all import profiles in one place. Navigate to System → Import Orders → History. See the statues and check details to get a full picture.
This solution is helpful to perform one-time operations as it has a simplified UI. You can easily export any available entity in one place. There are 2 different tabs for import and export operation, as their logic is different.
To perform exports, go to System → Amasty Export and select the entity to export.
As soon as you choose the entity, you will be able to configure export details, such as format, title, included fields, etc. Check each configuration details for each tab in the Export Profile Configuration sections.
For managing imports, proceed to System → Amasty Import and select the entity to import.
Here you can also configure import details, such as format, title, included fields, etc. Check each configuration detail for each tab in the Import Profile Configuration sections.
Also, the extension includes Amasty Cron Jobs features: you can create regular cron jobs to export or import any available entity.
For export, go to System → Amasty Export → Cron Jobs.
Click New Export Job.
Specify the cron job title for internal use and set the schedule for exporting. The file configuration algorithm is the same as described in the Export Profile section.
For import, navigate to System → Amasty Import → Cron Jobs.
Click New Import Job.
Specify the cron job title for internal use and set the schedule for importing. The file configuration algorithm is the same as described in the Import Profile section.
The solution is fully compatible with Amasty Gift Card. Thus, you can import any gift card info you need.
Export Gift Card information if you have both modules installed.
Export orders component is also compatible with Amasty Order Attributes extension. Thus, you can find and add custom order fields to the export file.
The extension supports Amasty One Step Checkout so that you could add more order details from your checkout page to the export file.
The same can be done with RMA requests.