Class FieldOption
- Namespace
- Dynamicweb.Ecommerce.Products
- Assembly
- Dynamicweb.Ecommerce.dll
Represents a single field option.
[Serializable]
public class FieldOption
- Inheritance
-
FieldOption
- Inherited Members
Examples
using Dynamicweb.Ecommerce.Products;
namespace Dynamicweb.Ecommerce.Examples.Products
{
public class ProductFieldOptionHandlerSample
{
public string AddOption(string fieldId, string name, string value)
{
FieldOption option = new FieldOption
{
FieldId = fieldId,
Sort = Services.FieldOptions.MaximumSort(fieldId) + 1,
Name = name,
Value = value,
IsDefault = false
};
Services.FieldOptions.Save(option);
return option.Id;
}
}
}
Constructors
FieldOption()
Initializes a new instance of FieldOption.
public FieldOption()
FieldOption(FieldOption)
Initializes a new instance of FieldOption.
public FieldOption(FieldOption option)
Parameters
option
FieldOption
FieldOption(IDataReader)
Initializes a new instance of FieldOption.
[Obsolete("Do not use it.")]
public FieldOption(IDataReader reader)
Parameters
reader
IDataReader- An instance of System.Data.IDataReader object to retrieve data from.
FieldOption(string)
Initializes a new instance of FieldOption.
[Obsolete("Use Services.FieldOptions.GetOptionById instead.")]
public FieldOption(string optionId)
Parameters
optionId
string- An ID of the option.
Properties
FieldId
Gets or sets and ID of the related field.
public string FieldId { get; set; }
Property Value
Id
Gets or sets option ID.
public string Id { get; set; }
Property Value
IsDefault
Gets or sets value indicating whether this option is selected by default.
public bool IsDefault { get; set; }
Property Value
Name
Gets or sets option name.
[Obsolete("Use 'GetName' or 'SetName' instead")]
public string Name { get; set; }
Property Value
Sort
Gets or sets the sort number.
public int Sort { get; set; }
Property Value
Translations
Gets the translations for the current entity
public TranslationCollection<FieldOptionTranslation> Translations { get; }
Property Value
Value
Gets or sets the value associated with this option.
public string Value { get; set; }
Property Value
Methods
Copy()
Retrieves shallow copy of the current object.
[Obsolete("Use Services.FieldOptions.Copy instead.")]
public FieldOption Copy()
Returns
- FieldOption
- Shallow copy of the current object.
Delete()
Deletes an option.
[Obsolete("Use Services.FieldOptions.Delete instead.")]
public virtual void Delete()
Delete(string)
Deletes specified option.
[Obsolete("Use 'Dynamicweb.Ecommerce.Services.FieldOptions.Delete' instead")]
public static void Delete(string optionId)
Parameters
optionId
string- An ID of the option to delete.
DeleteAll(string)
Deletes all options that belongs to specified field.
[Obsolete("Use 'Dynamicweb.Ecommerce.Services.FieldOptions.DeleteAll' instead")]
public static void DeleteAll(string fieldId)
Parameters
fieldId
string- An ID of either a product field or a product group field.
GetName(string)
public string GetName(string languageId)
Parameters
languageId
string
Returns
GetOptionById(string)
Retrieves an option from by its ID.
[Obsolete("Use 'Dynamicweb.Ecommerce.Services.FieldOptions.GetOptionById' instead")]
public static FieldOption GetOptionById(string optionId)
Parameters
optionId
string- An ID of the option.
Returns
- FieldOption
- Option instance or null (Nothing in Visual Basic) if the specified option can not be found.
GetOptionsByFieldId(string)
Retrieves a collection of options that matches specified field ID.
[Obsolete("Use 'Dynamicweb.Ecommerce.Services.FieldOptions.GetOptionsByFieldId' instead")]
public static FieldOptionCollection GetOptionsByFieldId(string fieldId)
Parameters
fieldId
string- An ID of the field.
Returns
- FieldOptionCollection
- A collection of options that matches specified field ID.
Remarks
The resulting collection is sorted ascending by the sort number.
MaximumSort(string)
Retrieves the maximum sort number for options that matches specified field ID.
[Obsolete("Use 'Dynamicweb.Ecommerce.Services.FieldOptions.MaximumSort' instead")]
public static int MaximumSort(string fieldId)
Parameters
fieldId
string- An ID of the field.
Returns
- int
- The maximum sort number for options that matches specified field ID.
MinimumSort(string)
Retrieves the minimum sort number for options that matches specified field ID.
[Obsolete("Use 'Dynamicweb.Ecommerce.Services.FieldOptions.MinimumSort' instead")]
public static int MinimumSort(string fieldId)
Parameters
fieldId
string- An ID of the field.
Returns
- int
- The minimum sort number for options that matches specified field ID.
Save()
Saves an option.
[Obsolete("Use Services.FieldOptions.Save instead.")]
public virtual void Save()
SetName(string, string)
public void SetName(string languageId, string name)