How to Import Configurable Product with Multiple Configurable Options to Magento 2
Some Magento 2 users
Table of contents
- 1 Configurable Product Import Failure
- 2 How to Import Configurable Product with Multiple Configurable Options to Magento 2 (Guide for Technical Specialists)
- 3 How to Import Configurable Product with Multiple Configurable Options to Magento 2 (Guide for Everyone)
- 4 More Features to Improve Import Processes
- 5 Final Words
Configurable Product Import Failure
The
- Native Magento 2 import tools;
- No errors in the file formating;
- UTF-8-BOM encoding;
- Developer mode;
- No errors/exceptions during import;
- The corresponding simple products are enabled and in stock.
The author adds a product manually in the admin interface, exports it via a .csv file, modifies its attributes, and then reimports. The new configurable product successfully appears in searches after reindexing. However, none of the configurable options are available in the frontend dropdown.
According to
How to Import Configurable Product with Multiple Configurable Options to Magento 2 (Guide for Technical Specialists)
Franck Garnier recommends to implement the following improvements:
di.xml
1 |
<preference for="Magento\ConfigurableImportExport\Model\Export\RowCustomizer" type="Vendor\ImportExport\Model\Export\RowCustomizer" /> |
app/code/Vendor/ImportExport/Model/Export/RowCustomizer.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
<?php namespace Vendor\ImportExport\Model\Export; use \Magento\CatalogImportExport\Model\Import\Product as ImportProduct; use \Magento\ImportExport\Model\Import; class RowCustomizer extends \Magento\ConfigurableImportExport\Model\Export\RowCustomizer { /** * Prepare configurable data for export * * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection * @param int[] $productIds * @return void */ public function prepareData($collection, $productIds) { $productCollection = clone $collection; $productCollection->addAttributeToFilter( 'entity_id', ['in' => $productIds] )->addAttributeToFilter( 'type_id', ['eq' => \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE] ); while ($product = $productCollection->fetchItem()) { $productAttributesOptions = $product->getTypeInstance()->getConfigurableOptions($product); $variations = []; $variationsLabels = []; foreach ($productAttributesOptions as $productAttributeOption) { $this->configurableData[$product->getId()] = []; foreach ($productAttributeOption as $optValues) { $variations[$optValues['sku']][] = $optValues['attribute_code'] . '=' . $optValues['option_title']; if (!empty($optValues['super_attribute_label'])) { $variationsLabels[$optValues['attribute_code']] = $optValues['attribute_code'] . '=' . $optValues['super_attribute_label']; } } } foreach ($variations as $sku => $values) { $variations[$sku] = 'sku=' . $sku . Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR . implode(Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, $values); } $variations = implode(ImportProduct::PSEUDO_MULTI_LINE_SEPARATOR, $variations); $variationsLabels = implode(Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, $variationsLabels); $this->configurableData[$product->getId()] = [ 'configurable_variations' => $variations, 'configurable_variation_labels' => $variationsLabels, ]; } } } |
It is excellent if you understand what it all is about. But if you don’t know what to do with the code above, you need a more intuitive solution to import configurable products with multiple selectable attributes to Magento 2.
How to Import Configurable Product with Multiple Configurable Options to Magento 2 (Guide for Everyone)
Let’s take a look at how to import configurable products with multiple configurable options to Magento 2 if you are a non-technical user. Note that you can apply the following approach to ANY products, avoiding any complicated interactions with the code. Meet the Improved Import & Export Magento 2 extension – your number one assistant when it comes to data transfers.
With this module, you can easily import configurable products with any number of selectable attributes to Magento 2. And it works equally well with all Magento 2 versions! Follow these simple steps to import configurable products:
- Go you your admin and create a new import profile under System->Improved Import & Export->Import Jobs;
- Choose a schedule of updates if you need to import configurable product more than one time;
- Select “Products” as an entity you want to import;
- Configure import behavior;
- Map third-party attributes if you transfer configurable products from other platforms.
That’s it! Now you can save and run the import of configurable products with multiple configurable options to Magento 2. Also, note that Improved Import & Export saves and applies created profiles to all further updates. As a result, you configure it only once (per entity per integration), and the module runs all new transfers automatically.
If any customization is necessary – contact our support. Our specialists will help you choose a solution that suits your business needs.
Also, don’t forget to check our Guide to Magento 2 Configurable Products, and how to import them.
More Features to Improve Import Processes
The Improved Import & Export Magento 2 extension is more than a tool that eliminates errors when you import configurable products to your e-commerce website. Our module can handle lots of entities, enhancing both import and export processes. You can connect to any external system and freely transfer all the necessary data. Let’s briefly describe the available features.
The first time-saver the Improved Import & Export Magento 2 extension offers is the ability to automate data transfers. Our module lets you create cron-based schedules or use triggers to launch import/export processes in the background automatically, while you concentrate on more critical aspects of your business. Just choose a frequency of updates to import configurable products to Magento 2 periodically.
Mapping is another feature that lets you transfer configurable products with one or multiple selectable attributes to Magento 2. If you import data from a third-party system, this feature dramatically improved your daily routine. With mapping presets, you only need to select a predefined scheme suitable for your integration to let our plugin replace all third-party attributes with ones used internally. Improved Import & Export modifies a custom data file from a third-party system, making it suitable for Magento 2.
Alternatively, you can leverage an interface where you can do everything manually. Just choose a third-party attribute and specify a replacement.
It is also possible to map and edit attribute values and third-party categories. Both features may help you import configurable products to Magento 2 with no headaches.
In addition to that, the Improved Import & Export Magento 2 extension enables you to create attributes on the fly. So if a file with configurable products lacks some attributes, it is no longer a problem. You can specify the parameters necessary to generate the missing data automatically.
The extended number of supported file formats and sources is another advantage of Improved Import & Export. The extension lets you streamline API connections and intermediary services to transfer configurable products and other entities from third parties. By the way, it enables you to move the following objects:
- 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.
We are going to add more entities withing further updates.
As for supported file formats, they include CSV, XML, Json, XLSX, ODS, and ZIP & TAR. It means that you no longer need to convert tables your suppliers provide to CSV. Furthermore, the extension lets you import any XML file to Magento 2 based on XSLT instructions.
As for Json, this feature enables Rest API transfers and opens further opportunities than the default import tool offers. Yes, you can freely import configurable products with several configurable options to Magento 2 vis Json. And the ability to import Excel and OpenOffice formats to Magento 2 lets you transfer them via XSL, XSLX, and ODS tables.
With the extension’s support for ZIP & TAR archives, you can import configurable products in supported file formats even when they are compressed.
Also, note that Improved Import & Export supports the following sources:
- REST and SOAP API;
- Google Sheets;
- Direct URL;
- FTP/SFTP;
- Dropbox;
- Direct File Upload.
You can quickly transfer configurable products to Magento 2 from them. We will add new sources within further updates.
You can also enhance the functionality of our module with the help of the following add-ons:
- MSI Add-on supports entities added to Magento 2.3 with the official Multi-Source Inventory extension. It lets you import and export such data as warehouses and product quantity per warehouse. Of course, you will also transfer configurable products.
- B2B Add-on supports entities added to Magento Commerce (Cloud) with official B2B extension and lets you import and export quotes, negotiable quotes, companies, shared catalogs, and requisition lists.
- WooCommerce Migration Add-on lets you seamlessly migrate from WordPress to Magento 2. No programming skills are necessary to import WooCommerce products, customers, addresses, and orders.
- MS Dynamics Integration Add-on provides the ability to connect Magento 2 to MS Dynamics Business Central ERP/CRM and synchronize data between them.
- NetSuite Integration Add-on lets you integrate your e-commerce store with another robust ERP platform.
- Banggood Dropshipping Add-on introduces the easiest ways to start a dropshipping business with Magento 2. Connect your e-commerce store to the Banggood catalog and transfer products (including configurable ones), orders, shipping details, etc. There is no need to have a warehouse to be an e-commerce merchant!
All add-ons are available here: Magento 2 Extensions by Firebear.
Final Words
Improved Import & Export dramatically improved the default Magento 2 functionality. It not only fixes the bag described above and allows importing configurable products with several configurable options (selectable attributes), but also transfers data between your Magento 2 website and any external systems. For further information, follow the link below and contact our support:
Get Improved Import & Export Magento 2 Extension