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
ProductFieldThe ProductField object.
ProductField(IDataReader)
Initializes a new instance of the ProductField class.
public ProductField(IDataReader dataReader)
Parameters
dataReader
IDataReaderDataReader.
ProductField(string)
Initializes a new instance of the ProductField class.
public ProductField(string fieldId)
Parameters
fieldId
stringThe field ID.
Fields
PermissionName
public const string PermissionName = "ProductField"
Field Value
Properties
AllowChangesAcrossLanguages
Is used to indicate allowed changes across languages.
public bool AllowChangesAcrossLanguages { get; set; }
Property Value
AllowChangesAcrossVariants
Is used to indicate allowed changes across variants.
public bool AllowChangesAcrossVariants { get; set; }
Property Value
CategoryId
public string CategoryId { get; set; }
Property Value
Description
The description of this field.
public string Description { get; set; }
Property Value
DoNotRender
Is used to skip the field in the loops in the frontend rendering.
public bool DoNotRender { get; set; }
Property Value
FieldValueConversionDecimals
Gets or sets number of decimals to use
public int FieldValueConversionDecimals { get; set; }
Property Value
FieldValueConversionDisplayRule
Gets or sets Indication for how to present the Value in channel/frontend
public FieldValueConversionDisplayRule FieldValueConversionDisplayRule { get; set; }
Property Value
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
Id
Gets or sets the ID.
public string Id { get; set; }
Property Value
- string
The ID.
IsList
public bool IsList { get; }
Property Value
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
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
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
Required
Is used to indicate if a field is required.
public bool Required { get; set; }
Property Value
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
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
Methods
Delete()
Deletes this instance.
public void Delete()
Delete(string)
Deletes the instance by ProductFieldID.
public static void Delete(string fieldId)
Parameters
fieldId
stringDB field name is ProductFieldID.
Fill(IDataReader)
Fills the properties from DataReader.
public void Fill(IDataReader dataReader)
Parameters
dataReader
IDataReaderDataReader.
FindProductFieldsBySystemName(string)
Finds the collection ProductField objects.
public static IEnumerable<ProductField> FindProductFieldsBySystemName(string systemName)
Parameters
systemName
stringSystem name.
Returns
FindProductFieldsBySystemName(string, string)
Finds the collection of ProductField objects.
public static IEnumerable<ProductField> FindProductFieldsBySystemName(string systemName, string fieldId)
Parameters
Returns
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
stringDB field name is ProductFieldID.
Returns
GetCategoryFieldBySystemName(string)
public static ProductField GetCategoryFieldBySystemName(string systemName)
Parameters
systemName
string
Returns
GetCategoryFields()
public static IEnumerable<ProductField> GetCategoryFields()
Returns
GetCategoryReferencedFieldId(string)
public static string GetCategoryReferencedFieldId(string fieldId)
Parameters
fieldId
string
Returns
GetFieldLabel(string)
Gets the label for product field
public string GetFieldLabel(string languageId)
Parameters
languageId
stringLanguage id
Returns
GetFieldLabel(string, bool)
Gets the label for product field
public string GetFieldLabel(string languageId, bool addCategoryLabel)
Parameters
languageId
stringLanguage id
addCategoryLabel
boolShows whether we should add the category name to category field label or not
Returns
GetFieldOptions()
public IEnumerable<FieldOption> GetFieldOptions()
Returns
GetProductFields()
Gets the collection custom ProductField objects.
public static IEnumerable<ProductField> GetProductFields()
Returns
GetProductFields(bool)
Gets the collection ProductField objects.
public static IEnumerable<ProductField> GetProductFields(bool excludeStandardFields)
Parameters
excludeStandardFields
bool
Returns
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
Lock()
Locks this instance.
public void Lock()
Save(string)
Saves the properties into DB.
public void Save(string fieldId)
Parameters
fieldId
stringDB field name is ProductFieldID.
Exceptions
- ArgumentOutOfRangeException
if imposible to create new field