Magento 2 Extensions:Stock Import Module

From XTENTO Support Wiki
Jump to: navigation, search
This is a guide for Magento 2. For Magento 1 extensions and guides, please refer to Magento 1 Guides.

Inventory import650 noborder small 1.png
Buy-now.png

Contents

Overview

Importing stock level updates from CSV/TXT/Tab/Fixed-Length/XML files into Magento 2 has never been easier. Using the Magento Stock Import Module by XTENTO you will be able to import stock information from third party systems into Magento - fully automated! Automate your inventory management today and don't spend hours a day updating stock levels manually.

Interested in this Magento Extension?

Head over to our store to purchase this extension: Magento Stock Import Module

Got questions? Feel free to contact us! Contact Form

Setting up the extension

After installing the extension as instructed in our general installation guide, please go to System > XTENTO > Stock Import Module. Please enter your license key there and set Module Enabled to "Yes".

cat composer.json | grep -q 'magento/project-community-edition' && (composer require phpoffice/phpspreadsheet "^1.0" ; composer dump-autoload) || echo 'composer.json seems to be broken! cannot install.'

Migrating from Magento 1 to Magento 2

Migrating your settings from Magento 1 to Magento 2 couldn't be easier. Unless you have customized the modules code, usually all your settings can be migrated without any additional work. In your Magento 1 environment, simply go to Catalog > Stock Import > Tools and export your profiles and sources. Then, log into Magento 2 and go to Catalog > Stock Import > Tools and import them there. That's it! Test everything and make sure it works as expected, but usually all settings are compatible with Magento 2 as well. Please note passwords of import sources cannot be migrated, you will need to enter them again.

Configuring the extension

The following description will cover the modules configuration located at Products > Stock Import.

Import Profiles

Import profiles can be set up for manual and automatic imports. Every profile contains information about the data to import (e.g. field mapping), when, how, and where to import from, as well as some other settings. The extension supports an unlimited number of different import profiles.

To set up new import profiles or to modify existing import profiles, please go to Products > Stock Import > Import Profiles.

Setting up a new import profile is easy. Press the "Add New Profile" button. You will then be asked to select the entity (stock level) to import, the file format (CSV/XML/TXT/...), as well as to assign a name to the profile which can be used to identify the import profile in import logs. Press the Continue button.

You will then be presented with the profile configuration. The configuration of import profiles is split into several different sections ("tabs") which are explained below.

1) General Settings

General Configuration
Name: Enter the name of the profile. This name will show up in execution logs and will be used to identify the profile when importing.
Enabled: If set to "No", this profile won't show up for manual imports nor will automatic imports be made.
File Processor: This defines the file format which will be imported, e.g. CSV/TXT/XML/... Import Type: Can't be changed after profile creation. Defines which entity (data type) gets imported. Available entities:

 Entity  Description
Stock Level Update stock level for products

2) Import Settings

Reindex mode: Should Magentos reindex process be initiated after importing?

If stock qty is equal or below "Qty for Item's Status to become Out of Stock", mark as out of stock (and mark as "In Stock" again if qty is above "Qty for Item's Status ..."): If the imported stock level is below 0 and this option is set to Yes, the stock status will be set to "Out of stock".

Import relative stock level: If set to "No", the stock level specified in the import file will be imported, whatever it is. If set to "Yes", if you import +5, 5 will be added to the current stock level, and if you import -5, 5 will be subtracted from the current stock level.
Product Identifier: This is what will be called the Product Identifier in the import settings and is what's used to identify the product in the import file. Almost always you will want to use the SKU. Using a custom attribute can be slower as well.

3) File Configuration

This section maps your import file format to the fields which will be adjusted/updated in Magento.

The options you see depend on the file processor selected in the "General Configuration" tab of the profile.

CSV/TXT/Tab-delimited

Use this processor if you want to import CSV/TXT/Tab-delimited file formats, so any format where fields are delimited by some character, e.g. , ; | etc.

