How to create a custom import in Magento 2

- E-Commerce, Fire development, Magento 2

Magento 2 import export debug log

Below, we shed light on how to create a custom import in Magento 2. As usually, we describe two different approaches. Firstly, you will find a community-provided solution that requires technical skills and coding experience. Secondly, we provide a more user-friendly way to create a custom import in Magento 2. Before we proceed, check more useful tips here: Magento 2 Cookbook

'

The Problem

PauGNU started a topic on StackExchange, where he asks about possible ways of creating a custom Magento 2 import. The author speaks about the Dataflow model of Magento 2 as an example of the custom import implementation. 

However, nothing similar is available in Magento 2. The new platform version lacks  ‘advanced profiles’ so that you cannot add custom entities to the import section. What do other community members recommend? 

DIY Custom Magento 2 Import 

If you have enough skills and experience, it is possible to create a DIY import solution for magento 2, applying all the necessary customizations. But the more complicated your requirements are, the more work should be done.

Franck Garnier proposes to create a custom import with Magento 2. As follows: leverage the CatalogImportExport or CustomerImportExport module based on the ImportExport Magento module. Use the latter as a reference and follow these steps:

  • First of all, you have to create your own CustomImportExport module.
  • Next, it is necessary to add an import.xml configuration file. Follow these additional steps:
    • Add your entity model and behavior;
    • Add your entity type;
    • Add relatedInxexer to refresh data after import.
  • Now, you can implement a custom Magento 2 import model with your logic.

That’s it! The author also provides the following code examples. Perhaps, they will make the answer more evident.

Use the following code for import.xml: 

Look for the behavior module here:

And here is the product import model example:

These tips should be helpful if you are an experienced coder. However, qualified programmers may already know how to create a custom import in Magento 2. So, if you still have a zero understanding of how to achieve your business goal, proceed to the next chapter of this article. 

Magento 2 Import Customizations for Everyone

Unfortunately, the default import/export solution of Magento 2 is minimal. It prevents you from transferring data using different file standards. You cannot automate transfers. And if a data file contains unsupported attributes or values, it leads to an error. As for particular business cases and custom import implementations, they are very problematic. However, you can utilize the Improved Import & Export Magento 2 extension to create a custom import profile in Magento 2. The module offers enough features to complete even the most complex data transfers. 

