The author
10 432
Usually answers within 24 hours
Автор дополнения
10 432
Usually answers within 24 hours
Version 2.0.17-pl
Release date 06.09.2024
Downloads 4 568
Views 8 045
Warning! This component requires PHP version 7.4 or higher! If your site uses PHP less than required, the installation of this package could break it.
Warning! This package requires MODX not less than 2.7 !

This MODX Extra is intended for product import/export in MiniShop 2 (2.4.* or higher) from/to CSV/XLSX, and export to Yandex Market.

Discuss the component in MODX.PRO community.
Ask your questions on paid add-on settings and use.
Overview video


msImportExport integrated with extras:

Catalog structure requirements:

A root catalog (category) and all its sub-catalogs (sub-categories) are defined as “Product Categories”. Any Product Category without a parent is regarded as a catalog.

Product import

An import file should contain at least two required pagetitle fields and the field specified in the import settings option “Unique Product ID” (“Article” by default).

Description of primary fields settings:

parent — may contain both the ID and  pagetitle of the category a product belongs to; if this field is not defined, such a product will be ignored or added to the root catalog, depending on settings. 
If a category pagetitle specified in the parent field is missing from the website, it will be automatically generated. 
Likewise, nested categories (relative to the root catalog) are separated by the delimiter specified in the settings of the field “Additional Delimiter for JSON Fields” (default character | ). If one of these categories is missing, it will also be generated. Example: category1|category2; the category ‘category1’ created in the root catalog will contain a sub-category, category2, to be used in the parent field for the product.
categories — refers one product to several categories at the same time; the pagetitle parameter may be assigned as a value. Several categories may be presented via a delimiter specified in the settings field “Additional Delimiter for JSON Fields” (default character | ). If a certain category is missing, it will also be generated automatically. The second additional delimiter (default character %) can be used to defined such a category as ‘nested’ for an additional category that will be generated if missing.


Catalog;Bedclothing|Children Bedclothing        Bedclothing; Bedclothing (sub-category1)| Bedclothing (sub-category2)

The will be defined in the category ‘category1’ but also be accessed in the sub-categories ‘sub_category1’ and ‘sub_sub_category2’.
vendor — can be defined as both an ID and manufacturer’s name; if no manufacturer’s name is found, it will be generated.
gallery — a path to gallery photos may be local (relative to the website’s root catalog) or an http/https reference to an external resource (import is slower when an http/https reference is used). Several photos at a time can be defined via an additional delimiter (default character |).



alias — as a rule, there is no need to import this field, for it is automatically generated. by MODX based on the pagetitle value. This means that pagetitles are unique relative to categories.

Additional options and TV — the component supports user options and TV. If they contain a list as a value, the relevant data should be presented via an additional delimiter (default character |).

Example: importing a product color<span xml:lang=«EN-US»>:


Importing categories

Every string is a category separated by the character “;” (semicolon) from its sub-categories, which, in turn, are separated by an additional delimiter (default character |). 
Every next string should contain the category already defined in the file above.

parent — may contain both the ID and  pagetitle of the category a product belongs to; if this field is not defined, such a product will be ignored or added to the root catalog, depending on settings. 
If a category pagetitle specified in the parent field is missing from the website, it will be automatically generated. 
Likewise, nested categories (relative to the root catalog) are separated by the delimiter specified in the settings of the field “Additional Delimiter for JSON Fields” (default character | ). If one of these categories is missing, it will also be generated.

Example of a category import file:

        category3;Base category|category1|category2
As a result, the catalog tree will look as follows:

Relations import

Example of an import file:

Article ;Relation ID; Product ID        

Integration with msOptionsPrice2

If you have the installed component msOptionsPrice2 (2.2.37 or higher), you will have the opportunity of importing product modifications. 

The names of primary modification fields are as follows:

  1. name — modification name
  2. type — price modification type that may have a value of 1|2|3, which corresponds to  =|+|and -
  3. price
  4. old_price 
  5. article — for a modification, NOT the same as for a product
  6. weight 
  7. count 
  8. image — should contain the name of an image already assigned to a product
  9. active — whether or not a modification is active, with a value of 0|1
All the fields that can be used for a product modification will have the postfix "(msOptionsPrice2)" in the drop-down field. 
The fields relating to product modifications should have the prefix “msop:” for a correct operation of the function “Autodefinition of Fields”.

