Guest User

Untitled

a guest
Feb 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. using System;
  2. using Telerik.Sitefinity.Ecommerce.Catalog.Model;
  3. using Telerik.Sitefinity.Model;
  4. using Telerik.Sitefinity.Modules.Ecommerce.Catalog;
  5.  
  6. namespace SitefinityWebApp
  7. {
  8. public class SetCustomFieldValueOfProduct
  9. {
  10. public static void SetCustomFieldValue(Guid productId, string customFieldName, string customFieldValue)
  11. {
  12. CatalogManager catalogManager = CatalogManager.GetManager();
  13.  
  14. Product product = catalogManager.GetProduct(productId);
  15.  
  16. if (product == null)
  17. {
  18. return; // Product does not exist
  19. }
  20.  
  21. product.SetValue(customFieldName, customFieldValue);
  22.  
  23. catalogManager.SaveChanges();
  24. }
  25. }
  26. }
Add Comment
Please, Sign In to add comment