Samiksha Hiwase | 10 min read | June 25, 2020

Prestashop: Creation of Combination of Products using CSV file

1. Pre-Import Task: Creation of combination using CSV file

Definitely in your PrestaShop, the products vary in different combinations. Adding these combinations of products in your catalog creates an easy and smooth way for all customers to find out their favorite items with all the possible variations in one product.
It will lead to good customer experience and the best way for providing the variations in products.

2. What is a CSV file?

Before knowing how to create a csv file you must know about its full form i.e. comma-separated values is a text file that uses a comma to separate the values.
A CSV file mostly stores tabular data (i.e numbers and text ) in a plain text where each line consists of the same number of fields.
Each line of the file is called a data record. Each data includes one or more than one, fields that are separated by commas. CSV is a common data exchange format that is mostly supported by consumers, businesses, etc.
The CSV file format:- There is a format for the creation of csv file as follows –
  • Plain text where you can use a character set such as ASCII, various Unicode character sets.
  • It consists of records and mainly one record per line.
  • These records are divided into fields separated by delimiters. Delimiters mean a single reserved character such as comma, semicolon.
  • And where every record has the same sequence of fields.

3. Do you want to know how PrestaShop attributes combinations assigned to products?

Combinations of products are being uploaded together and below in this article, we are going to provide you with detailed instructions so that you can successfully create product variants.
Firstly, you have to manage the combination.csv file in order to create a combination of products. You have to mention all the details in the file, where if you are uploading products with options or variations these all attributes will come in your file.

What is the format of the csv file to import?

There is a format for creating each column in the csv file. The format for Feature column is divided into 4 “parts” each separated by a colon: featurename:value:position: customized value
If you have multiple numbers of features then you can add many features in one column which are separated by commas e.g.
featurename1:value1:position1:customizedvalue2,featurename2:value2:position2:customizedvalue2, etc.
If you don’t want to give the value to any feature then don’t write anything in that value of feature simply keep it blank (empty) for example Color::1:1
Just like this, keep blank space between colons.
Here is a Description of format:-
  • Feature: The name of your feature of product combination. If you want to give the value to it then value it must be exactly as it appears under Catalog > Features. E.g. Size
  • value: In this, you have to add the value of the feature. If this is selected then it should be one of the existing values in Catalog > Features otherwise PrestaShop will add those values to the list of values.
  • position: It displays the position of the feature relative to other features, it is starting from 1.
  • customized value: You can not select the customized value from the list of predefined values of Catalog > Feature. But it provides 1 (for yes) or 0 (for no).Use 0 if you have defined a list of selectable values in the backend.

Sample of csv file

Following is an example of the creation of csv file with different attributes:-
You can see how combination data should be arranged in the spreadsheet. We need to create combinations, associate them with existing products.
This is a sample file of a combination of products where we use attributes like size, color which are the details of that particular product.
Your file may differ in terms that are included. If you create new products with combinations, for example, you will have product-related details as well.
Let’s elaborate the details of the sample file:-
  • Reference:- In the column of the reference you have to mention the reference number of your main product.
  • Product Name:- The name of your combination product.
  • Attribute (Name:Type:Position):- In this column, you can fill the name of your attribute and use the colon to give type and position of that attribute.If the product combination has multiple attributes then use a semicolon (;) for separation as shown in the above example. Size:select:1;Color:select:2
  • Value (Value:Position):- Here you have to put down the values of each attribute and it fills in the above column. Separate multiple values by using a semicolon (;) And after giving value also give value’s position in this column.For example – 28:01;Yellow:12;Women:2;
  • Combination Reference:- In the first column you provide the reference of the main product here, you should introduce combination reference in the file.
  • Cost Price:- If you want to set price for variations of products, you can mention in this column of your .csv file
  • Quantity:- Mention the quantity of each combination of products in your file.
In this way, you can create your combination.csv file to directly import the many products as you want on your site.

4. Step by step guide to import files in Prestashop

When you have a large number of products including their combinations then it is more time taking process. Adding these products manually in PrestaShop we have to insert product details and also each detail of combinations and attribute values.
By creating the.csv file and importing this file we can add a very large amount of products.
  • Step 1:- To start the import process in Prestashop first go to the main menu which is on the left side. Scroll the screen and you will see the Advanced Parameters, select it.
  • Step 2:- After clicking on this you will see the various options from that select Import option. The new screen will open as shown in the image below.
In this import process you have to make some general settings as follows:-

What do you want to import?

In this setting, the first question arrives: what do you want to import where you can select from the drop-down list. The available fields on this data contain the fields which PrestaShop enables you to import.
  • Categories
  • Products
  • Combinations
  • Customers
  • Addresses
  • Brands
  • Suppliers
  • Aliases
  • Supply orders (if Advanced Stock Management is enabled)
  • Supply order details (if Advanced Stock Management is enabled)
  • Store contacts

Select a file to import.

Here you can select an import file from your computer by clicking on the browsing button or choose files already available on your FTP/ in your history.

Language of the file

You have to select the language of your data, the data which is present in your file.

Field separator

In this field mention the symbol which you use in your file as a separator. Not each CSV file uses a comma to separate their values, some use tabulations, other semicolons, etc.

Multiple value separator

If one attribute has more than one value then these are separated by using a specific separator. Review your file and introduce your separator here.

Delete all ___ before import.

By selecting this option you will erase all previously existing entries of the type of data you are importing.

Use product reference as a key

This field is used when you choose product import only. You can choose to have the product key or use reference as an ID but make sure your file may include the references of all imported products.

Skip thumbnails regeneration

When you choose to import a category and product only use this field. You can choose to have PrestaShop regenerate the thumbnails that are linked from your CSV file.

Force all ID numbers.

You can choose to keep the imported IDs or let the importer auto-increment them.

Send notification email

When you import large files by choosing this option you will receive mail after your file gets imported.

Step 3:- Uploading the file

When your file is ready to import and have all data present in your csv file format. Then you can upload the file on this page
You have two ways to import the file:-
Using your browser: Click on the “Upload” button, and then select your file which you want to upload.
Using your FTP client: Reload the import page as the “Choose from history / FTP” button should now indicate a number. Click the button to display the list of available files then click the “Use” button for the file you want to import.

Step 4:-

Once your file gets uploaded then you can proceed forward. By clicking on the “Next step” button, the page reloads where you can match your file’s data columns with the ones required by PrestaShop.
When you are done matching your columns click on the Import button which is at the right-hand side of the screen.PrestaShop will start the importing process. A pop-up window will open to show you the progress of the import.
When this process is done then it is denoted as “100% validated” and “100% imported”. After closing this pop-up window you directly go to the main screen.
After going to the Products section from your main screen you can check all the combinations of products that are imported correctly or not.
In another case after closing the pop-up window if an error comes during the import, you will see a notice of all the encountered problems. In this, you should review your file and make sure to correct everything.
In this way, you can import as many product combinations as you want in PrestaShop.

For Further Details or Additional Information

OR

If you want to know more about our Services