How To: Import Product Features Using Csv (Including Grouped Features)

I've just spent hours trying to figure out how to import multiple features via CSV, with a lot of Googling and not a lot of results. I figured for others' sanity, I'd document the "rules".

Most of the info is from http://kb.cs-cart.com/imported-fields-formatand I have advised them that the info needs updating.

That doc says:

All features that you import must be in the {Feature ID} (Group name) Feature name: Feature type[Feature value] format, where Feature ID - ID of the feature, Group name - Name of the feature group, Feature name - Name of the feature, Feature type - Type of the feature (C - checkbox, M - multiple checkboxes, S - text select box, N - number select box, E - extended selectbox, T - simple text, O - number, D - date), Feature value - Value of the feature (several values can be delimited by a comma). Several features must be delimited by a semicolon. Note, it is required to create features on the Product features page before (!) applying them to the products.
EXAMPLE: T[1233423423]; Release date: D[05/05/07]; Color: S[Red]


Two big things:

  • As of v4.3.4 (possible earlier), the Features do not need to exist - the import process will add them (so be careful importing into a live site!)
  • Feature Type "E - Extended Selectbox" is displayed as "Brand/Manufacturer" in the Admin area.

If your features already exist, run this SQL to see what it's Type code is:

SELECT pfd.description, pf.feature_type FROM cs_product_features pf join cs_product_features_descriptions pfd on pf.feature_id = pfd.feature_id



Let's imagine we have two Groups (in bold) with a couple of Features within:

  • Product Details
    • Brand (Type: Select Box > Brand/Manufacturer = E)
    • Country of Origin (Type: Select Box > Text = S)
  • General Info
    • ​Size (Type: Others > Text = T)
    • Weight (Type: Others > Number = O)
    • Uses (Type: Checkbox > Multiple = M)

In your Product CSV, you only have one Features column to squish this all into.. Here's how:

  • For a product with one feature having one variant
    "(Group_Name) Feature_Name: Type_Code[Feature_Value]";
    eg. "(Product Details) Brand: E[Johnson & Johnson]";
  • For a product with one feature having two variants
    "(Group_Name) Feature_Name: Type_Code[Feature_Value///Feature_Value2]";
    eg. "(General Info) Uses: M[Face///Hands]";
  • For a product with two features in the same group having one variant each
    Note the space between the semicolon and the next Feature:
    [Feature_Value]; (Group Name)
    and no semicolon inside the quotes after the last value:
    [Feature_Value]";

    "(Group_Name) Feature_Name: Type_Code[Feature_Value]; (Group_Name) Feature_Name: Type_Code[Feature_Value]";
    eg. "(Product Details) Brand: E[Johnson & Johnson]; (Product Details) Country of Origin: S[China]";
  • For a product with features in different groups (per example above)
    "(Group_Name) Feature_Name: Type_Code[Feature_Value]; (Group_Name) Feature_Name: Type_Code[Feature_Value]";
    eg. "(Product Details) Brand: E[Johnson & Johnson]; (Product Details) Country of Origin: S[China]; (General Info) Size: T[Large]; (General Info) Weight: O[200]; Uses: M[Face///Hands]";

If your Features aren't in Groups, just leave the "(Group Name) " bits out.

I hope all of this ends up being helpful to someone else too. Best of luck.

Hi Scruft,

Thanks for the detailed explanation. I'm sure it will help others.

It's ridiculous that all this information has to go in one CSV column, it makes it far to complex = error prone.

Olof

Hi Scruft,

Thanks for the detailed explanation. I'm sure it will help others.

It's ridiculous that all this information has to go in one CSV column, it makes it far to complex = error prone.

Olof

Agreed - its very clunky...

That said, I am importing correctly from CSV file, but any feature values that were set prior to import are not updated in my CSV file are cleared after import.

That happen to anyone else?

BTW - the simplest way to crack the code on how to setup an import is to run an export and view the contents of that file.

Please pay attention to our Features In Separate Columns module

Please pay attention to our Features In Separate Columns module

Good one, as a temporary fix, I exported all live data to a CSV file and and prepended that string to the fields I wanted to update, that way all the original data was put back in too.

Luckily I only need to do this once.

Good idea for an addon though..