public static void CreateProductAttributeValue(Guid parentAttributeId, string title, string description, bool isActive)
{
CatalogManager catalogManager = CatalogManager.GetManager();
ProductAttribute parentAttribute = catalogManager.GetProductAttribute(parentAttributeId);
if (parentAttribute == null)
{
return; //Parent attribute does not exist.
}
ProductAttributeValue productAttributeValue = catalogManager.CreateProductAttributeValue();
productAttributeValue.Title = title;
productAttributeValue.Name = Regex.Replace(title.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-");
productAttributeValue.IsActive = isActive;
productAttributeValue.Description = description;
productAttributeValue.Ordinal = parentAttribute.TotalProductAttributeValuesCount;
productAttributeValue.Parent = parentAttribute;
catalogManager.SaveChanges();
}