Skip to content
All posts

How to import products with combinations into PrestaShop: two files from one supplier spreadsheet

A supplier sends one row for every colour and size, with the variant typed into a single cell. PrestaShop wants the product once, then each colour and size as a combination in a second file that points back at it. Here is the order of the two imports, the columns that matter in each, where supplier files break them, and one rug shown before and after.

BeforeOchre / 120x170OCHRE-120X170Colour: Ochre, Size: 120 x 170 cm
AfterOchre:0, 120 × 170 cm:1
Value (Value:Position)*

Have a supplier file like this? Send it exactly as it arrived and see the same products before and after.

How PrestaShop imports products with combinations

A supplier’s spreadsheet for a wool rug arrives as six rows, one for each colour and size, with the variant typed into one cell three ways: Ochre / 120x170, OCHRE 200X290, Slate / 120 x 170cm. PrestaShop does not want six rugs. It wants one product with six combinations, taken in two imports.

To import products with combinations into PrestaShop, import the products first and the combinations second, both from Advanced Parameters > Import.12 The products file has a row per product, and the combinations file a row per combination, with the product’s ID, its attributes as Name:Type:Position and its values as Value:Position, as in the sample file every installation includes.31

The order follows from what each file points at. A product points at its categories by ID, and “Categories are to be specified using their existing IDs (so you should have imported them first)”.1 A combination points at its product the same way, in the sample’s first column, Product ID.3 Attributes come before the combinations: in the back office, “You cannot create combinations if you do not already have product attributes properly set in PrestaShop.”4 So set up the attributes and their values under Catalog > Attributes & Features and have the categories in place, then import the products, then the combinations.5

The import screen, and the files to start from

The first screen asks “What do you want to import?”, and Combinations is one of the choices; the Available fields panel then lists what its file should contain.1 The page also offers a sample file for each type, stored “in the /docs/csv_import folder of your installation of PrestaShop”.1 Build on them: the documentation asks for files that follow “the naming scheme and order of the presented fields”.1

The other settings:

  • File type. CSV, or since version 1.7 “.xls, .xlsx, .xlst, .ods, and .ots”, though with Excel “you cannot set the field or multiple value delimiters”.1
  • Language of the file. One language per file: “Data can only be imported for a single language at a time”.1
  • Separators and encoding. A semicolon between fields and a comma between multiple values, which PrestaShop suggests keeping, in a file saved as UTF-8 (or failing that ISO-8859-1).1
  • Force all ID numbers. “You can either keep the imported IDs, or let the importer auto-increment them.”1 So the combinations file takes its product IDs either from your products file or from PrestaShop.

The second screen matches your columns to PrestaShop’s, six at a time; enter 1 in Rows to skip to leave out the header row, and save the mapping for the supplier’s next file.1 It “makes sure that you don’t miss any required fields”, PrestaShop’s developer documentation says.6 A clean run ends at “100% validated” and “100% imported”; otherwise you get “a notice of all the encountered problems”.1

The two files, column by column

The products file

PrestaShop’s sample products file has 68 columns.7 These are the ones a supplier file trips on:

  • Categories (x,y,z...): category IDs, “separated with a comma (by default)”.1
  • Price tax excluded: a bare number, which “will use your store’s default currency”.1
  • Tax rules ID: a number from your shop, not a rate, because “You cannot directly apply a tax to a product; you can only apply tax rules.”8
  • Reference #: your own code for the product as a whole; each combination can carry its own.43
  • Manufacturer: the brand. Brands “used to be called manufacturers in previous versions of PrestaShop”, and the sample keeps the old name.97
  • Weight: a number in the shop’s default weight unit, set on the Localization page.4
  • Feature(Name:Value:Position): every specification, in one cell.

The sample’s header names three parts of the Feature column. The documentation names four, featurename:value:position:customizedvalue, with positions “starting at 1”, commas between features and no colon or comma inside a part: “you cannot use a colon (:) or commas (,)”.71 The last part is 1 for a customised value, one “not selectable from a list of predefined values”, and 0 for one from that list.1 With 0, a name or value that does not exist yet is not refused: “the feature and/or value will be added for you.”1

The combinations file

The sample combinations file has 24 columns and marks three with an asterisk: Product ID, Attribute (Name:Type:Position) and Value (Value:Position).3 The import documentation does not describe the last two, so the sample’s rows are the guide: Color:color:0, Disk space:select:1 in the attribute column and Blue:0, 16GB:1 in the value column, one value per attribute in the same order, with commas between pairs.3 The type is the attribute’s type, which the attributes page describes as a choice between “a drop-down list, a radio button list, or a color (or texture) picker”; the sample uses color and select, and counts positions from 0.53

ColumnWhat goes in itWatch for
Product ID*The product’s ID in your shopImport the products first
Attribute (Name:Type:Position)*Each attribute’s name, type and positionNames spelt as your shop spells them
Value (Value:Position)*One value per attribute, in the same orderOne value per attribute in a combination
Supplier reference, ReferenceThe supplier’s code and your own, for this combinationThe product’s code repeated on every row
EAN13This combination’s barcodeLeading zeros Excel has removed
Impact on priceThe difference from the product’s priceNot the combination’s full price
Impact on weightThe difference from the product’s weightNot the combination’s full weight
QuantityThis combination’s stockA number, not In stock
Default (0 = No, 1 = Yes)1 on the combination shoppers see firstOne per product in the sample
The combinations file’s main columns, from PrestaShop’s sample file at version 9.2.0, with the rules its documentation gives for combinations and import files.341

