Class FacetViewModel
- Namespace
- Dynamicweb.Ecommerce.ProductCatalog
- Assembly
- Dynamicweb.Ecommerce.dll
Represents a single filterable attribute (facet) within a FacetGroupViewModel, exposing its selectable options and the query-string parameters needed to apply the filter.
public class FacetViewModel : FillableViewModelBase
- Inheritance
-
FacetViewModel
- Inherited Members
Remarks
A facet maps to one searchable field (e.g. "Color", "Price") and carries the full set of
Options the customer can choose from. Use QueryParameter as the form field name
and each Value as the submitted value.
For range facets (e.g. price sliders), use MinimumFacetValue and MaximumFacetValue to set the slider bounds. For list facets, iterate Options to render checkboxes or radio buttons.
Use OptionActiveCount to show a badge or indicator when any filter is active on this facet.
Properties
FacetField
Gets or sets the index field name that this facet is built from (e.g. "Color").
public string FacetField { get; set; }
Property Value
FacetType
Gets or sets the facet type as defined in the search index configuration (e.g. "Term", "Range").
public string FacetType { get; set; }
Property Value
FacetValue
Gets or sets the currently active filter value for this facet as submitted in the query string.
public string FacetValue { get; set; }
Property Value
MaximumFacetValue
Gets or sets the maximum value for a range facet (e.g. the highest available price).
Use as the upper bound of a range slider. Is 0 for non-range facets.
public double MaximumFacetValue { get; set; }
Property Value
MinimumFacetValue
Gets or sets the minimum value for a range facet (e.g. the lowest available price).
Use as the lower bound of a range slider. Is 0 for non-range facets.
public double MinimumFacetValue { get; set; }
Property Value
Name
Gets or sets the display name of the facet shown as the filter group heading (e.g. "Color", "Price").
public string Name { get; set; }
Property Value
OptionActiveCount
Gets or sets the number of options that are currently active (selected) for this facet. Use this to show a badge or indicator when one or more filters are applied.
public int OptionActiveCount { get; set; }
Property Value
OptionCount
Gets or sets the total number of options available for this facet (regardless of the current search context).
public int OptionCount { get; set; }
Property Value
OptionResultTotalCount
Gets or sets the total number of products that match all currently active options for this facet.
public long OptionResultTotalCount { get; set; }
Property Value
Options
Gets or sets the selectable options for this facet. Each FacetOptionViewModel carries a label, value, result count, and selected state.
public IEnumerable<FacetOptionViewModel> Options { get; set; }
Property Value
QueryParameter
Gets or sets the URL query-string parameter name used to apply this facet filter (e.g. "Color").
Use this as the name attribute of form inputs and as the key when building filter URLs.
public string QueryParameter { get; set; }
Property Value
QueryParameterDefaultValue
Gets or sets the default value of QueryParameter when no filter has been applied. Use this to reset the filter UI to its initial state.
public string QueryParameterDefaultValue { get; set; }
Property Value
QueryParameterType
Gets or sets the data type of QueryParameter (e.g. "String", "Int", "Double").
Use this to determine how to format or parse the submitted value.
public string QueryParameterType { get; set; }
Property Value
RenderType
Gets or sets the render type hint for this facet (e.g. "CheckboxList", "RangeSlider").
Use this in Razor templates to choose which partial or component to render for the facet.
public string RenderType { get; set; }