Facet
Table of Contents
Methods
- __construct() : mixed
- addDatetimePropertyFilter() : void
- Adds a condition for further filtering.
- addDictionaryPropertyFilter() : void
- Adds a condition for further filtering.
- addNumericPropertyFilter() : void
- Adds a condition for further filtering.
- addPriceFilter() : void
- Adds a condition for further filtering.
- enableCurrencyConversion() : void
- When called subsequent queries will use currency conversion for filtering.
- getDictionary() : Dictionary
- Returns facet dictionary object.
- getIblockId() : int
- Returns iblock identifier.
- getSkuIblockId() : int
- Returns SKU iblock identifier.
- getSkuPropertyId() : int
- Returns SKU property identifier.
- getStorage() : Storage
- Returns facet storage object.
- isEmptyWhere() : bool
- Returns true if not filters were applied.
- isValid() : bool
- Returns true if filter rewrite is possible.
- lookupDictionaryValue() : string
- Returns string by its identifier in the dictionary.
- query() : Result|false
- Returns filter join with index tables.
- setPrices() : Facet
- Sets prices for further filtering.
- setSectionId() : Facet
- Sets section context for further filtering.
- whereToSql() : string
- Converts structured $where array into sql condition or empty string.
Methods
__construct()
public
__construct(int $iblockId) : mixed
Parameters
- $iblockId : int
-
Information block identifier.
addDatetimePropertyFilter()
Adds a condition for further filtering.
public
addDatetimePropertyFilter(int $propertyId, string $operator, float $value) : void
Parameters
- $propertyId : int
-
Iblock property identifier.
- $operator : string
-
Comparing operator.
- $value : float
-
Timestamp to compare.
addDictionaryPropertyFilter()
Adds a condition for further filtering.
public
addDictionaryPropertyFilter(int $propertyId, string $operator, float $value) : void
Parameters
- $propertyId : int
-
Iblock property identifier.
- $operator : string
-
Comparing operator.
- $value : float
-
Value to compare.
addNumericPropertyFilter()
Adds a condition for further filtering.
public
addNumericPropertyFilter(int $propertyId, string $operator, float $value) : void
Parameters
- $propertyId : int
-
Iblock property identifier.
- $operator : string
-
Comparing operator.
- $value : float
-
Value to compare.
addPriceFilter()
Adds a condition for further filtering.
public
addPriceFilter(int $priceId, string $operator, float $value) : void
Parameters
- $priceId : int
-
Catalog price identifier.
- $operator : string
-
Comparing operator.
- $value : float
-
Value to compare.
enableCurrencyConversion()
When called subsequent queries will use currency conversion for filtering.
public
enableCurrencyConversion(string $toCurrencyId, array<string|int, mixed> $convertCurrencyId) : void
Works only with 'currency' module installed.
Parameters
- $toCurrencyId : string
-
Valid currency id for price value passed into addPriceFilter method.
- $convertCurrencyId : array<string|int, mixed>
-
Array of valid currencies ids.
getDictionary()
Returns facet dictionary object.
public
getDictionary() : Dictionary
Return values
DictionarygetIblockId()
Returns iblock identifier.
public
getIblockId() : int
Return values
intgetSkuIblockId()
Returns SKU iblock identifier.
public
getSkuIblockId() : int
Return values
intgetSkuPropertyId()
Returns SKU property identifier.
public
getSkuPropertyId() : int
Return values
intgetStorage()
Returns facet storage object.
public
getStorage() : Storage
Return values
StorageisEmptyWhere()
Returns true if not filters were applied.
public
isEmptyWhere() : bool
Return values
boolisValid()
Returns true if filter rewrite is possible.
public
isValid() : bool
Return values
boollookupDictionaryValue()
Returns string by its identifier in the dictionary.
public
lookupDictionaryValue(int $valueId) : string
Parameters
- $valueId : int
-
Value identifier for dictionary lookup.
Return values
stringquery()
Returns filter join with index tables.
public
query(array<string|int, mixed> $filter[, array<string|int, mixed> $facetTypes = array() ][, int $facetId = 0 ]) : Result|false
$filter parameters same as for CIBlockElement::getList
$facetTypes allows to get only "checkboxes" or "prices" and such.
Parameters
- $filter : array<string|int, mixed>
-
Filter to apply additionally to filter elements.
- $facetTypes : array<string|int, mixed> = array()
-
Which facet types will be used.
- $facetId : int = 0
-
Which facet category filter should not be applied.
Return values
Result|falsesetPrices()
Sets prices for further filtering.
public
setPrices(array<string|int, mixed> $prices) : Facet
Returns this object instance for calls chaining.
Parameters
- $prices : array<string|int, mixed>
-
Prices identifiers.
Return values
FacetsetSectionId()
Sets section context for further filtering.
public
setSectionId(int $sectionId) : Facet
Returns this object instance for calls chaining.
Parameters
- $sectionId : int
-
Section identifier.
Return values
FacetwhereToSql()
Converts structured $where array into sql condition or empty string.
public
whereToSql(array<string|int, mixed> $where, string $tableAlias[, string $subsectionsCondition = "" ]) : string
Parameters
- $where : array<string|int, mixed>
-
Structured condition.
- $tableAlias : string
-
Table alias to use in sql.
- $subsectionsCondition : string = ""
-
If not empty will be added.