Magento Catalogue Import Script
A generic Magento to Crystallize import script aiming to assist with importing the Magento catalogue in a cleaner and faster structure.
As the Magento product catalogue expands, it also becomes more complex, making even simple actions like associating a product to multiple categories difficult to maintain. Same goes with an integration to another system, or migrating from it.
Set up the Configuration
The import script requires a number of environment variables to set up before running, like your Magento integration and Crystallize keys. These can be passed as arguments when running the script or be setup in the lib/config.js file.
Two import modes
Since importing a catalogue might be a very time consuming process, we have set up a single SKU import script command. This gives you the ability to test things like, creating a product shape that fits your information architecture, and start building bottom to top.
Import a single product by running:
SKU=*your_sku* yarn run single
Import the entire catalogue by running:
yarn run import
Shape it to your needs
From SKUs to content, every case can vary in structure and logic and you can tweak the script to fit these needs.
The core logic of the script is focused around:
Clean information Architecture
The import script follows Crystallize’s modern topic-based approach. Multiple categories can be associated to products by creating them as topics. Starting from top to bottom, the script will create a tree topic-structure and tag products with topics based on naming.
These can be specified as arguments in index.js file. The script behaviour can be altered in these files:
- lib/crystallize/index.js (createTopics)
* Notice that by default the topics generated by the categories passed as arguments will not be included in the catalogue structure.