Using the Sitefinity API, I would like to show you how you can import products into Sitefinity Ecommerce.
How it Works
The product importer is actually a widget that is placed onto a page. Once the page has been created, bring up the page in a browser and follow the instructions to upload your file of products to import. Once you have uploaded your file, the product importer widget reads the values from your file and inserts them into the database. The latest version of Product Import(Product upload widget) is available on github https://github.com/esitefinity/Sitefinity-Ecommerce-Product-Upload and the code behind utility classes that are used by the widget and that you need are available also on github here https://github.com/esitefinity/ProductUploadPackage. We highly recommend using the latest version available from github. There is a NuGet package as well but it is possible that it is outdated.
In the example I am using a .csv file as my data input. The format of this file has been created such that you can add many custom product type fields at the end of the file. Here we are only going to create two custom product type fields, CustomProperty1,CustomProperty2.
Once you have NuGet installed, please follow the following installation steps.
- If you want to try using the NuGet Package: Right click on your solution and select “Manage NuGet Packages…”.
- In the Manage NuGet Packages window, select “Online” on the left side column then search for “Sitefinity”. NuGet will find the Sitefinity package allowing you to install it directly into your Visual Studio Solution.
- Create a folder called “upload” at the top level of your solution. This is where the .csv file will be uploaded in to.
- Copy over the file upload widget control into the root of your solution. You can download latest version of the Widget from GitHub.
- Open Sitefinity Thunder and add the widget to Sitefinity
- Build your solution
- Start your solution without debugging
- When your Sitefinity web site comes up, login to the backend of Sitefinity
- In the top navigation, click on “Ecommerce” and select “Type of Products”.
- Create all of your product types that you will be importing all of your products into.
- Create a new page in Sitefinity and call it productimport
- Drag and Drop the new widget you inserted using Sitefinity Thunder onto the page. Save the page.
- Bring up this page in your browser and upload your .csv file. This will upload your .csv file into a folder called “upload”, located in the root of your solution.
- In the top navigation, go to “Ecommerce” and select “Products” and you should now see all of your products imported.
I have created a video showing you how to install the Product Upload package using NuGet, add a widget using Sitefinity Thunder and upload your .csv file.
Sitefinity Ecommerce Product Import
Credits and thank you to Venkata Koppaka for programming this!