User Tools

Site Tools


Sidebar

magento_2:export_customers

For more details see how the Export Customers for Magento 2 extension works.

Guide for Export Customers for Magento 2

Level-up your business by connecting Magento instance to multiple external platforms. Export customers directly to CRM, ERP or other systems automatically with Export Customers for Magento 2.

  • Export any customer entities
  • Filter users by entity values and export only required ones
  • Set automatic export by cron or event
  • Store export files on local or distant servers, or send by email
  • Easily customize columns naming in export files

Export Structure

Amasty Export by now includes 3 separate modules to perform export tasks:

  • Export Customers: a separate export to deal with customer entities
  • Amasty Export: suitable for one-time export of any available entity
  • Amasty Export PRO: a tab to create cron jobs concerning export activity

The more Amasty modules you have, the more entities you will be able to export in the first simplified module and in the PRO version. Follow Import & Export solution updates to discover new possibilities.

Note, that if your export managers have specific permissions to the admin panel, you need to grant them access to both Export Customers Profiles and Amasty Export. Otherwise, they won't be able to execute the export.

Export Customers Configuration

Before creating export profiles, please configure the general customer export options.

Go to Stores → Configuration → Amasty Extensions → Export Customers.

Enable module - select Yes to activate the extension.

Export Batch Size - specify the number of customers that will be processed in an iteration.

Log Auto-Cleaning - set 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) - define the period after which the files will be removed from the server.

Enable Multi-Process Export - choose Yes to speed up the export. Remember, that this option is added specifically for customers. The multi-process for Amasty Export and Amasty Export Pro should be enabled in the other tab.

The 'Multi-Process Export' feature requires the PHP extension 'pcntl' to be installed on the server. If you enable the feature and no performance boost happens, please ask your hoster/system administrator to check if the 'pcntl' extension is installed.

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.

Export Customer Profiles

The extension enables you to create flexible profiles for the customers export and execute it on regular basis. To view all the profiles, please go to System → Export Customers → Profiles.

You can view, delete, add new profiles or run any of them manually right from the grid.

To create a new profile, hit the Add New Profile button and follow a profile set up steps.

General Configuration

In the first tab, you can adjust the general settings of the profile.

Profile Name - add the profile name for internal usage. This name will be displayed in the grid.

Export Only New Entities - enable this setting to skip the previously exported customers. The option is useful in case you export the profile regularly and need to get the information only related to recently registered customers.

Batch Size - set the number of customers that will be processed in one iteration. You may configure batch size for each profile separately or specify the value in general configuration settings and use this default value.

Output Options

On this tab, you can configure the export output options.

File Name - specify the title for the export file.

Use {date|format} to customize filename. Example: Filename-{date|Y_m_d_h_i_s}. Here you may see more options for date format.

Compress Export File With Gzip - enable the toggle to compress the file and save extra space on a server.

Export File Storage

Specify where to export the profile. You may choose the internal or external server, or send the exported file by email.

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:

  • Host
  • User
  • Password
  • File Path
  • File Name for FTP/SFTP.

For FTP you can also enable a Passive Mode.

In case you want to Send Exported File to E-mail, provide:

  • Email Sender
  • E-mail Recipients
  • E-mail Message Subject
  • Email Template.

If you are using Send to Rest Api Endpoint, provide:

  • Rest Api Endpoint
  • Auth (No Auth / Bearer / Basic)
  • Method (POST / PUT)
  • Content Type (JSON / XML).

File Settings

In this section, you can choose the needed file type and configure its settings.

The following formats are available:

  • CSV
  • XML
  • ODS
  • XLSX
  • JSON
  • Template

For CSV, ODS and XLSX formats you can:

Add Header Row - column titles will be displayed in this row.

Merge Rows into One - if this setting is enabled, the information from multiple rows will be merged into one cell. 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:

  • Field Delimiter
  • Field Enclosure Character

For an XML file you can customize:

  • XML Item Tag
  • Header
  • Footer

For JSON specify:

  • Header
  • Footer

For Template:

Using the Template option, you can build a unqiue file suitable for specific needs. Thanks to the integrated Twig PHP template engine, you can create any template you want to:

See Twig documentation to learn more about the features and configuration.

Fields Configuration

In the following step, you can start building your customer 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-structured file is built:

Step 1. Add root entities

First, please configure the basic customer entity and select the fields that will be added to the file on the root level.

Click Add Fields button and choose the needed data to add to the export file.

You may also use a search window right in the popup to find the required fields faster. After choosing all needed fields, click Add Selected Fields.

When a field is added, you can customize a column title that will be displayed in the exported file. Also, you can use the Add Static Field button to create columns that will remain unchanged in the file.

Customize fields sorting within each entity using the drag-and-drop option.

For each file level, you can set custom entity keys and field names. See how it works:

Step 2. Add subentities

Then you can go down the entity list and enable any of them you need for your export file.

See all available subentities:

See how it works:

Just click the Enabled toggle and Add Fileds button. As was described above, a popup will appear and you will be able to add all the required fields concerning a particular entity. For example, for the Customer Attribute entity, you may add customer name, email, group id, etc.

The same can be done for the entities with a lower level.

This way, you can build a unique profile, suitable for a particular system. Check the requirements from a system (as, for example, different ERP or CRM systems may require different customer data) and match the details.

Modify Values in Export Files

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:

  • Text Modifiers: Adjust the text of the text values by appending, prepending, capitalizing, etc.
  • Numeric Modifiers: Use for number modifications, e.g. rounding prices.
  • Date Modifiers: Specify a suitable date format.
  • Custom Modifiers: Replace the output of one field with the value of another.

Text Modifiers

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).

Numeric Modifiers

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 Modifiers

Date Format - Specify the date format that is applied to the date in the file.

Custom Modifiers

С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.

Export Filters

Here you can apply filters to specify what customer data should be exported. The values of all entities and fields available in the Fields Configuration are available for filtering as well. For example, you may add the customers from a particular country or customers with a particular balance.

Expand the necessary entity, click Add Filter, and specify the value you need to export.

You can also 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:

Automatic Export

Configure the frequency to run the profile. You can choose to run a profile:

  • by Cron
  • by Event

For exporting by Cron, you can set one of the ready-made schedules or create a custom one.

For exporting by Event, choose the event that will trigger a profile export. For now, only the export event Customer Registration is available.

Alert Notifications

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.

Profile Export History

You can monitor the dynamics of each particular customer export profile right in its settings, in the Export History tab. Check the statuses, dates, logs, and the exported number of customers. Download a file if necessary.

To see the history immediately after the export, please, reload the page.

General Export History

You may also track the logs for all exported profiles in one place. Navigate to System → Amasty Export → Export History. See the statuses and check details to get a full picture.

To see the history immediately after the export, please, reload the page.

3rd Party Connections

With the module, you can link the data generated by 3rd party extensions to the export functionality. All created connections are displayed in the System → Export Customers → 3rd Party Connections tab.

Tap the Add New Connection button to create a new connection.

Name - add the connection title for internal usage.

Table to Join - specify 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 is 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.

Amasty Export: Fast & Simple

This extension has a simplified UI and helps to easily perform one-time operations. If you have only Export Customers extension, you will be able to export any customer entity, but if you have other export extensions by Amasty, you will easily export any available entity in one place.

Go to System → Amasty Export → Export and select the entity to export.

As soon as you choose the entity, you will be able to configure other export details, such as format, title, included fields, etc. Explore the configuration details for each tab in the Export Profile Configuration sections.

General Settings

To configure the general options for Amasty Export, go to Stores → Configuration → Amasty Extensions → Export.

Enable Multi-Process Export - set to Yes to speed up the export.

The 'Multi-Process Export' feature requires the PHP extension 'pcntl' to be installed on the server. If you enable the feature and no performance boost happens, please ask your hoster/system administrator to check if the 'pcntl' extension is installed.

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.

Amasty Export Pro

The extension also includes Amasty Export Pro features: you can create regular cron jobs to export any available entity.

Navigate to System → Amasty Export → Cron Jobs.

The more installed Amasty Export extensions you have, the more entities you can export by cron.

To create a new cron job, click New Export Job.

Indicate 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.


Find out how to install the Export Customers extension for Magento 2 via Composer.

Rate the user guide
 stars  from 1 votes (Details)
magento_2/export_customers.txt · Last modified: 2021/06/07 12:39 by tihomirova