This tutorial explains how to import products magento using script.Here products are importing from opencart to magento using the script.I have exported the following CSV files from the opencart backend.
This script import all the categories, attribute and the products to magento. Its also create the simple and configurable products and assign that to the new categories. Here I am also importing the related products as well.
The excelsheet exported from the opencart contains main four CSV:
- Products.csv – Download Sample CSV
- Options.csv – Download Sample CSV
- Catgeories.csv – Download Sample CSV
- Discount.csv (for tier prices) – Download Sample CSV
Step by step explanation
- Import attribute options
- Import categories magento
- Read CSV data
- Import simple products
- Import Configurable products
- Import product Images
- Add related products
- Import tier prices
Import attribute options
As the first step I have created the attribute (Color based on my example) in the magento backend .Then I imported the options programmatically . Please click here to refer the tutorial which explains how to import the options from the CSV.
Import categories magento
As the next step I have created the categories. Please click here to refer the tutorial which explains how to read the data from the CSV and import the categories.
Read product data
The function getProducts() read that data from the products.csv and saved that in an array as shown here.
Import magento products
This is the main function that import the products.In this function based on the options it decides whether to create simple or configurable products.Click here for detailed explanation or please check the related links below.
Import product images
As the next step I am explaining how to set product images to the magento products.
Please click here for importing the product images.
Import tier prices
Please click here for tutorial