Modifying attribute values
To modify a attribute value, you must perform the following:
- Get an instance of the catalog manager.
Get an instance of the CatalogManager object.
- Get the specified attribute value.
Get an instance of the attribute value. For more information, read Querying attribute values.
- Modify the instance of the attribute value.
Update the values of the properties of the attribute value.
- Save the changes.
Save the changes to the manager.
Here is a code example:
public static void ModifyProductAttributeValue(Guid productAttributeValueId, string title)
{
CatalogManager catalogManager = CatalogManager.GetManager();
ProductAttributeValue productAttributeValue = catalogManager.GetProductAttributeValue(productAttributeValueId);
if (productAttributeValue == null)
{
return; // The product attribute value does not exist
}
productAttributeValue.Title = title;
catalogManager.SaveChanges();
}