Documentation for SmartStore.NET 2.5

Managing Attributes

You can use the following endpoints: ProductAttributes (types of attributes), ProductVariantAttributes (attribute types mapped to a product), ProductVariantAttributeValues (attribute values assigned to a product) and optionally ProductVariantAttributeCombinations (additional information for particular attribute combinations). Because managing attributes that way can lead to some extra work, there is an action method ManageAttributes that sums up the most important steps.

Example
POST http://localhost:1260/odata/v1/Products(211)/ManageAttributes
{"Synchronize":true,"Attributes":[
	{"Name":"Color","IsRequired":false,"Values":[
		{"Name":"Red"},{"Name":"Green","IsPreSelected":true},{"Name":"Blue"}
	]},
	{"Name":"Size","Values":[
		{"Name":"Large"},{"Name":"X-Large","IsPreSelected":true}
	]}
]}

The request configures a product with the ID 211 with two attributes, Color and Size, and its values, Red, Green, Blue and Large, X-Large. The action parameter Attributes is of type ManageAttributeType. See the OData metadata document for a complete list of available properties. If Synchronize is set to false, only missing attributes and attribute values are inserted. If set to true, existing records are also updated and values not included in the request body are removed from the database. If you pass an empty value array, the attribute and all its values are removed from the product.

The following method creates all possible attribute combinations for a product with the ID 211. As a first step, this action always deletes all existing attribute combinations (for a product).

Example
POST http://localhost:1260/odata/v1/Products(211)/CreateAttributeCombinations