Configuration
Skip header line: Set this to "Yes" if you want to skip the first line of each imported CSV file as it's the header line containing the column names. You must set this to "Yes" if the first line contains the column names and you want to map fields by column name.

Field Delimiter: REQUIRED: Set the field delimiter (one character only). Example field delimiter: ; (Hint: If you want to use a tab delimited file enter: \t)

Field Enclosure Character: Set the field enclosure character (one character only). Example: "

File Mapping
You can can map the import fields to the actual column names in the CSV file here. Make sure to enter the EXACT same column name (case-sensitive).

If there are no columns in the import file, you can also map by index. The first field in the file would be 0 - the second field in the file would be 1 and so on.

"Additional Configuration"

(This feature is only available in the Magento 2 version of this extension) The "Configure" button shown right next to each field mapped using the Field Mapper opens a popup where custom XML "code" can be specified. This custom XML can be used to manipulate the data mapped for this field, coming from your import file.

If you open the configuration popup for the first time it will have the following contents: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
</configuration>

This is the default configuration markup. Various actions can be specified there to manipulate field data, for example to map field values (if your mapped field "stock status" contains "X", set the value to "Y" for example) or skip import rows, etc.

The following actions can be used:

map: Map values, for example if the data in the file for your mapped field equals "X" (case-sensitive) map that to "Y" instead, and if it *matches* the regular expression "[0-9]" (no // delimiters may be used) map that to "Z" instead:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <map from="X" to="Y"/>
    <map from="[0-9]" to="Z" method="preg_match" regex_modifier="i" />
    <map from="^1Z" to="X" method="preg_match" negate="true" regex_modifier="i" /> <!-- Negate option, added in module version 2.2.0 - matches only if the "from" value does NOT match -->
</configuration>


replace: Replace data in field values for your mapped field. For example, if your field contains "product_" and you want to replace that with "" (empty string), or replace using a regular expression, for example remove numbers from the data:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <replace search="product_" replace=""/>
    <replace search="[0-9]" replace="" method="preg_replace" regex_modifier="i"/>
</configuration>

Example to replace everything after the last dot and the dot itself: <replace search="\..*$" replace="" method="preg_replace" regex_modifier="i"/>

Example to prepend text to the current field, for example add "GS" in front of the field value: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<replace search="^([A-Za-z0-9\.\-\s]+)$" replace="GS\1" method="preg_replace" regex_modifier="i"/>
</configuration>

Example to append text to the current field, for example add "Hello" at the end of the field value: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<replace search="^([A-Za-z0-9\.\-\s]+)$" replace="\1Hello" method="preg_replace" regex_modifier="i"/>
</configuration>

Example to prefix imported numbers with a + if there's no + or - in front of the number (important for relative stock updates):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<replace search="^(\d+)$" replace="+\1" method="preg_replace" regex_modifier="i"/>
</configuration>


use: If a field from your import file matches or equals "X", use a different field from the file for this mapped field instead. For example, if the first field in your file (index 0) is X use the third field (index 2) from the file for this field instead, or if it matches the regular expression "[0-9]" use the 8th field (index 7) from the file instead:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <use field="2" if="0" is="X"/>
    <use field="7" if="0" is="[0-9]" method="preg_match" regex_modifier="i"/>
    <use field="7" if="0" is="[0-9]" method="preg_match" negate="true" regex_modifier="i"/> <!-- Negate option, added in module version 2.2.0 - matches only if the "is" value does NOT match -->
</configuration>


skip: If a field in your import file matches or equals "X", the current import line/row will be skipped, so the order won't be updated. For example, if you have a field with the column header "Indicator" that is "X" or matches the regular expression "[0-9]", the row will be skipped:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <skip if="Indicator" is="X"/>
    <skip if="Indicator" is="[0-9]" method="preg_match" regex_modifier="i"/>
    <skip if="Indicator" is="[0-9]" method="preg_match" negate="true" regex_modifier="i"/> <!-- Negate option, added in module version 2.2.0 - matches only if the "is" value does NOT match -->
</configuration>


calculate: New since version 2.5.0, this allows you to do arithmetic operations on imported values. For example, add 20% to the imported product price:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <calculate operation="*" value="1.2"/>
</configuration>

The following operations are allowed: + - * /

Since module version 2.8.8 it is possible to call the "round" operation (to round to N decimals, below example 2 decimals):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <calculate round="2"/>
</configuration>

Since module version 2.8.8 it is also possible to do multiple <calculate calls on a single field.

Also since module version 2.8.8: To round to the nearest 10 cents, use:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <calculate operation="roundnearest" value="2"/>
</configuration>

Calculations don't work? Make sure the numbers you are trying to calculate with are real numbers ("100" or "1.12") and not numbers in wrong format with comma as decimal separator ("1,23"). In case you use comma as decimal separator, do it like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <replace search="," replace="."/>
  <calculate operation="*" value="1.2"/>
</configuration>


All actions can be combined, for example: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <map from="X" to="Y"/>
    <map from="[0-9]" to="Z" method="preg_match" regex_modifier="i" />
    <replace search="product_" replace=""/>
</configuration>

XLS/XLSX/ODS/Excel

Since version 2.7.2 (released in September 2019) it is possible to import and process XLS/XLSX/ODS/Excel files using the extension. When setting up a new profile, simply select the XLSX file processor. Then, map your profile exactly like described in the CSV section above - it's the same mapping-wise, but in the background magically your XLS/XLSX file will be processed.

XML

Use this processor if you want to import XML file formats.

Video Guide

Configuration
Data XPath: Set the XPath for the node containing the inventory updates.

Example XML file:
<items>
<item>
...
</item>
<item>
...
</item>
</items>

The inventory updates would be located in each "item" node, which are located in the "items" node, so the XPath would be: //items/item

Every "item" node located under the "items" node would be processed then.

More information about XPath can be found here: http://www.w3schools.com/xpath/

File Mapping
You can map the actual import fields to the fields in the XML file here. Make sure to enter the EXACT same name (case-sensitive).

What you enter into the "Field Name" field is XPath. So for example if you had this XML markup:

<items>
<item sku="123">
<qty>1</qty>
</item>
</items>

To fetch the sku you would enter: @sku (@ in front because it's an attribute) To fetch the qty you would enter: qty (This is the field name of the field you want to fetch)

To fetch the qty from the DEF node from an example like this:

<Availability>
<Location>
<wCode>BCD</wCode>
<Qty>10.0000</Qty>
</Location>
<Location>
<wCode>ABC</wCode>
<Qty>7.0000</Qty>
</Location>
<Location>
<wCode>DEF</wCode>
<Qty>3.0000</Qty>
</Location>
<TotalAvail>20.0000</TotalAvail>
</Availability>

You would do: Availability/Location[wCode='DEF']/Qty


More information about XPath can be found here: http://www.w3schools.com/xpath/

Nested Nodes

(This feature is only available in the Magento 2 version of this extension)

If your fields are nested in nodes, you can specify additional XML using the "Configure" button that defines whether a field should be retrieved from a different / looping node below the current XPath. For example, if you want to import this format (tracking information NESTED under the order information):
<orders><order><id>X</id><tracks><track><number>1123</number><carrier>test</carrier></track></tracks></order></orders>
The nested tracking data node would be //tracks/track then as the tracks are child nodes of the data node. The following XML would be specified using the "Configure" button for the "Tracking Number" field (for the "File Field Name / Index" you would enter "number" (without the quotes) as that is the name of the field on //tracks/track level):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<nested_xpath xpath="//tracks/track"/>
</configuration>

"Additional Configuration"

Please refer to the Additional Configuration section of the CSV processor. It's the same as for XML.

Fixed-Length Formats

It is also possible to import fixed-length formats using the module. Just select the CSV/TXT/Tab processor when creating a profile.

Into the Field Delimiter column enter: FLF When mapping a field at "File Mapping", you would enter the starting and ending position of the field into the "Field Name / Index" field.

For example if you wanted fetch position 5 to 30 you would enter: 5-30

Updating custom product attributes

Got custom product attributes such as "back in stock date" that you want to update using the extension? That's possible since version 2.3.8, released in 2018. While updating custom product attributes is slower than just stock level updates, it's still a huge new feature.

Custom product attributes can be mapped to your import file in the "File Settings" tab. If you want to import an "empty value" for a product attribute, you must set the value in the import file to "__EMPTY__" (without the quotes).

In general, whatever value you put in your import file will be saved in the product attribute. For drop-down/select attributes (such as Size/Color, etc.) you must use the "Admin Label" of the option you want to set, for example "XS" or "S", etc.

4) Import Sources

Select the import sources where files should be downloaded from before importing simply by checking the checkbox right before the Source ID.

Please refer to the Import Sources section below to get an idea how to configure and set up sources.

5) Automatic Import

