Created
February 22, 2016 23:56
-
-
Save Mozu-CS/ad0cf7ac6d6565238031 to your computer and use it in GitHub Desktop.
A snippet for updating an existing property on a Product Type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Update_Property_Value() | |
{ | |
var propertyResource = new Mozu.Api.Resources.Commerce.Catalog.Admin.Attributedefinition.Producttypes.ProductTypePropertyResource(_apiContext); | |
var attributeResource = new Mozu.Api.Resources.Commerce.Catalog.Admin.Attributedefinition.AttributeResource(_apiContext); | |
var productTypeResource = new Mozu.Api.Resources.Commerce.Catalog.Admin.Attributedefinition.ProductTypeResource(_apiContext); | |
var attribute = attributeResource.GetAttributeAsync("tenant~color").Result; | |
var existingProperty = propertyResource.GetPropertyAsync(17, "tenant~color").Result; | |
existingProperty.VocabularyValues.Add(new AttributeVocabularyValueInProductType() | |
{ | |
Order = 0, | |
Value = "Silver", | |
VocabularyValueDetail = new AttributeVocabularyValue() | |
{ | |
Content = new AttributeVocabularyValueLocalizedContent() | |
{ | |
StringValue = "Silver" | |
}, | |
Value = "Silver", | |
ValueSequence = 0 | |
} | |
} | |
); | |
var updatedProperty = propertyResource.UpdatePropertyAsync(existingProperty, 17, attribute.AttributeFQN).Result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment