Bitrix API

ByProductCategory extends ProductCategoryRestriction

Class ByProductCategory Restricts delivery by product category

Table of Contents

Properties

$easeSort  : mixed

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

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
bool

checkByEntity()

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
throws
NotImplementedException
Return values
int

delete()

public static delete(mixed $restrictionId[, int $entityId = 0 ]) : DeleteResult
Parameters
$restrictionId : mixed
$entityId : int = 0
Tags
throws
Exception
Return values
DeleteResult

extractParams()

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
string

getCode()

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
string

getOnApplyErrorMessage()

Returns message that will be display if error occurs while applying restriction

public static getOnApplyErrorMessage() : string
Return values
string

getParamsStructure()

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
int

isAvailable()

public static isAvailable() : bool
Return values
bool

isMyCode()

public static isMyCode(string $code) : bool
Parameters
$code : string
Return values
bool

prepareData()

public static prepareData(array<string|int, mixed> $servicesIds) : bool
Parameters
$servicesIds : array<string|int, mixed>
Return values
bool

prepareParamsValues()

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
throws
Exception
Return values
AddResult|UpdateResult

validateRestriction()

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

Return values
Result

        
On this page

Search results