It is possible to set up cronjob imports for import profiles.

Cronjob Import

If you want to automate imports, you can set up cronjobs for profiles which execute the import for this profile at certain times automatically. First of all, make sure to set up your Magento cronjob as explained here. You can easily control the cronjob status right from the import module, by going to "Cronjob Import" when editing a profile in the "Automatic Import" tab. The Cronjob Status field will contain information about the status of the cronjob and whether any action is required or not.

To enable cronjob imports for this profile, simply set Enable Cronjob Import to "Yes". Select the Import Frequency of how often you want the import to run. That's it.

It is also possible to set up multiple, different cronjobs for one profile, for example if you wanted the cronjob to run at certain times during the week and only at 10pm on weekends. To do so, select "Use custom import frequency" from the Import Frequency dropdown, and enter one or more cron expressions separated by a semi-colon (;) in the Custom Import Frequency field. You can enter an unlimited amount of cron expressions there separated by semi-colons, just make sure they are valid cron expressions.

Example custom cron expression calling the cronjob for a profile at 8am, 1pm, 3pm at every full hour from Monday to Friday: 0 8,13,15 * * 1-5

Further examples:

Minute Hour Day Month Weekday Cron Expression Description
0 0 * * * 0 0 * * * Every day at 00:00
5 * * * * 5 * * * * Five minutes after every full hour
*/5 * * * * */5 * * * * Every 5 minutes
59 23 * * 0 59 23 * * 0 Every Sunday (Sunday can be 0 or 7) at 11:59pm
20,30 1 * * 1-5 20,30 1 * * 1-5 Monday to Friday at 01:20am and 01:30am
0 1 1-7 12 1 0 1 1-7 12 1 From Dec 1 to Dec 7, as well as on every Monday in December at 00:00