A price list gives each size its own price, so Impact on price needs arithmetic. PrestaShop wants the difference: “fill in the field that appears with the value of that impact (e.g. ‘-2’ if the price should be decreased by 2)”.4 In its sample files, the iPod touch is priced 240, and its 8GB, 16GB and 32GB combinations carry 0, 75 and 150, with the 8GB as the default.73 Impact on weight works the same way, from the product’s weight.4

Where supplier files break it

Supplier files are laid out for ordering, one row per item picked. Six things in them break PrestaShop’s two files.

Every colour and size as a product of its own. FENWALD WOOL RUG OCHRE 120X170CM and FENWALD WOOL RUG SLATE 200X290CM are one rug, but imported as they stand they are six products. For versions that differ by colour, capacity or size, PrestaShop says “you should create a product combination for the current product rather than duplicate it X times.”4 Variants: size and colour covers where one product ends and the next begins.

Colour and size in one cell, spelt several ways. Ochre / 120x170 and OCHRE 200X290 have to become value cells such as Ochre:0, 120 × 170 cm:1, with each size spelt one way on every row and one value per attribute: “it is impossible to have both ‘Color: Blue’ and ‘Color: Red’ in your pairs”.4 Spelling matters past the import, too. A Type column on one bathroom retailer’s 329 baths held 12 spellings of 8 real types, and each extra spelling became one more box for shoppers to tick. Normalising attribute values shows how to fold them.

A full price and weight for every size. The price list says £75.00, £125.00 and £190.00 + VAT, with weights of 4200g, 7000g and 10.3kg. The product takes one price, without tax, and the larger sizes take the differences, 50.00 and 115.00. The weights, once in the shop’s unit, become 4.2 on the product and 2.8 and 6.1 on the others.714

Separators inside the text. A description reading Hand-tufted; reversible; low shedding holds two field separators. PrestaShop says to remove them or choose another separator, and “There must be the same number of columns on each row.”1 In a Feature cell, the comma in Material: 100% wool, pile 12mm starts a second feature, because colons and commas “will always be interpreted as so”.1 Keep both out of attribute values too, where the sample uses them as separators.3

Barcodes Excel has rewritten. Each combination can carry its own EAN13, “the product’s 13-digit international article number”.43 Excel “automatically removes leading zeros, and converts large numbers to scientific notation”, so 5012345670010 comes to read 5.01235E+12 and a barcode loses any zero it starts with.11 GTIN, EAN, UPC and MPN explained covers getting the digits back.

Names where PrestaShop wants numbers and links. Home > Rugs > Wool Rugs has to become the IDs your categories already have, such as 3,27, and the file name fen-och-120.jpg an absolute link a browser can open.1 Mapping supplier categories covers fitting the supplier’s tree to yours.

One supplier product, before and after

Here is the first row, the ochre rug in 120 × 170 cm, against the products file. Its colour and size leave the name for the combinations.

Products file columnSupplier sentAfter
Product IDnot supplied1042
Name *FENWALD WOOL RUG OCHRE 120X170CMFenwald Wool Rug
Categories (x,y,z...)Home > Rugs > Wool Rugs3,27
Price tax excluded£75.00 + VAT75.00
Tax rules IDnot suppliedthe ID of your VAT rule
Reference #FEN-OCH-120FEN-RUG
Manufacturernone; the brand is in the nameFenwald
Weight4200g4.2
Feature(Name:Value:Position)Material: 100% wool, pile 12mmMaterial:Wool:1:0,Pile height:12 mm:2:0
Image URLs (x,y,z...)fen-och-120.jpghttps links to the full-size images, a comma between
The supplier’s first rug row as it arrived and as PrestaShop’s products file takes it. The IDs stand in for your own, and the weight assumes a shop set to kilograms.17

All six rows then become combinations of product 1042, each with the attribute cell Colour:color:0, Size:select:1, which the table leaves out with the product ID. Colour stands for your shop’s own name for the attribute.

Supplier sentValue (Value:Position)*ReferenceEAN13Impact on priceImpact on weightDefault (0 = No, 1 = Yes)
Ochre / 120x170Ochre:0, 120 × 170 cm:1FEN-OCH-1205012345670010001
Ochre / 160x230Ochre:0, 160 × 230 cm:1FEN-OCH-160501234567002750.002.80
OCHRE 200X290Ochre:0, 200 × 290 cm:1FEN-OCH-2005012345670034115.006.10
Slate / 120 x 170cmSlate:0, 120 × 170 cm:1FEN-SLA-1205012345670041000
Slate/160x230Slate:0, 160 × 230 cm:1FEN-SLA-160501234567005850.002.80
Slate 200x290cmSlate:0, 200 × 290 cm:1FEN-SLA-2005012345670065115.006.10
The six supplier rows as combinations of product 1042. Prices and weights are differences from the product’s 75.00 and 4.2, and the ochre 120 × 170 cm is the default.34

