ProductCategory extends ProductCategoryRestriction
Class RestrictionBase.
Base class for payment and delivery services restrictions.
Table of Contents
Properties
- $easeSort : int
Methods
- check() : bool
- Compares the list of categories of items in basket with the list of categories that restrict entity and returns true if all basket categories exist in restriction list
- checkByEntity() : int
- Checking the service parameters for compliance with the restriction by entity.
- delete() : DeleteResult
- extractParams() : array<string|int, mixed>
- Retrieves from the $entity an array
- getClassDescription() : string
- Returns the restriction description
- getClassTitle() : string
- Returns the restriction title
- getCode() : string
- Get a restriction code that is comparable to the service handler restriction code.
- getOnApplyErrorMessage() : string
- Returns message that will be display if error occurs while applying restriction
- getParamsStructure() : array<string|int, mixed>
- Returns array of 'PRODUCT_CATEGORIES' restriction params
- getSeverity() : int
- isAvailable() : bool
- isMyCode() : bool
- prepareData() : bool
- prepareParamsValues() : array<string|int, mixed>
- save() : AddResult|UpdateResult
- validateRestriction() : Result
- Checking the restriction for compliance with business rules.
Properties
$easeSort
public
static int
$easeSort
= 100
100 - lightweight - just compare with params 200 - middleweight - may be use base queries 300 - hardweight - use base, and/or hard calculations
Methods
check()
Compares the list of categories of items in basket with the list of categories that restrict entity and returns true if all basket categories exist in restriction list
public
static check(array<string|int, mixed> $categoriesList, array<string|int, mixed> $restrictionParams[, int $deliveryId = 0 ]) : bool
Parameters
- $categoriesList : array<string|int, mixed>
-
array of categories Ids that are in the basket
- $restrictionParams : array<string|int, mixed>
- $deliveryId : int = 0
Return values
boolcheckByEntity()
Checking the service parameters for compliance with the restriction by entity.
public
static checkByEntity(Entity $entity, array<string|int, mixed> $restrictionParams, int $mode[, int $serviceId = 0 ]) : int
Parameters
- $entity : Entity
- $restrictionParams : array<string|int, mixed>
- $mode : int
- $serviceId : int = 0
Tags
Return values
intdelete()
public
static delete(mixed $restrictionId[, int $entityId = 0 ]) : DeleteResult
Parameters
- $restrictionId : mixed
- $entityId : int = 0
Tags
Return values
DeleteResultextractParams()
Retrieves from the $entity an array
public
static extractParams(Entity $entity) : array<string|int, mixed>
Parameters
- $entity : Entity
Return values
array<string|int, mixed>getClassDescription()
Returns the restriction description
public
static getClassDescription() : string
Return values
stringgetClassTitle()
Returns the restriction title
public
static getClassTitle() : string
Return values
stringgetCode()
Get a restriction code that is comparable to the service handler restriction code.
public
static getCode() : string
Bitrix restrictions will return name of restriction class. Vendor restrictions must return full classname with namespace.
Example 1: for bitrix currency restriction class **Bitrix\Currency** it will return 'currency'
Example 2: for vendor currency restriction class **Vendor\Currency** it will return 'Vendor\Currency'
Return values
stringgetOnApplyErrorMessage()
Returns message that will be display if error occurs while applying restriction
public
static getOnApplyErrorMessage() : string
Return values
stringgetParamsStructure()
Returns array of 'PRODUCT_CATEGORIES' restriction params
public
static getParamsStructure([int $entityId = 0 ]) : array<string|int, mixed>
Parameters
- $entityId : int = 0
Return values
array<string|int, mixed>getSeverity()
public
static getSeverity(int $mode) : int
Parameters
- $mode : int
-
- RestrictionManager::MODE_CLIENT | RestrictionManager::MODE_MANAGER
Return values
intisAvailable()
public
static isAvailable() : bool
Return values
boolisMyCode()
public
static isMyCode(string $code) : bool
Parameters
- $code : string
Return values
boolprepareData()
public
static prepareData(array<string|int, mixed> $servicesIds) : bool
Parameters
- $servicesIds : array<string|int, mixed>
Return values
boolprepareParamsValues()
public
static prepareParamsValues(array<string|int, mixed> $paramsValues[, int $entityId = 0 ]) : array<string|int, mixed>
Parameters
- $paramsValues : array<string|int, mixed>
- $entityId : int = 0
Return values
array<string|int, mixed>save()
public
static save(array<string|int, mixed> $fields[, int $restrictionId = 0 ]) : AddResult|UpdateResult
Parameters
- $fields : array<string|int, mixed>
- $restrictionId : int = 0
Tags
Return values
AddResult|UpdateResultvalidateRestriction()
Checking the restriction for compliance with business rules.
public
static validateRestriction(array<string|int, mixed> $fields) : Result
For example, for the restriction "currency" in this method, you can compare which currencies the payment system works with which the restriction is linked.
Parameters
- $fields : array<string|int, mixed>
-
restriction fields