Important: Automated imports will only be made if the profiles status (under General Configuration) is "Enabled".

6) Profile Execution Log

The profile execution log shows any imports made using this profile, be it manual or automatic.

Import Sources

Import sources are the actual "sources" where imported files will be downloaded from. If your only goal is to manually import and upload import files from the Magento backend, you won't need to set up any import sources. If you need to download import files from remote FTP servers or certain local directories on the Magento server, you will have to set up import sources.

The module supports an unlimited amount of different import sources. The following source types are currently supported:

 Source Type  Description
Local Directory Files are retrieved from a local directory on the Magento server
FTP Server Files are retrieved from a remote FTP(S) server
SFTP Server Files are retrieved from a remote SFTP server.
HTTP Server Files are retrieved from remote HTTP servers by sending a GET/POST request for example
Webservice/API Files are retrieved from webservices/API. The webservice/API code must be set up by you.
Custom Code / Custom Class Imports can be handled by a custom class you can set up. This class could parse and modify, and then return files to process to the module.

Setting up Import Sources

To set up import sources, go to Products > Stock Import > Import Sources. You can modify existing sources there or add new sources.

Setting up a new import source is easy. Press the "Add New Source" button. You will then be asked to select the source type (from which type of "server" the imported files will retrieved from) to create, as well as to assign a name to the source which can be used to identify the source in import profiles and logs. Press the Continue button. You will then be presented with the source configuration.

