Bigbridge Product Import for Magento 2

Marco de Vries

April 4, 2024

4 min lezen

Magento 2 is an enterprise e-commerce platform that handles hundreds of thousands of products. However, its import tools are not up to the task. To deal with this situation I created an import tool for the community.

Hier vind je de Nederlandse vertaling van dit artikel.

The code

The code and documentation can be found here:

https://github.com/bigbridge-nl/product-import

It contains

- a product import library for custom imports
- product importers using XML (REST and file based)
- a tool to repair the url_rewrite table

New Features

Implementing all features that may be expected of a product import library, was a looooot of work. But next to that I came up with these new ones I think are also needed.

Placeholders. Products are linked to other products in several ways. Configurable, grouped and bundled products are linked to other products. Each product may have related, up-sell, and cross-sell products. Links between products are stored by id. Of course a product can only be stored when the products it links to already exist. Products may even link back to eachother. This problem is often overlooked.

I handled this situation by creating placeholder products for products that are linked to, but don’t exist yet. A dummy placeholder product is created for it, mainly for its id. When the actual product is imported, the placeholder is replaced by the real thing.

Url key generation. Url keys must be unique per store view. They are usually generated based on the name of the product, and often different products have the same name. Since this proves to be a problem I allow you to generate the url key based on the name or the sku. When this url key conflicts with another, you can choose what to do about it: add the sku, or a generated follow-up number.

REST. Magento’s REST implementation is based on single entities. It will not allow you to import multiple products, because its framework cannot handle it. I wanted to use Magento’s webapi authentication system and import multiple products via XML. With a little hack I succeeded in doing so and this allows you to use the library via a REST call (XML only).

Enjoy!

You can use this library to create your custom product import. It aims to be the fastest Magento 2 product import library around, it validates input and gives good feedback on errors, it has an extensive API and I documented every part of it.

Note: the library is quite new and used only in a few projects. Many features have not been used in production environments yet. Start using it in safe environment with a good backup of the database. You will inevitably come across some bugs, since there’s a lot of new code. Report them in the issues section of the GitHub repository and I will look into them.

I hope you enjoy this library. I welcome all constructive feedback. Let me know what parts you have used and what can be improved.

Hebben wij jouw interesse gewekt?

Laten we er eens over kletsen, onder het genot van een goede kop koffie!

neem contact op