There are two options for importing product modifications:

  1. Importing product modifications only (the product should already exist). For this, choose “OptionsPrice2 Import” in “Import Type”. The file should necessarily contain the field specified in “Unique Product ID”. 
    Example of an import file:
                00000100;Replacement of&nbsp;display and touchscreen;1;600;pic3.jpeg;2 hours
                00000100;Replacement of battery;1;700;;2 hours
    msop:time — user variable that can be generated through additional options or plugin system
  2. Classic product import; fields with the "(msOptionsPrice2)" postfix will appear along with ordinary fields.  
    Example of an import file:
                00000100;Test product 1;Red;Replacement of display and touchscreen;1;600;pic3.jpeg;2 hours
                00000100;Test product 1;Red;Replacement of battery;1;700;;2 hours
                00000200;Test product 2;Red;;;;;

Each of the two options has advantages and disadvantages of its own. The first is worth using when you are sure that the product for which you import modifications already exists.   
The second can be used when there is no ID for the product. The problem with this option is that for each modification of the same product, that product will be repeatedly updated. 

Fast update of product data

A fast update of product data is used only for data directly related to a product (the table ms2_products). Neither TV nor additional options are to be updated; updates apply to data added through the minishop2 plugin system or via the msFieldsManager. dd-on. Updates only occur by means of sql requests to the database, bypassing MODX processors. 
Each product data file should necessarily contain a field specified in the settings option “Unique product ID”

Numerical fields have the following patterns: 
+=number — current field value in the database to be increased by that number 
-=number — current field value in the database to be decreased by that number 
*=number — current field value in the database to be multiplied by that number

Example of a price update file (current priced to be increased by 100):



Before you do the export, you need to make the settings for the fields you want to export for each type of export. The fields are set on the «Export Settings» tab in the «CSV / Excel File» section and consists of the following steps:

  1. select export type

  2. create (if not yet) the name for setting the fields, for this you need to press the button with six-hand

  3. Select the name of the settings for the fields in the list of «Field settings list»
  4. add the required number of fields, select the names for them from the drop-down list and then click on the «Save settings» button

After creating the field settings, you can proceed directly to export by selecting the desired values ​​from the lists


To export modifications to Yandex Market, add the names of your fields (generated via additional options or plugins) in the export settings to the list “Product Characteristics Fields”. 

Importing through CRON

  1. Navigate to the import settings and fiпd the “Cron” tab.
  2. Click the “Add task” button and fill out relevant fields in the pop-up window (the path to the file with data for import may also be an http/https reference; the task performance time is defined as in classic Cron).
  3. Click the “Save” button.
  4. Add the address from “Task for Cron” to Cron on your server.

Exporting through CRON

For CRON-based exports, you should have the following reference: 
/assets/components/msimportexport/export/export.php, with the following parameters: 

  1. token — a unique value that can be found in the ‘cron’ tab of the export settings
  2. to — (csv|xlsx|xml), csv by default
  1. type — (products|categories|links|options_price2), ‘products’ by default
  2. path — path to the folder where the default file assets/components/msimportexport/export will be saved.
  3. preset — export fields ID settings
  4. filename — filename (without extension)
  5. categories — a list of ID categories separated by the comma, from which a product should be exported (general export settings used by default)
  6. save — save on the server, using the ‘path’ parameter or send to the standard output stream (1|0), default 0
Example of product export reference in xlsx: 


Product import events

You may write plugins of your own and subscribe them for the following events:
msieOnStartImportProduct — occurs before the beginning of import
file — path to an import file
msie — Msie-class object with all methods

msieOnBeforePrepareImportProduct — occurs before the beginning of import data processing and contains the following variables:
data — input import data
fields — import field names array
msie — Msie-class object with all methods

msieOnEqualPageTitleImportProduct— occurs after adding/updating a product whose pagetitle is already present in the same catalog (the same parent). If the event cannot be processed, MODX will generate an URI error: Resource with ID already uses URI alias: Resource with ID already uses URI. Please enter a unique alias or use “Freeze URI” to replace it manually. 
mode — action (create|update)
productId — ID of a product with the same pagetitle
srcData — input import data
destData — data prepared for import (forwarded to the import processor)
fields — import field names array
msie — Msie-class object with all methods
The generation of an event is deactivated by default in import settings (the option “Check up product name for duplication”) , because it generates an excess database request. For this reason, if you are sure that you will not have duplicate product names relating to one parent, keep it deactivated. 