Source Types

Local Directory

This source type will simply fetch imported files from a local directory on the Magento server.

If you begin the path with a dot in front of it, for example ./var/import/ the path will be relative to the Magento root directory. This means the file would be loaded from the /var/import/ directory located in the root directory of Magento.

Supplying an absolute path is possible by beginning the path with a dash, for example: /var/www/tmp/import/

Please make sure the path you enter is readable by the webserver. It must be possible for the webserver to read the files in that directory, otherwise a warning will be shown/logged.

FTP Server

The FTP source type supports downloading files from FTP servers.

The following configuration must be entered for FTP servers:

 Field Name  Description
IP or Hostname Enter the hostname (address) or IP address of the FTP server you want to download files from
Server Type You can select FTP or FTPS server types. Please note that FTPS (FTP "with SSL") is only supported if PHP has been compiled with OpenSSL support and also the PHP implementation is quite picky with regards to which servers it supports.
Port Enter port of FTP server. This is port 21 usually.
Username Enter the username used to log into the FTP server
Password Enter the password used to log into the FTP server
Timeout Connection timeout in seconds after which the connection will fail
Enable Passive Mode If your server is behind a firewall, or if the extension has problems downloading the import files, please set this to "Yes".
Import Directory Enter the directory from which files should be downloaded from
Filename Pattern This needs to be a valid regular expression. The regular expression will be used to detect import files. The import will fail if the pattern is invalid. Example: /csv/i for all files with the csv file extension or for all files in the import directory: //
Archive Directory If you want to move the imported file(s) to another directory after they have been processed, please enter the path here. This is the absolute path to the archive directory on the FTP server. This directory has to exist on the FTP server. Leave empty if you don't want to archive the import files.
Delete imported files Set this to "Yes" if you want to delete the imported file from the FTP server after it has been processed. You can't delete and archive at the same time, so choose either this option or the archive option above.
Potential issues: Connection/upload fails
SFTP Server

