Amasty’s Magento 2 Import Made Easy [With Sample CSV Download]

Table of Content

Magento 2 Import [With Sample CSV File Download]
0 comments

Amasty's Import and Export extension for Magento 2 can be a powerful tool for managing your online store, simplifying migration, and securing data. However, when a solution is feature-rich, confusion comes with the territory.

This article explains the basics, shares common use cases, and offers Magento 2 import Products CSV file downloads to help you efficiently use the extension.

Root Entities vs. Subentities

In Magento's Import system, root entities and subentities refer to the hierarchical structure used to organize data during the import process. Understanding these concepts is key to managing data effectively when using Amasty's Import/Export extension.

Root Entities

Root entities are the primary, top-level data objects that serve as the core of an import operation. Each import profile starts with a root entity, which defines the main type of data being handled. Root entities contain the most critical and identifying information required to process the data.

Common examples of root entities in Magento include:

  • Products – Identified by fields like SKU or Product ID.
  • Customers – Identified by fields like Customer ID or Email.
  • Orders – Identified by fields like Order ID or Increment ID

Subentities

Subentities are additional, related data points that extend or supplement the information provided by the root entity. They provide more detailed information about a root entity and are imported as nested or associated records under the primary root entity.

Examples of subentities for each type of root entity in Magento include:

  • Products subentities could be product attributes (like price, color, size), categories, websites, stock quantities, and images.
  • Customers subentities could include customer addresses, payment methods, and order histories.
  • Orders subentities could include shipment details, payment information, and ordered items.

Key Differences Between Root Entities and Subentities

  1. Hierarchy – Root entities are the primary data objects and must be defined first in an import file. Subentities are secondary and provide additional details to the root entities.
  2. Identifier Requirements – Root entities require a unique identifier (like SKU for products or Email for customers) to ensure accurate data management. Subentities do not have unique identifiers but are associated with the root entity using entity keys or prefixes (see below).
  3. Data Structure and Import Rules – The order of fields in an import file must be organized according to the root entity and its subentities. Fields belonging to subentities need to be correctly prefixed to align with the Magento database structure.

Your 4 Key Actions to Take in the Import Profile Setup

Now that you’re aware of what root and sub-entities in the Magento import profile are, let’s look at the 4 most common profile setup steps you need to take care of.

1. Choose an Identifier for the Root Entity

As we’ve mentioned, the root entity forms the foundation of each import profile structure in Magento. Selecting an Identifier (see below) for each entity is an obligatory step.

Magento 2 Import - Identifier

A Product Identifier, for example, is a unique field, such as SKU (Stock Keeping Unit), Product ID, or a custom attribute, that helps differentiate each product from others in the import file. It also ensures reliable and effective imports, which in turn supports better store management, reduces manual errors and improves data integrity across your Magento store.

2. Add Custom Entity Keys to Subentities

Subentities require specific prefixes or entity keys when imported. For example, the price for a product would be imported using a field name like catalog_product_attribute.price. The prefix (catalog_product_attribute.) indicates that this field is a subentity of the root entity "Product."

Magento 2 Import - Prefix

The importance of these entity keys lies in their role as connectors between the import file and the Magento database. Each key or prefix matches a subentity field to the corresponding table in the database, ensuring that the data lands in the correct location. Without these specific identifiers, Magento cannot accurately map the data, which could lead to errors, such as incorrect product information or failed imports.

You can customize these prefixes, but they must be present as this is how the module connects to the relevant database tables and ensures that all imported information is correctly organized and functional in the store environment.

3. Consider Modifying Column Names via an Import File Field 

When importing data from different sources that may use varied naming conventions, you may want to modify column names to match the import file fields with the existing data structure in Magento. Such simplified data mapping reduces the risk of errors during the import process caused by mismatched field names.

You can modify Magento column names using the "Import File Field" setting:

Magento 2 Import - Field

For example, if you want to change the "description" field to "specification," you just need to enter the custom name in the "Import File Field" for the respective attribute. This would result in the column's full name being catalog_product_attribute.specification.

4. Consider Adding Default Value 

The "Default Value" field in the import profile is helpful because it streamlines the import process by automatically applying the same value to all records for a specific attribute. This is particularly useful when a large number of products, customers, or orders share a common attribute. 

Magento 2 Import - Default Value

By setting a default value, you can simplify the import file and reduce errors, as there's no need to repeatedly enter the same data. It also ensures consistency across records and saves time when managing bulk imports.  

For instance, if all products in the file are from the same brand, you can leave this field out of the file and instead set a "Default Value" for it. Note: If the import file already contains a value for this field, make sure to leave the "Default Value" field empty.

Best Practices for Magento CSV Import

Since you’re now aware of which settings to pay attention to in the import profile setup, let's consolidate your import success with some best practices for managing CSV data imports.

1. Maintain the Correct Order of Fields in Magento Import CSV Files