Example processing such an event:

        /** @var modX $modx */
        switch ($modx->event->name) {
        case 'msieOnEqualPageTitleImportProduct':
        $postfixAliasFieldName = 'article';
        $destData = $modx->event->params['destData'];
        $postfixAlias = isset($destData[$postfixAliasFieldName]) ? $destData[$postfixAliasFieldName] : '';
        if ($postfixAlias && $destData['pagetitle']) {
        $res = $modx->newObject('modResource');
        $alias = $res->cleanAlias($destData['pagetitle']);
        $delimiter = $modx->getOption('friendly_alias_word_delimiter', null, '-');
        $destData['alias'] = $alias . $delimiter . $postfixAlias;
        $modx->event->returnedValues['skip'] = false; // не  пропускать импорт данного товара т.к был создан уникальный alias
        $modx->event->returnedValues['destData'] = $destData;

msieOnBeforeImportProduct — occurs before product import and contains the following variables:
mode — action (create|update)
srcData — input import data
destData — srcData data prepared for import (forwarded to the import processor)
fields — import field names array
msie — Msie-class object with all methods

msieOnAfterImportProduct — occurs after product import and contains the following variables:
mode — action (create|update)
srcData — input import data  
destData — data prepared for import  
data — product data 
fields — import field names array  
msie — Msie-class object with all methods  
msieOnCompleteImportProduct — occurs after the completion of product import and contains the following variables: 
data — strings with ID products separated by the comma that were added/updated 
msie — Msie-class object with all methods 

msieOnBeforePrepareUpdateProduct — occurs before the beginning of import data processing and contains the following variables:
data — input data 
fields — field names array  
msie — Msie-class object with all methods

msieOnBeforeUpdateProduct — occurs prior to the beginning of product updating and contains the following variables:
data — data prepared for update 
fields — field names array  
msie — Msie-class object with all methods
To skip product updates in a plugin, assign a “true” value to  the “skip” variable.

        <span spellcheck="true">/** @var modX $modx */</span>
        switch ($modx->event->name) {
        case 'msieOnBeforeUpdateProduct':
        $modx->event->returnedValues['skip'] = true; <span spellcheck="true">// пропустить обновление товара</span>

msieOnCompleteUpdateProduct — occurs after the completion of all products’ update 
msie — Msie-class object with all methods

msieOnCompleteImportGallery — occurs after the end of the import to the photo gallery, contains the following variables:
Msie is an Msie class object, with all methods

msieOnCompleteImportLinks — occurs after the import of links, contains the following variables:
Msie is an Msie class object, with all methods

msieOnBeforeExport — occurs before each element’s export:
type — (products|categories|links|options_price2) 
srcData — input data 
destData — prepared data 
fields — field names array  
msie — Msie-class object with all methods  

msieOnCompleteExport — occurs after the completion of export and contains the following variables:
to — (csv|xlsx|xml) 
type — (products|categories|links|options_price2) 
file — path to a file 
msie — Msie-class object with all methods  

Example of a plug-in that only for a new product modifies its price before creating

    /** @var modX $modx */</span>
    switch ($modx->event->name) {
        case 'msieOnBeforeImportProduct':
        if($mode == 'create') {
        $modx->event->params['destData']['price'] = $modx->event->params['destData']['price'] + 100;
        $modx->event->returnedValues['destData'] = $modx->event->params['destData'];
        <span spellcheck="true">//$modx->event->returnedValues['skip'] = true; // пропустить импорт товара</span>
        <span spellcheck="true">//$modx->log(modX::LOG_LEVEL_ERROR, print_r($modx->event->params, 1));</span>
        <span spellcheck="true">//$modx->event->output('Error');</span>

Importing large files

If your import files are large enough, you may have to configure the following parameters in php.ini: 
1) Increase values for upload_max_filesize and post_max_size
2) Increase timeout for Apache or Nginx 
a) Nginx and PHP-FPM (In this case Nginx will be waiting for 300 seconds)

http {
        fastcgi_connect_timeout 300s;
        fastcgi_send_timeout 300s;
        fastcgi_read_timeout 300s;

b) Nginx is used as a proxy server (Nginx + Apache)

server {
        proxy_connect_timeout 300s;
        proxy_send_timeout 300s;
        proxy_read_timeout 300s;
        send_timeout 300s;
Do not forget to restart Nginx after changing settings: nginx -s reload
3) MySQL my.cnf
Increase values for max_allowed_packet и wait_timeout 
Do not forget to restart MySQL 


Minimum requirements: PHP 5.5.0 or higher; PHP extension — php_xml;php_zip 

Ask questions/Support 

If you have not this extra and you still have questions, you may ask them on page.

If you have bought it, find support at: 
your profile. If you report an error, please specify the version of MODX, miniShop2, pdoTools, msimportexport and php that can be found at /manager/?a=system/info, and modx log (first clean it and import or export) and the server. 

Overview video

Discuss the component in MODX.PRO community.

Ask your questions about paid add-on settings and use.

ImportExport 1.4.21

  • Added: Setting the "Product key, which determines its uniqueness" in the import preset
  • Added: Setting "Category Tree" in the export preset

ImportExport 1.4.20

  • Added: System event "msieOnBeforeExportQuery"

ImportExport 1.4.19

  • Fixed: Import categories

ImportExport 1.4.18

  • Fixed: Error "Failed to load resource: the server responded with a status of 502 (Bad Gateway)" when installing/updating a package

ImportExport 1.4.17

  • Updated: Library for working with Excel files (PhpSpreadsheet 1.6.0)

ImportExport 1.4.16

  • Added: Param "element" for snippet MsieBtnDownloadPrice
  • Added: Settings: leftjoin; innerjoin; select for export preset

ImportExport 1.4.15

  • Added: Param "where" for snippet MsieBtnDownloadPrice
  • Changed: Chunk msieBtnDownloadPriceTpl

ImportExport 1.4.14

  • Added: Export product preview image in Excel file
  • Added: Option for cron "Run by user"
  • Fixed: Export product images

ImportExport 1.4.13

  • Improved: Export Yandex.Market
  • Improved: Import by cron

ImportExport 1.4.12

  • Fixed: Export links

ImportExport 1.4.11

  • Fixed: Import options

ImportExport 1.4.10

  • Added: Integration with msProductRemains 2.1.18-pl

ImportExport 1.4.9

  • Fixed: Export in Excel

ImportExport 1.4.8

Warning! This update requires PHP version 5.6 or higher!

  • Added: Additional export condition for each preset
  • Changed: Library for work with excel

ImportExport 1.4.7

  • Improved: Export image msOptionsPrice2

ImportExport 1.4.6

  • Improved: Import msOptionsPrice2

ImportExport 1.4.4

  • Added: Integration with msSalePrice V-1.2.0-beta2
  • Added: Integration with msOptionsColor V-2.1.2-beta

ImportExport 1.4.3

  • Added: Option to delete all images from the product before importing
  • Added: Option to disable all modifications (msOptionsPrice2) from the product before import starts
  • Added: Parameter "The key of the product, which determines its uniqueness" for the passage through the Cron
  • Added: Events: msieOnStartUpdateProduct msieOnStartImportOptionsPrice2 msieOnBeforeImportOptionsPrice2 msieOnAfterImportOptionsPrice2 msieOnCompleteImportOptionsPrice2

  • Improved: Import alias (If the update is not specified, alias will use the old one)
  • Fixed: Reset custom import/export settings when updating a package
  • Fixed: Editing tasks for importing through Cron
  • Fixed: Exception "[MsieExcelReader] Exception Row 2 is out of range (2 - 1)"

ImportExport 1.4.0

  • Added: Gallery import/export
  • Added: «parents» parameter (tree-name for parents) for export
  • Changed: Categories import/export
  • Changed: Links import/export

Attention! Please back up database before use. If you already use this extra for importing/exporting links or categories, re-tune it. Please clean browser's cache after update.

ImportExport 1.3.10

  • Fixed: TV import (no reset for non-imported tv) for MODX >= 2.5.4

ImportExport 1.3.9

  • Fixed: Created categories

ImportExport 1.3.8

  • Added: Integration with msOptionsPrice2 V-2.2.37 beta
  • Improved: Work with categories. Important: clear the browser cache after the component’s update.

ImportExport 1.3.7

  • Added: Event msieOnStartImportProduct
  • Added: "sales_notes" tag support for Yandex Market

ImportExport 1.3.6

  • Added: "Full path to PHP interpreter"
  • Added: Integration with SeoPro
  • Added: Clearing HTML tags from the “Description” field for Yandex Market

ImportExport 1.3.5

  • Added: Fast product update
  • Added: Events msieOnEqualPageTitleImportProduct; msieOnBeforePrepareUpdateProduct; msieOnBeforeUpdateProduct; msieOnCompleteUpdateProduct; msieOnBeforeExport;
  • Added: Image export with absolute paths
  • Added: “filename” parameter for export via cron
  • Fixed: Categories’ export for Yandex Market
  • Fixed: Starting import via cron from the menu

ImportExport 1.3.4

  • Added: Field autodetection
  • Improved: Field settings list navigation
  • Fixed: Default context (web) settings

ImportExport 1.3.3

  • Added: Event msieOnBeforePrepareImportProduct
  • Added: Post-import upload folder cleanup
  • Improved: TV import (no reset for non-imported TV)
  • Fixed: Error 42S02 executing statement: Table msie_cron doesn't exist

ImportExport 1.3.2

  • Fixed: Error Using $this when not in object context

ImportExport 1.3.0

  • Changed: Import via cron
  • Changed: Export via cron
  • Added: TV variables to field settings list
  • Added: Events msieOnCompleteImportProduct and msieOnCompleteExport