Manager
Class Manager Helps to manage delivery services.
Table of Contents
Constants
Methods
- add() : AddResult
- Adds delivery service
- calculate() : mixed
- calculateDeliveryPrice() : CalculationResult
- Calculates the price of the shipment
- checkServiceRestrictions() : mixed
- checkServiceUsage() : Result
- Returns if delivery service and it's children are used in shipments
- createObject() : Base|null
- createServiceObject() : mixed
- delete() : Result
- Deletes delivery service
- generateXmlId() : string
- getActive() : mixed
- getActiveList() : array<string|int, mixed>
- Prepares and caches data during the hit
- getById() : array<string|int, mixed>
- Returns service field, caches results during hit.
- getByParentId() : array<string|int, mixed>
- getCodeById() : string
- getEmptyDeliveryServiceId() : int
- getGroupId() : int
- Returns id of delivery service group.
- getHandlersClassNames() : mixed
- getHandlersList() : array<string|int, mixed>
- getIdByCode() : int
- getList() : Result
- getLocationConnectorEntityName() : string
- Returns entity link name for connection with Locations
- getObjectByCode() : Base
- getObjectById() : Base
- getPooledObject() : mixed
- getRestHandlerList() : array<string|int, mixed>|null
- getRestrictedList() : array<string|int, mixed>
- getRestrictedObjectsList() : array<string|int, Base>
- getRestrictionClassNames() : mixed
- getRestrictionObject() : mixed
- getRestrictionsByDeliveryId() : mixed
- getService() : mixed
- getServiceByCode() : mixed
- getServicesBriefsForShipment() : mixed
- getServicesForShipment() : mixed
- isDeliveryServiceClassValid() : bool
- Check if given class is valid delivery service class inheritance of Bitrix\Sale\Delivery\Services\Base.
- isExistService() : mixed
- isServiceExist() : bool
- onGetBusinessValueConsumers() : array<string|int, mixed>
- onGetBusinessValueGroups() : mixed
- setChildrenFieldsValues() : int
- Sets fields values to all children
- update() : UpdateResult
- Updates delivery service
Constants
SKIP_CHILDREN_PARENT_CHECK
public
mixed
SKIP_CHILDREN_PARENT_CHECK
= 1
SKIP_PROFILE_PARENT_CHECK
public
mixed
SKIP_PROFILE_PARENT_CHECK
= 0
Methods
add()
Adds delivery service
public
static add(array<string|int, mixed> $fields) : AddResult
Parameters
- $fields : array<string|int, mixed>
Tags
Return values
AddResultcalculate()
public
static calculate(Shipment $shipment) : mixed
use \Bitrix\Sale\Delivery\Services\Manager::calculateDeliveryPrice()
Parameters
- $shipment : Shipment
calculateDeliveryPrice()
Calculates the price of the shipment
public
static calculateDeliveryPrice(Shipment $shipment[, int $deliveryId = 0 ][, array<string|int, mixed> $extraServices = array() ]) : CalculationResult
Parameters
- $shipment : Shipment
- $deliveryId : int = 0
-
optional
- $extraServices : array<string|int, mixed> = array()
-
optional
Tags
Return values
CalculationResultcheckServiceRestrictions()
public
static checkServiceRestrictions(mixed $deliveryId, Shipment $shipment[, mixed $restrictionsClassesToSkip = array() ]) : mixed
use Restrictions\Manager::checkService()
Parameters
- $deliveryId : mixed
- $shipment : Shipment
- $restrictionsClassesToSkip : mixed = array()
checkServiceUsage()
Returns if delivery service and it's children are used in shipments
public
static checkServiceUsage(mixed $deliveryId) : Result
Parameters
- $deliveryId : mixed
Tags
Return values
ResultcreateObject()
public
static createObject(array<string|int, mixed> $srvParams) : Base|null
Parameters
- $srvParams : array<string|int, mixed>
-
Delivery service fields from DataBase to construct service object.
Return values
Base|null —Delivery service object All errors it writes to system log. It's better to use \Bitrix\Sale\Delivery\Services\Manager::getPooledObject for performance purposes
createServiceObject()
public
static createServiceObject(array<string|int, mixed> $srvParams) : mixed
use \Bitrix\Sale\Delivery\Services\Manager::createObject()
Parameters
- $srvParams : array<string|int, mixed>
delete()
Deletes delivery service
public
static delete(int $id[, bool $checkServiceUsage = true ]) : Result
Parameters
- $id : int
- $checkServiceUsage : bool = true
Tags
Return values
ResultgenerateXmlId()
public
static generateXmlId() : string
Return values
stringgetActive()
public
static getActive() : mixed
use \Bitrix\Sale\Delivery\Services\Manager::getActiveList()
getActiveList()
Prepares and caches data during the hit
public
static getActiveList([bool $calculatingOnly = false ][, array<string|int, mixed> $restrictedIds = null ]) : array<string|int, mixed>
Parameters
- $calculatingOnly : bool = false
-
If we need absolutely all, or calculating items only.
- $restrictedIds : array<string|int, mixed> = null
-
If we have list of services ids, successful checked restrictions.
Tags
Return values
array<string|int, mixed> —Array of active delivery services fields.
getById()
Returns service field, caches results during hit.
public
static getById(int $deliveryId) : array<string|int, mixed>
Parameters
- $deliveryId : int
Tags
Return values
array<string|int, mixed> —Service fields
getByParentId()
public
static getByParentId(int $parentId) : array<string|int, mixed>
Parameters
- $parentId : int
-
Delivery service parent id
Tags
Return values
array<string|int, mixed> —Delivery service fields
getCodeById()
public
static getCodeById(int $id) : string
Parameters
- $id : int
Tags
Return values
string —Delivery service code
getEmptyDeliveryServiceId()
public
static getEmptyDeliveryServiceId() : int
Tags
Return values
int —Empty delivery service id
getGroupId()
Returns id of delivery service group.
public
static getGroupId(string $name) : int
Creates if such group does not exist.
Parameters
- $name : string
-
Group name
Tags
Return values
int —Group id
getHandlersClassNames()
public
static getHandlersClassNames() : mixed
use \Bitrix\Sale\Delivery\Services\Manager::getHandlersList()
getHandlersList()
public
static getHandlersList() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Known delivery services handlers
getIdByCode()
public
static getIdByCode(string $code) : int
Parameters
- $code : string
Return values
int —Service id
getList()
public
static getList([array<string|int, mixed> $params = array() ]) : Result
Parameters
- $params : array<string|int, mixed> = array()
Tags
Return values
ResultgetLocationConnectorEntityName()
Returns entity link name for connection with Locations
public
static getLocationConnectorEntityName() : string
Return values
stringgetObjectByCode()
public
static getObjectByCode(string $serviceCode) : Base
Parameters
- $serviceCode : string
-
Delivery service code
Tags
Return values
Base —Delivery service object.
getObjectById()
public
static getObjectById(int $deliveryId) : Base
Parameters
- $deliveryId : int
-
Delivery service id
Tags
Return values
Base —Delivery service object
getPooledObject()
public
static getPooledObject(array<string|int, mixed> $fields) : mixed
Parameters
- $fields : array<string|int, mixed>
getRestHandlerList()
public
static getRestHandlerList() : array<string|int, mixed>|null
Tags
Return values
array<string|int, mixed>|nullgetRestrictedList()
public
static getRestrictedList([Shipment $shipment = null ], int $restrictionMode[, array<string|int, mixed> $skipChecks = array() ]) : array<string|int, mixed>
Parameters
- $shipment : Shipment = null
- $restrictionMode : int
-
MODE_CLIENT or MODE_MANAGER from Restrictions\Manager.
- $skipChecks : array<string|int, mixed> = array()
-
self::SKIP_CHILDREN_PARENT_CHECK || self::SKIP_PROFILE_PARENT_CHECK
Return values
array<string|int, mixed> —Array of active delivery services fields filtered by restrictions.
getRestrictedObjectsList()
public
static getRestrictedObjectsList(Shipment $shipment[, int $restrictionMode = RestrictionsManager::MODE_CLIENT ]) : array<string|int, Base>
Parameters
- $shipment : Shipment
-
.
- $restrictionMode : int = RestrictionsManager::MODE_CLIENT
-
MODE_CLIENT or MODE_MANAGER from Restrictions\Manager.
Return values
array<string|int, Base> —delivery services objects
getRestrictionClassNames()
public
static getRestrictionClassNames() : mixed
use Restrictions\Manager::getClassesList()
getRestrictionObject()
public
static getRestrictionObject(mixed $className) : mixed
will be remove in next versions
Parameters
- $className : mixed
getRestrictionsByDeliveryId()
public
static getRestrictionsByDeliveryId(mixed $deliveryId) : mixed
use Restrictions\Manager::getRestrictionsList()
Parameters
- $deliveryId : mixed
getService()
public
static getService(mixed $deliveryId) : mixed
use \Bitrix\Sale\Delivery\Services\Manager::getObjectById()
Parameters
- $deliveryId : mixed
getServiceByCode()
public
static getServiceByCode(mixed $serviceCode) : mixed
use \Bitrix\Sale\Delivery\Services\Manager::getServiceByCode()
Parameters
- $serviceCode : mixed
getServicesBriefsForShipment()
public
static getServicesBriefsForShipment([Shipment $shipment = null ][, array<string|int, mixed> $skipChecks = array() ][, mixed $getAll = false ]) : mixed
use \Bitrix\Sale\Delivery\Services\Manager::getRestrictedList()
Parameters
- $shipment : Shipment = null
- $skipChecks : array<string|int, mixed> = array()
- $getAll : mixed = false
getServicesForShipment()
public
static getServicesForShipment(Shipment $shipment) : mixed
use \Bitrix\Sale\Delivery\Services\Manager::getRestrictedObjectsList()
Parameters
- $shipment : Shipment
isDeliveryServiceClassValid()
Check if given class is valid delivery service class inheritance of Bitrix\Sale\Delivery\Services\Base.
public
static isDeliveryServiceClassValid(string $class) : bool
Parameters
- $class : string
-
Checking class.
Return values
boolisExistService()
public
static isExistService(mixed $deliveryId) : mixed
use \Bitrix\Sale\Delivery\Services\Manager::isServiceExist()
Parameters
- $deliveryId : mixed
isServiceExist()
public
static isServiceExist(mixed $deliveryId) : bool
Parameters
- $deliveryId : mixed
Tags
Return values
bool —is service exists or not
onGetBusinessValueConsumers()
public
static onGetBusinessValueConsumers() : array<string|int, mixed>
Return values
array<string|int, mixed> —registerEventHandler( 'sale', 'OnGetBusinessValueConsumers', 'sale', '\Bitrix\Sale\Delivery\Services\Manager', 'onGetBusinessValueConsumers');
onGetBusinessValueGroups()
public
static onGetBusinessValueGroups() : mixed
setChildrenFieldsValues()
Sets fields values to all children
public
static setChildrenFieldsValues(int $id, array<string|int, mixed> $fields) : int
Parameters
- $id : int
- $fields : array<string|int, mixed>
Tags
Return values
int —count modified children
update()
Updates delivery service
public
static update(int $id, array<string|int, mixed> $fields) : UpdateResult
Parameters
- $id : int
- $fields : array<string|int, mixed>