When it's necessary to create product classes, and product class attributes and assign them to multiple products all at once, it's good to use the import-export feature for the purpose.
There are three possible ways to import product classes, and product class attributes to your store:
via a products.csv file
A products.csv file is a general file for importing all products related info. For example, it can help you import product classes and product class attributes and assign them to products. See the field properties definition in CSV Import: Products.
via a product-attributes.csv file
A product-attributes.csv file is a general file for importing all product attribute-related info. For example, it can import product classes and product class attributes. It can also assign product classes with related attributes to products. See the field properties definition in CSV Import: Product Attribute Values.
via an attributes.csv file
An attributes.csv file is a file specially intended for importing product classes and related product class attributes. You can use it to import product classes and their attributes without assigning them to products. See the field properties definition in CSV Import: Classes & Attributes.
A store admin can get each of the files mentioned above by exporting them via the CSV Export page of the store's Admin area.
Here, the "Products" checkbox stands for a products.csv file, "Classes & Attributes" - for attributes.csv, and "Product attribute values" - for product-attributes.csv.
Importing Product Classes and Product Class Attributes via Attributes.csv
An attributes.csv file contains the info about all product attributes available in your store, including global, product class, and product-specific attributes. Using the attributes.csv file, you can import product classes and related attributes to your store without assigning them to products.
Let's consider the sample below:
The fields that distinguish a product class and the attributes related to it are as follows:
class: Defines the name of a product class. If this field is defined, it stands for a product class name. The field can be multilanguage (e.g., class_en in our sample) if a store has more than one language pack installed. The value for each language will differ by a language suffix (_en for English, _de for German, etc.)
name: Defines the name of an attribute. If the class field next to the name field has a value, the name field defines the name of a product class attribute. The field can be multilanguage (e.g., name_en in our sample) if a store has more than one language pack installed. The value for each language will differ by a language suffix (_en for English, _de for German, etc.)
group: Defines the name of a group of attributes. If this field has a value along with the name and class fields, it stands for the name of a group of product class attributes. The field can be multilanguage (e.g., group_en in our sample) if a store has more than one language pack installed. The value for each language will differ by a language suffix (_en for English, _de for German, etc.)
options: Defines the names of the attribute option values. If this field is defined along with the name and class fields, it stands for the names of the product class attribute options' values. The field can be multi-valued with the options' values separated from each other with &&. The field can also be multilanguage (e.g., options_en in our sample) if a store has more than one language pack installed. The value for each language will differ by a language suffix ("_en" for English, "_de" for German, etc.)
If you need to import only product classes and the product class attributes to your store, the required fields for the import file will be type, name, class, and options. The group field is optional as there may be no groups for product class attributes. However, the type field is required and stands for a type of product class attribute.
More info on the field values of the attributes.csv file, you can find in the CSV Import: Classes & Attributes guide.
Importing Product Classes and Product Class Attributes via Product-Attributes.csv
A product-attributes.csv file contains the info on all attributes available in the store, including global, product class, product-specific attributes, and their allocation to products. Using product-attributes.csv, you can import product classes, and product class attributes separately from other product-related info and assign them to products.
Let's consider the sample below:
Here, the field that you should pay special attention to is the class field. For example, if this field has a value for a product SKU, it stands for a product class assigned to this product and defines the attribute set to the product via the name field value as a product class attribute.
If you need to import product classes with product class attributes via the product-attributes.csv file and assign them to products, the minimum required fields for your import file will be:
productSKU: Defines a product SKU to which the product class and product class attributes will be assigned.
type: Defines the type of a product class attribute (check the attribute types described in Attribute Value Field Types).
name: Defines the name of a product class attribute.
class: Defines the name of a product class.
value: Defines the value of a product class attribute option. Each new value of a product class attribute should be defined in a separate row.
The rest of the fields are optional. More info on the fields and field values that you can use in the product-attributes.csv file you can find in the CSV Import: Product Attribute Values guide.
Importing Product Classes and Product Class Attributes via Products.csv
A products.csv file is a general file for importing all product-related info and contains all possible information about a product. For example, using products.csv, you can create product classes, and product class attributes and assign them to products. Still, the file itself is so big that it's easier and less confusing to use the other two ways of importing product classes and product class attributes instead. Therefore, the products.csv file is suitable for importing product classes and product class attributes along with the rest of the product info.
Let's consider the sample below:
A field that defines whether a product has a product class assigned to it is the productClass field. The product class attribute options are defined by the fields of the [attribute_name]: (field:class) format, where [attribute_name] stands for the name of a product class attribute. You can make the [attribute_name]: (field:class) field multivalue dividing the options with && from each other. It is also possible to apply price modifiers to the field. If a product class attribute belongs to a group of attributes the field format will be [attribute_name]: (field:class)>>>[group_name].
The minimum required fields to import product classes and product class attributes via a products.csv file are sku, name, productClass, [attribute_name]: (field:class).
A products.csv file to import product classes and product class attributes may look like a screen below:
You can find more info on the fields and field values of the products.csv file in the CSV Import: Products guide.
Related pages: