Table of Contents

Class ProductField

Namespace
Dynamicweb.Ecommerce.Products
Assembly
Dynamicweb.Ecommerce.dll

Provides information about a product field.

[Serializable]
[PermissionEntity("ProductField")]
public class ProductField : IPermissionEntity, IPermissionEntityLookup
Inheritance
ProductField
Implements
Inherited Members
Extension Methods

Examples

using Dynamicweb.Ecommerce.Products;

namespace Dynamicweb.Ecommerce.Examples.Products
{
    public class ProductGroupCustomFieldsRendererSample
    {
        public void RenderProductGroupCustomFields(ProductGroupFieldValueCollection productGroupFieldValues)
        {
            var values = new ProductFieldValueCollection();

            foreach (var value in productGroupFieldValues)
            {
                var field = new ProductField();
                var fieldValue = new ProductFieldValue(field, value.Value)
                {
                    ProductField =
                    {
                        Types = value.ProductGroupField.Types,
                        TemplateName = value.ProductGroupField.TemplateName,
                        SystemName = value.ProductGroupField.SystemName
                    },
                    Value = value.Value
                };


                values.Add(fieldValue);
            }

            if (values.Count > 0)
            {
                //TODO: insert your code here
            }
        }
    }
}

Constructors

ProductField()

Initializes a new instance of the ProductField class.

public ProductField()

ProductField(ProductField)

Initializes a new instance of the ProductField class.

public ProductField(ProductField copyOf)

Parameters

copyOf ProductField

The ProductField object.

ProductField(IDataReader)

Initializes a new instance of the ProductField class.

public ProductField(IDataReader dataReader)

Parameters

dataReader IDataReader

DataReader.

ProductField(string)

Initializes a new instance of the ProductField class.

public ProductField(string fieldId)

Parameters

fieldId string

The field ID.

Fields

PermissionName

public const string PermissionName = "ProductField"

Field Value

string

Properties

AllowChangesAcrossLanguages

Is used to indicate allowed changes across languages.

public bool AllowChangesAcrossLanguages { get; set; }

Property Value

bool

AllowChangesAcrossVariants

Is used to indicate allowed changes across variants.

public bool AllowChangesAcrossVariants { get; set; }

Property Value

bool

CategoryId

public string CategoryId { get; set; }

Property Value

string

Description

The description of this field.

public string Description { get; set; }

Property Value

string

DoNotRender

Is used to skip the field in the loops in the frontend rendering.

public bool DoNotRender { get; set; }

Property Value

bool

FieldValueConversionDecimals

Gets or sets number of decimals to use

public int FieldValueConversionDecimals { get; set; }

Property Value

int

FieldValueConversionDisplayRule

Gets or sets Indication for how to present the Value in channel/frontend

public FieldValueConversionDisplayRule FieldValueConversionDisplayRule { get; set; }

Property Value

FieldValueConversionDisplayRule

FieldValueConversionPreset

Gets or sets Id from selected field value conversion, to use as Presentation unit

public int? FieldValueConversionPreset { get; set; }

Property Value

int?

ForeignCategoryId

public string ForeignCategoryId { get; set; }

Property Value

string

Id

Gets or sets the ID.

public string Id { get; set; }

Property Value

string

The ID.

IsList

public bool IsList { get; }

Property Value

bool

IsStandardEditable

Gets value indicating whether it is standard field with limited editing functionality(editable ValidationPattern, Description, DoNotRender and field settings).

public bool IsStandardEditable { get; }

Property Value

bool

ListPresentationType

Gets or sets the presentation type for this field (only applies for product fields of type "list").

public FieldListPresentationType ListPresentationType { get; set; }

Property Value

FieldListPresentationType

Remarks

Setting this property only makes sense for product fields of type "list".

Locked

Gets or sets a value indicating whether this ProductField is locked.

public bool Locked { get; set; }

Property Value

bool

true if locked; otherwise, false.

Name

Gets or sets the name.

public string Name { get; set; }

Property Value

string

The name.

ReadOnly

Is used to indicate if a field is read only

public bool ReadOnly { get; set; }

Property Value

bool

Required

Is used to indicate if a field is required.

public bool Required { get; set; }

Property Value

bool

Section

Gets or sets the field sect.

public ProductFieldSectionType Section { get; set; }

Property Value

ProductFieldSectionType

The sort.

ShowFieldOnBothMasterAndVariant

Is used to indicate whether the field will be shown on all products or hidden in master or variant according to AllowChangesAcrossVariants

public bool ShowFieldOnBothMasterAndVariant { get; set; }

Property Value

bool

Sort

Gets or sets the sorting.

public int Sort { get; set; }

Property Value

int

The sort.

SystemName

Gets or sets a system name.

public string SystemName { get; set; }

Property Value

string

System name.

TemplateName

Gets or sets the name of the template.

public string TemplateName { get; set; }

Property Value

string

The name of the template.

TypeId

Gets or sets the type of ID.

public int TypeId { get; set; }

Property Value

int

The type of ID.

TypeName

Gets or sets the name of the type.

public string TypeName { get; set; }

Property Value

string

The name of the type.

Types

Gets or sets the types.

public IEnumerable<FieldType> Types { get; set; }

Property Value

IEnumerable<FieldType>

The types.

ValidationPattern

Gets or sets the validation pattern.

public string ValidationPattern { get; set; }

Property Value

string

Methods

Delete()

Deletes this instance.

public void Delete()

Delete(string)

Deletes the instance by ProductFieldID.

public static void Delete(string fieldId)

Parameters

fieldId string

DB field name is ProductFieldID.

Fill(IDataReader)

Fills the properties from DataReader.

public void Fill(IDataReader dataReader)

Parameters

dataReader IDataReader

DataReader.

FindProductFieldsBySystemName(string)

Finds the collection ProductField objects.

public static IEnumerable<ProductField> FindProductFieldsBySystemName(string systemName)

Parameters

systemName string

System name.

Returns

IEnumerable<ProductField>

FindProductFieldsBySystemName(string, string)

Finds the collection of ProductField objects.

public static IEnumerable<ProductField> FindProductFieldsBySystemName(string systemName, string fieldId)

Parameters

systemName string

System name.

fieldId string

The field ID.

Returns

IEnumerable<ProductField>

GetAllEditableProductFields()

Gets editable fields for PIM

public static Dictionary<string, ProductField> GetAllEditableProductFields()

Returns

Dictionary<string, ProductField>

The field definitions

GetById(string)

Gets the ProductField object by ID.

public static ProductField GetById(string fieldId)

Parameters

fieldId string

DB field name is ProductFieldID.

Returns

ProductField

GetCategoryFieldBySystemName(string)

public static ProductField GetCategoryFieldBySystemName(string systemName)

Parameters

systemName string

Returns

ProductField

GetCategoryFields()

public static IEnumerable<ProductField> GetCategoryFields()

Returns

IEnumerable<ProductField>

GetCategoryReferencedFieldId(string)

public static string GetCategoryReferencedFieldId(string fieldId)

Parameters

fieldId string

Returns

string

GetFieldLabel(string)

Gets the label for product field

public string GetFieldLabel(string languageId)

Parameters

languageId string

Language id

Returns

string

GetFieldLabel(string, bool)

Gets the label for product field

public string GetFieldLabel(string languageId, bool addCategoryLabel)

Parameters

languageId string

Language id

addCategoryLabel bool

Shows whether we should add the category name to category field label or not

Returns

string

GetFieldOptions()

public IEnumerable<FieldOption> GetFieldOptions()

Returns

IEnumerable<FieldOption>

GetProductFields()

Gets the collection custom ProductField objects.

public static IEnumerable<ProductField> GetProductFields()

Returns

IEnumerable<ProductField>

GetProductFields(bool)

Gets the collection ProductField objects.

public static IEnumerable<ProductField> GetProductFields(bool excludeStandardFields)

Parameters

excludeStandardFields bool

Returns

IEnumerable<ProductField>

GetStandardEditableField(string)

Gets the ProductField object by SystemName.

public static ProductField GetStandardEditableField(string systemName)

Parameters

systemName string

Returns

ProductField

The standard ProductField with the specified SystemName if found, otherwise null.

GetStandardProductFields()

public static IEnumerable<ProductField> GetStandardProductFields()

Returns

IEnumerable<ProductField>

Lock()

Locks this instance.

public void Lock()

Save(string)

Saves the properties into DB.

public void Save(string fieldId)

Parameters

fieldId string

DB field name is ProductFieldID.

Exceptions

ArgumentOutOfRangeException

if imposible to create new field

To top