It offers the following benefits over the native import:

  • We’ve fixed all common import issues related to the default tool. Or extension doesn’t have them.
  • Speed. Our module can import even large files very vast. The data is split into bunches, so the module uses less resources.
  • Magento 2 entities. While the default tools let you import only a few entities, cover not only products and customers but also orders, categories, B2B, MSI, etc.
  • Support for multiple file types. Our module is not limited to CSV. It supports a bunch of other formats. 
  • Alternative data transfers. In addition to files, you can import data from Google Sheets and via API.
  • Different file sources. At the same time, it is possible to import data files from Dropbox, FTP, and SFTP.
  • Frequent improvements. We provide several updates with 20+ changelog items per year.
  • Attribute mapping. Your custom attribute naming will no longer prevent import p[rocesses. Furthermore, you can make third-party data files compatible with Magento 2.
  • Filters. The extension lets you export only relevant data that your partners need.
  • Backend + CLI. You can either rely on a user-friendly admin interface or use dedicated CLI commands.
  • You can find everything you need to know about the Improved Import & Export extension in the explicit documentation. 

When it comes to the competitors, our module is better due to the following facts:

  • One-time purchase. You buy Improved Import & Export only once. We don’t use SAAS, recurring payments, or IPAAS models.
  • Open code. You can freely create a custom Magento 2 import solution on the basis of our module. Adjust the extension to fit your business needs.
  • Data control. Since the extension is installed on your Magento 2, you can fully control all data flows it creates. We use no cloud options.
  • Different use-cases. Often, there is no need to implement a custom import in Magento 2 due to the arsenal of features our extension provides. It covers numerous use-cases from migration to warehouse management.
  • Support period. By purchasing our plugin, you also ger a support period in which we consult, assist, and do small customizations.
  • Entities. Improved Import & Export works with all basic Magento 2 entities.
  • APIs. We use APIs to connect your e-commerce website with any CRM, ERP, PIM, and other external systems.
  • No conflicts. We built our module with native and third-party software in mind so that you won’t face any conflicts.
  • Best coding practices. With top Magento 2 specialists, we are on the verge of technology.

If the basic functionality of Improved Import & Export is not enough to satisfy your business requirements, we offer the following services and customizations:

  • Migration from Magento 1 to Magento 2.
  • Migration from Shopify, Bigcommerce, Prestashop, and Wocommerce to Magento 2.
  • Setup and customization of dropshipping and multi-channel sales models.
  • Synchronization with CRM, ERP, and PIM systems via REST/SOAP APIs.
  • Assitance with exporting custom Magento 2 feeds.
  • XSLT templates for XML files.
  • Other extension customization services

Contact Us to discuss your business needs. Chances are, you don’t need to create a custom Magento 2 import with our extension since the Improved Import & Export extension already offers the functionality you are looking for. If it still lacks features you need, we can implement them.

Let’s explore a look at the basic functionality of our extension to provide you with a better understanding of its possibilities.

Improved Import & Export Features

The Improved Import & Export Magento 2 extension lets you automate data transfers. You no longer need a custom import solution to move datafiles automatically. The module enables you to create cron-based schedules or use triggers to launch import/export processes. You only need to choose a predefined value or create a custom interval to make everything work. The configuration looks as follows: 

Magento 2 CMS Blocks

As we’ve mentioned above, mapping is another feature that can replace the Magento 2 custom import. While the default tools don’t let you replace third-party or custom attributes in the backend, the Improved Import & Export enables you to apply mapping presets. Next, the plugin replaces all third-party attributes with ones used internally in a fully automated manner. Your role in this process is reduced to a few clicks, as shown below:

Alternatively, Improved Import & Export offers an interface where you can match all third-party and custom attributes to ones used internally. The procedure is straightforward and intuitive. You select a third-party attribute and specify a replacement. 

It is also possible to map and edit attribute values and third-party categories. If you are looking for a custom import solution for Magento 2 to implement this functionality, choose our module. In addition to that, the module enables you to create attributes on the fly. The module generates the missing data using the provided parameters.

You can freely import/export the following entities:

  • Products;
  • Categories;
  • Customers and Addresses;
  • Advanced Pricing;
  • Product Attributes;
  • Orders;
  • CMS Pages;
  • CMS Blocks;
  • Catalog & Cart Rules;
  • Gift Cards;
  • Reviews;
  • URL Rewrites;
  • Search Terms and Synonyms;
  • Widgets;
  • Page Hierarchy.

Note that we are going to add more entities within further extension updates.

As for file formats, our extension lets you transfer data via CSV, XML, Json, XLSX, ODS, and ZIP & TAR. Thus, you no longer need a custom Magento 2 import solution to transfer such files into your system. 

Improved Import & Export simplifies your daily routine by eliminating the necessity to convert tables to CSV. It is also possible to import any XML file to Magento 2 with the help of XSLT. As for the JSON support, it enables much more extensive opportunities than the default import tool, providing the ability to run REST API transfers.

With the support for Excel and OpenOffice, the extension can import XSL, XSLX, and ODS tables. You don’t need to convert them to CSV. Also, note that the Improved Import & Export Magento 2 extension eliminates the necessity to extract data files from an archive before importing them to Magento 2.

You can transfer data from the following sources:

  • REST and SOAP API;
  • Google Sheets;
  • Direct URL;
  • FTP/SFTP;
  • Dropbox;
  • Direct File Upload.

We are going to extend this list within the next updates. 

If the features described above are not enough, you can extend the functionality of our module with the help of the following add-ons:

  • MSI Add-on lets you transfer entities added to Magento 2.3 with the official Multi-Source Inventory extension. You don’t need a custom Magento 2 import solution to import and export such data as warehouses and product quantity per warehouse with this add-on.
  • With B2B Add-on, you can freely transfer entities added to Magento Commerce (Cloud) with official B2B extension. Our solution lets you import and export companies, shared catalogs, quotes, negotiable quotes, and requisition lists.
  • WooCommerce Migration Add-on is responsible for the migration from WordPress to Magento 2. No custom import solution for Magento 2 is necessary to transfer data from your old website to a brand new one. 
  • As for MS Dynamics Integration Add-on, it enables the Magento 2 MS Dynamics Business Central ERP/CRM integration. You can synchronize products, orders, customers, shipping, and invoices between the two systems with its help.
  • You get the same opportunities with NetSuite Integration Add-on. No custom import tool is necessary.
  • With Banggood Dropshipping Add-on, you can start a dropshipping business based on our favorite e-commerce platform. The add-on provides the ability to connect your e-commerce store with the Banggood with no customizations. Next, you can synchronize products, orders, and shipping details between the two platforms.

All add-ons are available here: Magento 2 Extensions by Firebear.

Final Words

Improved Import & Export is a potent tool designed to transfer data between your Magento 2 website and any external system. If your business case requires additional improvements, contact us to discuss what exact features should be implemented. For further information, follow the link below:

Get Improved Import & Export Magento 2 Extension

'