Dynamicweb 8 Documentation
ProductFieldValues Property
Example 

Gets or sets the collection of custom product field values. Administrator can create custom product fields in the Management Center -> eCommerce settings -> Product catalog -> Product fields.
Syntax
'Declaration
 
Public Property ProductFieldValues As ProductFieldValueCollection
public ProductFieldValueCollection ProductFieldValues {get; set;}
Example
Working with ProductFieldValuesWorking with ProductFieldValues
using Dynamicweb.eCommerce.Products;

namespace Dynamicweb.Examples.CSharp.eCommerce
{
    public class ProductProductFieldValuesSample
    {
        public void CreateNewProductWithProductFieldValue(string productFieldSystemName, object value)
        {
            // Create a new Product instance
            var product = new Product();

            // Set Product Name property
            product.Name = "My new product";

            // Get the ProductFieldValue object for the ProductField with the given system name
            var productFieldValue = product.ProductFieldValues.GetProductFieldValue(productFieldSystemName);

            // If the ProductFieldValue object exists then set its Value to the given value
            if (productFieldValue != null)
                productFieldValue.Value = value;

            // Save the product to persist data
            product.Save();
        }
        
    }
}
Imports Dynamicweb.eCommerce.Products

Public Class ProductProductFieldValuesSample
    Public Sub CreateNewProductWithProductFieldValue(productFieldSystemName As String, value As Object)
        ' Create a new Product instance
        Dim product As New Product()

        ' Set Product Name property
        product.Name = "My new product"

        ' Get the ProductFieldValue object for the ProductField with the given system name
        Dim productFieldValue As ProductFieldValue = product.ProductFieldValues.GetProductFieldValue(productFieldSystemName)

        ' If the ProductFieldValue object exists then set its Value to the given value
        If productFieldValue IsNot Nothing Then
            productFieldValue.Value = value
        End If

        ' Save the product to persist data
        product.Save()
    End Sub
End Class
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Product Class
Product Members

Send Feedback