The 1042 is whichever ID the rug ends up with: the one in your products file if you import with Force all ID numbers, or the one PrestaShop gives it if you do not.1

How to build the two files, step by step

  1. Set up the attributes and their values, spelt as the files spell them, and check that every category exists and has an ID.51
  2. Open the supplier file with barcodes as text. Use the Data tab’s From Text/CSV and set those columns to Text as they load; formatting them as Text afterwards “will not change numbers that have already been entered”.11
  3. Group the rows into products. Rows that differ only by colour or size are one product, and their differences become its combinations.4
  4. Build both files on the samples’ headers: one row per product, then one per combination, with prices and weights as differences and one default.734
  5. Clear the separators and save as UTF-8. No semicolons in text, no colons or commas inside feature or attribute values, and the same number of columns on every row.1
  6. Import the products, then the combinations. Leave Delete all unticked, and tick Force all ID numbers only if the combinations file uses the IDs in your products file.1
  7. Try a few products first, and read the notice of problems if a run stops short of “100% imported”.1

When it is not obvious

Attribute or feature? If shoppers choose it, it is an attribute; if it is the same on every colour and size, it is a feature. In PrestaShop’s words, attributes “make it possible to select among product combinations”, while features “remain the same throughout the product’s variations”.510 It is the first judgment in product data enrichment, and the file follows from it.

Two colours in one rug. An ochre and slate rug cannot take two Colour values in one combination. PrestaShop’s answer is two attributes, “for instance, ‘Primary color’ and ‘Secondary color’”.4

Where the sample and the documentation disagree. In two places that matter, both in the products file. The sample’s Feature header names three parts, where the documentation names four, as in its example Date of Origin::1:1, so write four. And the sample writes category names, such as Accessories, where the documentation asks for existing IDs and does not say what the importer does with a name, so write IDs.71

Before you click Import

All of this happens in a spreadsheet, before PrestaShop reads a row, and it is the work behind the files we prepare from supplier spreadsheets for PrestaShop. Each SKU or barcode is matched to the real product, gaps are filled with a link to each value’s source, spellings are folded onto one value, measures are converted to one unit and every item is filed into your own category tree. The files come back laid out for PrestaShop’s own importer, the products first and then their sizes and colours as combinations, for you to check before anything is imported. That is RefynData’s product data enrichment service.

However the files are made, import a handful of products and their combinations before the whole range. Then keep the column map and the list of spellings: the next delivery will bring the same OCHRE 200X290.

Questions

How do I import products with combinations in PrestaShop?

Run two imports from Advanced Parameters > Import: the products first, with categories as their existing IDs, then the combinations, one row each with the product’s ID, its attributes and its values. Set up the attributes under Catalog > Attributes & Features first.

What format does the PrestaShop combinations CSV use?

PrestaShop’s sample file starts with Product ID, Attribute (Name:Type:Position) and Value (Value:Position), all three marked with an asterisk. Several attributes share one cell with commas between, as in Color:color:0, Disk space:select:1, and the values follow in the same order, as in Blue:0, 16GB:1.

Can I import products into PrestaShop from an Excel file?

Yes. Since version 1.7 the importer also takes .xls, .xlsx, .xlst, .ods and .ots files. With an Excel file you cannot set the field or multiple value separators, so keep colons and commas out of feature names and values.

Do categories have to exist before I import products into PrestaShop?

Yes. PrestaShop’s documentation asks for categories as their existing IDs, separated by commas, and says you should have imported them first. Its own sample file writes names, but the documentation does not say what the importer does with a name, so write IDs.

What does Impact on price mean for a PrestaShop combination?

It is the difference between the combination’s price and the product’s price. PrestaShop’s example is -2 for a combination that costs 2 less. A rug priced at 75.00 whose larger size sells at 125.00 takes 50.00 on that size.

Why did my PrestaShop import create new feature values?

PrestaShop adds them rather than refusing them. With a feature’s last part set to 0, a name or value that does not exist yet is added to your list, so Wool and 100% wool become two values. Fold the spellings onto one before importing.

Sources

  1. PrestaShop documentation. Import.
  2. PrestaShop documentation. Managing Categories.
  3. PrestaShop on GitHub. Sample combinations import file (combinations_import.csv).
  4. PrestaShop documentation. Managing Products.
  5. PrestaShop documentation. Managing Product Attributes.
  6. PrestaShop Developer Documentation. The Import component.
  7. PrestaShop on GitHub. Sample products import file (products_import.csv).
  8. PrestaShop documentation. Tax Rules.
  9. PrestaShop documentation. Managing Brands.
  10. PrestaShop documentation. Managing Product Features.
  11. Microsoft Support. Keeping leading zeros and large numbers.

Try it on a fileyour supplier sent

Nothing goes live without your sign-offEvery value keeps its sourceYour data is never shared

Send one supplier spreadsheet exactly as it arrived. We will show you the same products before and after, with a source on every value we add.

One email with the upload link. Nothing else lands in your inbox.