The SFTP (Secure File Transfer Protocol) source type is identical with the FTP source type, except that it loads files from a SFTP server. This source type supports SFTPv2 and SFTPv3 servers only, other SFTP server types are not guaranteed to be compatible. To find out which SFTP server version your server is using, connect to it using WinSCP (download here and look at the very bottom status bar. It will show the SFTP server version.

Most of the time port 22 is used for SFTP servers.

Potential issues: Connection/upload fails
HTTP Download

This source type allows you to download files hosted on webservers, for example from Dropbox or Google Sheets.

You can enter any link, for example https://www.myserver.com/folder/file.csv

If you need to authenticate (username/password, basic auth) supply the URL in the following format: https://username:[email protected]/folder/file.csv

Additional Guides:

HTTP Server

To download files from a HTTP server, please follow the following steps:

  1. Go into the app/code/Xtento/StockImport/Model/Source/ directory and rename the file "Http.php.sample" to "Http.php"
  2. Enter the function name you want to call in the Http.php class in the field below.
  3. Open the Http.php file and add a function that matches the function name you entered. This function will be called by this source upon importing then.

Example: If you enter server1 in the function name field below, a method called server1() must exist in the Http.php file. This way multiple HTTP servers can be added to the HTTP class, and can be called from different import source, separated by the function name that is called. The function you add then gets called whenever this source is executed by an import profile.

Important: Please make sure the function you enter exists like this in the app/code/Xtento/StockImport/Model/Source/Http.php file: public function yourFunctionName() { ... }

Potential issues: Connection fails
  1. Please go through the steps above one or two more times again to make sure you really set it up exactly as explained.
  2. Please make sure there is no firewall blocking outgoing HTTP connections. Get in touch with your hoster if in doubt.
Webservice/API

To import data from a webservice, please follow the following steps:

  1. Go into the app/code/Xtento/StockImport/Model/Source/ directory and rename the file "Webservice.php.sample" to "Webservice.php"
  2. Enter the function name you want to call in the Webservice.php class in the field below.
  3. Open the Webservice.php file and add a function that matches the function name you entered. This function will be called by this source upon importing then.

Example: If you enter server1 in the function name field below, a method called server1() must exist in the Webservice.php file. This way multiple webservices can be added to the Webservice class, and can be called from different import source, separated by the function name that is called. The function you add then gets called whenever this source is executed by an import profile.

Important: Please make sure the function you enter exists like this in the app/code/Xtento/StockImport/Model/Source/Webservice.php file:

public function yourFunctionName() { ... }

Potential issues: No connection
  1. Please go through the steps above one or two more times again to make sure you really set it up exactly as explained.
  2. Please make sure there is no firewall blocking outgoing HTTP connections. Get in touch with your hoster if in doubt.
Sample Code / Sample Implementations

Please refer to this article for sample code & further information on how to connect Magento to custom REST/JSON/SOAP/... APIs.

Custom Code / Custom Class

You can set up an own class in our (or another) module which gets called when importing. The loadFiles() function would be called in your class. If your class was called \Xtento\StockImport\Model\Source\Myclass then the identifer to enter here would be \Xtento\StockImport\Model\Source\Myclass

Please make sure the following function exists in your custom class: public function loadFiles() { ...your code here... }

Logging errors in the profile log for custom sources

If you developed a custom class or set up a custom webservice/HTTP connection function, and in case of errors want to log them in the execution log, you can access the log entry like this to add a warning for example:

$logEntry = $this->_registry->registry('stockimport_log');
$logEntry->setResult(\Xtento\StockImport\Model\Log::RESULT_WARNING);
$logEntry->addResultMessage(__('Source "%1" (ID: %2): %3', $this->getSource()->getName(), $this->getSource()->getId(), 'Something went wrong'));

Enabling Import Sources in Profiles

To associate created import sources to import profiles, open an import profile and go to the Import Sources tab and select the import sources where the file should be sent to by selecting the checkbox in front of it. Then save the profile.

You can associate an unlimited number of sources to a profile.

Using the extension

The following functions can found at Products > Stock Import.

Manual Import

Importing updates manually is easy. After configuring the extension and creating profiles, just go to Products > Stock Import > Manual Import.

First of all, select the profile you want to import. You can then select a file to upload (no files will be loaded from configured sources then) OR if you don't select a file to upload, files will be downloaded from configured sources in the import profile.

There are two more options to enable here. Test Mode and Debug Mode. If test mode is enabled, no real updates will be imported, nothing will be updated. If debug mode is enabled, a detailed log showing information about the last import will be shown. Both can be enabled at the same time.

If you're ready to import, just press the Import button. You will be presented with a success message if the import completed successfully. (Or an error message alternatively)

Automatic Import

To set up automatic imports, please have a look at the Automatic Import section configurable for each import profile. You can check/control whether automatic imports were made or not in the Execution Log.

Execution Log

The profile execution log shows any imports made using all profiles, be it manual or automatic.

Tools

Export Settings

The extension comes with functionality to export certain module configuration. All or certain import profiles as well as import sources can be selected for exporting at Products > Stock Import > Tools, and can be exported by simply pressing the Export Settings button then. The exported file (ending in .json) can then be imported into another Magento installation using the Import Settings functionality, making it very easy to transfer your settings between development/staging/test/live environments or for clients.

Import Settings

The extension comes with functionality to import certain module configuration from other Magento installations. This means if you've previously exported import profiles or import sources using the Export Settings functionality, you can import it here again.

Please note no passwords of import sources will be imported. These will have to be re-entered manually for destinations.

Questions? Concerns?

Got questions? Feel free to contact us! Contact Form

Interested in this Magento Extension?

Head over to our store to purchase this extension: Magento Stock Import Module

Updating tier prices

Since version 2.5.8 it is possible to import/update tier prices of products. However, only for Magento 2.2 or newer.

To do so, in the "File Mapping" tab of your import profile, you can map one field for each of your customer groups. Or, use the "Tier Price (ALL)" field, which is customer group agnostic.

In your import file, you will then need to put a special syntax into the column to update the prices. The syntax for tier price updates: "qty_threshold1:price1;qty_threshold2:price2;qty_threshold3:price3"

Example: 25:10.00;50:9.00;100:8.00%

This would set "qty 25+" to $10, "qty 50+" to $9 and "qty 100+" to 8% discount.

Please note that updating tier prices is rather slow. It is not suggested to do this with every import again and again, and rather should be a one-time or as-required procedure.

To remove a tier price, supply the following value for the tier price: __EMPTY__

Troubleshooting

Or: How to fix the most common issues.

FTP Download does not work

Multi Warehouse Extensions

We do support third party extensions that add the ability to manage stock on a per-website/per-store level to Magento. However, only extensions which use the stock_id in the cataloginventory_stock* tables are supported. Extensions that set up custom tables in the database to manage the stock are not supported, as this is not the default tables that Magento would use. Currently, we are aware of the following extensions that use the cataloginventory_stock tables: [None yet for Magento 2]

You can then map the "stock_id" field in the "File Configuration" tab of the import profile. This can be set to a static value then (for example, use stock_id 3 (=warehouse ID of your multi-warehouse extension) for all imports of this profile), or you can map it to a column in your import file and thus import stock levels on a per-store/website level.

Magento 2.3 Multi-Source Inventory (MSI)

The extension supports the brand-new Magento 2.3 MSI feature. You can import stock levels for each of your sources ("warehouses") using the extension.

In the "File Settings" tab of your import profile, add the "Source Code" field to your mapping. Now there are two possibilities:

Error: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '[...]' for key 'PRIMARY'

If this error shows up when importing, conflicting files are located in the import source directory. If there are two or more files that contain the same products, the module doesn't know which data is the one to use/update and thus fails because of inconsistent data in the import files. Make sure no conflicting data is in the import directories, i.e. a SKU should never be in two files at the same time when importing, as the modules doesn't know which value to use for the update.

Error "Unable to unserialize value." when using module or opening profile

You are using an outdated module version and upgraded to Magento 2.2 or newer. A change in Magento 2.2 requires an update of our module, please update this module to the latest version.

Segmentation Fault / PHP crashes when trying to import large files

Could be a crash because of an inefficient regular expression happening inside the Magento 2 core.

Be sure to check out "ulimit -s" on your server and make sure it's set to a high enough value. Also, take a look at the php.ini setting "pcre.recursion_limit" which shouldn't be set to a too high value.

Products that are not in the import file need to be set qty 0

File: \app\code\Xtento\StockImport\Model\Import\Entity\Stock.php

Look for: // Set all product IDs not in files to out of stock, uncomment to enable

After these lines, uncomment the code block. This will set all products which are not in the import file that is imported to out of stock.

Products are never set to out of stock, even though qty is 0 or below

Maybe you have enabled backorders in Magento. If items can be backordered ("Allow Qty Below 0...", in product & System > Configuration > Inventory), they are never out of stock and thus the stock status never changes to out of stock.

Stock / product updates are slow

Maybe your indexers are configured wrong. Do not use "Update on save". Instead, make sure they are set to "Update by schedule".


Tier price updates are slow

Do you use a Mirasvit extension for dynamical categories? This extension runs processes on product->save() and slows down the import.

Personal tools
Namespaces
Variants
Actions
General Information
Magento 2 Guides
Magento 2 Extensions
Magento 1 Guides
Magento 1 Extensions
Magento Integration Suite
Product Feed Guides
Toolbox