Make sure to keep the fields in your Excel or Sheets CSV file in the same order as they are arranged in the import profile as the extension does not support mixing fields from different entities. For example, fields such as catalog_product_attribute.price must be grouped together, and all root entity fields should always be placed first. Only then will your import process run without errors.

2. Enable Autofill for Common Use Cases

To simplify the setup of new import profiles, make use of the "Enable Autofill for Typical Use Cases" feature. This option automatically selects the essential fields required for a specific type of import. 

Magento 2 CSV Import - Autofill

For instance, when importing orders, the tool will preselect all the necessary fields for importing an order, saving time and reducing the chances of mistakes. This feature is extremely useful for beginners or when working with repetitive data imports.

3. Utilize XML for More Flexible Imports

If the CSV format's strict requirements do not suit your needs, the XML format can be a great alternative. XML files provide flexibility in terms of structure, allowing you to map fields in nearly any configuration by using XSL templates. This adaptability makes XML fitting for complex data imports that may not conform to standard CSV constraints.

When performing Magento 2 import products from XML feed, make sure your XML file does align with the module's default requirements. If it doesn’t, you can create an XSL template to map its values correctly. 

Mind that each non-root entity, such as catalog_product_attribute, must have a corresponding node in the template. You can refer to the import profile to find the correct node names, ensuring your data is mapped accurately and imported without errors. See more on XML import in our guide.

Below are some common scenarios for importing different entities using Amasty's extension. Each includes a link to a sample Google Sheets file that has all the required fields and the ideal data format for seamless import.

Import Orders

  • Start by reviewing a template containing the minimum fields needed to import an order.
  • Import tracking numbers for existing orders.
  • Automatically create invoices, shipments, or credit memos directly from the import profile.
Magento 2 CSV Import - Actions after Importing

Import Customers

  • Check our basic template that includes essential fields such as customer name and email.
  • Additional fields like addresses, payment information, and other customer details can be imported via this more comprehensive template.

Import Products

10+ Scenarios for Magento 2 Import Products with Sample CSV File Download 

Product import is one of the most common and crucial tasks, as it allows for efficient bulk updates and the addition of new products. Below, you’ll find pro tips for the most popular scenarios along with Magento 2 import products CSV samples.

  • Assign Categories to Products – As shown in the CSV sample file, make sure to include the full category path, 
  • Stock Quantity Import – Based on your number of stock sources, choose between single-source or multi-source templates.
  • Importing Images – Images must first be downloaded to the Magento folder. Alternatively, the module allows importing images using URLs by specifying the "Images File Directory" field in the import profile.
    • Images with Roles Include images with specific roles such as thumbnails, small images, or base images.
    • Media Gallery Requires value_ids for images, the extension replaces these with the correct IDs during import.
Magento 2 CSV Import - Images
  • Category Import – Available as a one-time import under Amasty → Import → Product Category. Check out the relevant CSV test file
  • EAV Attribute Import – Import new attributes using the EAV Attribute import feature in the Amasty Import menu by using the template.
  • EAV Attribute Option - See Magento import products CSV template. Also can be done only via one-time import Amasty → Import → Import → EAV Attribute. Please, note that you may create a new attribute value in the import profile, by using a Create New Attribute Value modifier:
Magento 2 CSV Import - Create a new Attribute

More Magento 2 import products CSV sample files for additional scenarios:

Make sure to check out our Import/Export demo to see some of the scenarios in action.

Conclusion

Amasty's Import/Export extension for Magento 2 is a powerful solution designed to handle complex data import and export tasks with ease. When you leverage the tips and templates provided above, you can streamline the import/export process, avoid common mistakes, and truly enjoy the capabilities of our extension. 

If you still have issues or questions, feel free to reach out to support or drop a line in the comments section!

Frequently asked questions

To import products in Magento 2, prepare a CSV file with product details like SKU, name, price, and description. Go to System > Data Transfer > Import, select "Products" as the entity type, upload your CSV, and click "Check Data". If no errors, click "Import" to complete the process. Use Amasty Import Products for improved results.

To import configurable products in Magento 2, first import the simple products (child SKUs). Then, create a CSV for the parent product, linking it to the child SKUs under the "Configurable Variations" column. Go to System > Import, select "Products", and upload the CSV for import.

To import a CSV file in Magento 2, go to System > Data Transfer > Import. Select the entity type (e.g., Products), click Choose File, and upload your CSV. Click Check Data to validate. If no errors, click Import to complete the process.

To import product images in Magento 2 using a CSV, first create a CSV file with columns for "sku", "image", "small_image", and "thumbnail". Upload images to the pub/media/import folder, then in the CSV, reference the image path. Go to System > Import, choose "Products", and import the CSV.

October 16, 2024
October 3, 2024
October 10, 2024
Comments
Leave your comment

Your email address will not be published

This blog was created with Amasty Blog Pro

This blog was created with Amasty Blog Pro