Sku
Class Sku Provides various useful methods for sku data.
Table of Contents
Constants
- OFFERS_AVAILABLE = 0x4
- OFFERS_ERROR = 0x0
- OFFERS_NOT_AVAILABLE = 0x2
- OFFERS_NOT_EXIST = 0x1
Methods
- allowedUpdateAvailable() : bool
- Return true if allowed automatic update parent product available and prices.
- calculate() : void
- Run calculate parent product available and prices. Need data must will be prepared in Sku::calculateComplete or Sku::calculatePrice.
- calculateComplete() : void
- Prepare data for update parent product available and prices. Run calculate, if disable deferred calculation.
- calculatePrice() : void
- Prepare data for update parent product prices. Run calculate, if disable deferred calculation.
- disableDeferredCalculation() : void
- Disable deferred calculation parent product available and prices.
- disableUpdateAvailable() : void
- Disable automatic update parent product available and prices.
- enableDeferredCalculation() : void
- Enable deferred calculation parent product available and prices.
- enableUpdateAvailable() : void
- Enable automatic update parent product available and prices.
- getDefaultParentSettings() : array<string|int, mixed>
- Return default settings for product with sku.
- getOfferState() : int
- Return available and exist product offers.
- getParentProductFieldsByState() : array<string|int, mixed>
- Returns base product fields for product with sku.
- handlerAfterIblockElementAdd() : void
- OnAfterIBlockElementAdd event handler. Do not use directly.
- handlerAfterIblockElementDelete() : void
- OnAfterIBlockElementDelete event handler. Do not use directly.
- handlerAfterIBlockElementSetPropertyValues() : void
- OnAfterIBlockElementSetPropertyValues event handler. Do not use directly.
- handlerAfterIblockElementSetPropertyValuesEx() : void
- OnAfterIBlockElementSetPropertyValuesEx event handler. Do not use directly.
- handlerAfterIblockElementUpdate() : void
- OnAfterIBlockElementUpdate event handler. Do not use directly.
- handlerIblockElementAdd() : void
- OnIBlockElementAdd event handler. Do not use directly.
- handlerIblockElementDelete() : void
- OnIBlockElementDelete event handler. Do not use directly.
- handlerIblockElementSetPropertyValues() : void
- OnIBlockElementSetPropertyValues event handler. Do not use directly.
- handlerIblockElementSetPropertyValuesEx() : void
- OnIBlockElementSetPropertyValuesEx event handler. Do not use directly.
- handlerIblockElementUpdate() : void
- OnIBlockElementUpdate event handler. Do not use directly.
- updateAvailable() : bool
- Update product available.
- usedDeferredCalculation() : bool
- Return true if allowed deferred calculation parent product available and prices.
Constants
OFFERS_AVAILABLE
public
mixed
OFFERS_AVAILABLE
= 0x4
OFFERS_ERROR
public
mixed
OFFERS_ERROR
= 0x0
OFFERS_NOT_AVAILABLE
public
mixed
OFFERS_NOT_AVAILABLE
= 0x2
OFFERS_NOT_EXIST
public
mixed
OFFERS_NOT_EXIST
= 0x1
Methods
allowedUpdateAvailable()
Return true if allowed automatic update parent product available and prices.
public
static allowedUpdateAvailable() : bool
Return values
boolcalculate()
Run calculate parent product available and prices. Need data must will be prepared in Sku::calculateComplete or Sku::calculatePrice.
public
static calculate() : void
calculateComplete()
Prepare data for update parent product available and prices. Run calculate, if disable deferred calculation.
public
static calculateComplete(int $id[, null|int $iblockId = null ][, null|int $type = null ]) : void
Parameters
- $id : int
-
Product id (sku, offer).
- $iblockId : null|int = null
-
Product iblock (null, if unknown).
- $type : null|int = null
-
Real product type (or null, if unknown).
calculatePrice()
Prepare data for update parent product prices. Run calculate, if disable deferred calculation.
public
static calculatePrice(int $id[, null|int $iblockId = null ][, null|int $type = null ][, array<string|int, mixed> $priceTypes = [] ]) : void
Parameters
- $id : int
-
Product id (sku, offer).
- $iblockId : null|int = null
-
Product iblock (null, if unknown).
- $type : null|int = null
-
Real product type (or null, if unknown).
- $priceTypes : array<string|int, mixed> = []
-
Price type ids for calculation (empty, if need all price types).
disableDeferredCalculation()
Disable deferred calculation parent product available and prices.
public
static disableDeferredCalculation() : void
disableUpdateAvailable()
Disable automatic update parent product available and prices.
public
static disableUpdateAvailable() : void
enableDeferredCalculation()
Enable deferred calculation parent product available and prices.
public
static enableDeferredCalculation() : void
enableUpdateAvailable()
Enable automatic update parent product available and prices.
public
static enableUpdateAvailable() : void
getDefaultParentSettings()
Return default settings for product with sku.
public
static getDefaultParentSettings(int $state[, bool $productIblock = false ]) : array<string|int, mixed>
Parameters
- $state : int
-
State flag.
- $productIblock : bool = false
-
Is iblock (no catalog) with offers.
Return values
array<string|int, mixed>getOfferState()
Return available and exist product offers.
public
static getOfferState(int $productId[, int $iblockId = 0 ]) : int
Parameters
- $productId : int
-
Product id.
- $iblockId : int = 0
-
Iblock id.
Tags
Return values
intgetParentProductFieldsByState()
Returns base product fields for product with sku.
public
static getParentProductFieldsByState(int $offerState) : array<string|int, mixed>
Parameters
- $offerState : int
-
Offers state (exists, available, etc).
Return values
array<string|int, mixed>handlerAfterIblockElementAdd()
OnAfterIBlockElementAdd event handler. Do not use directly.
public
static handlerAfterIblockElementAdd(array<string|int, mixed> &$fields) : void
Parameters
- $fields : array<string|int, mixed>
-
Element data.
handlerAfterIblockElementDelete()
OnAfterIBlockElementDelete event handler. Do not use directly.
public
static handlerAfterIblockElementDelete(array<string|int, mixed> $elementData) : void
Parameters
- $elementData : array<string|int, mixed>
-
Element data.
handlerAfterIBlockElementSetPropertyValues()
OnAfterIBlockElementSetPropertyValues event handler. Do not use directly.
public
static handlerAfterIBlockElementSetPropertyValues(int|string $elementId, int|string $iblockId, array<string|int, mixed>|mixed $newValues, int|string|false $propertyIdentifyer) : void
Parameters
- $elementId : int|string
-
Element id.
- $iblockId : int|string
-
Iblock id.
- $newValues : array<string|int, mixed>|mixed
-
New properties values.
- $propertyIdentifyer : int|string|false
-
Property identifier.
handlerAfterIblockElementSetPropertyValuesEx()
OnAfterIBlockElementSetPropertyValuesEx event handler. Do not use directly.
public
static handlerAfterIblockElementSetPropertyValuesEx(int|string $elementId, int|string $iblockId, array<string|int, mixed>|mixed $newValues, array<string|int, mixed>|mixed $flags) : void
Parameters
- $elementId : int|string
-
Element id.
- $iblockId : int|string
-
Iblock id.
- $newValues : array<string|int, mixed>|mixed
-
New properties values.
- $flags : array<string|int, mixed>|mixed
-
Flags from \CIBlockElement::SetPropertyValuesEx.
handlerAfterIblockElementUpdate()
OnAfterIBlockElementUpdate event handler. Do not use directly.
public
static handlerAfterIblockElementUpdate(array<string|int, mixed> &$fields) : void
Parameters
- $fields : array<string|int, mixed>
-
New element data.
handlerIblockElementAdd()
OnIBlockElementAdd event handler. Do not use directly.
public
static handlerIblockElementAdd(array<string|int, mixed> $fields) : void
Parameters
- $fields : array<string|int, mixed>
-
Element data.
handlerIblockElementDelete()
OnIBlockElementDelete event handler. Do not use directly.
public
static handlerIblockElementDelete(int $elementId, array<string|int, mixed> $elementData) : void
Parameters
- $elementId : int
-
Element id.
- $elementData : array<string|int, mixed>
-
Element data.
handlerIblockElementSetPropertyValues()
OnIBlockElementSetPropertyValues event handler. Do not use directly.
public
static handlerIblockElementSetPropertyValues(int $elementId, int $iblockId, array<string|int, mixed> $newValues, int|string|false $propertyIdentifyer, array<string|int, mixed> $propertyList, array<string|int, mixed> $currentValues) : void
Parameters
- $elementId : int
-
Element id.
- $iblockId : int
-
Iblock id.
- $newValues : array<string|int, mixed>
-
New properties values.
- $propertyIdentifyer : int|string|false
-
Property identifier.
- $propertyList : array<string|int, mixed>
-
Changed property list.
- $currentValues : array<string|int, mixed>
-
Current properties values.
handlerIblockElementSetPropertyValuesEx()
OnIBlockElementSetPropertyValuesEx event handler. Do not use directly.
public
static handlerIblockElementSetPropertyValuesEx(int $elementId, int $iblockId, array<string|int, mixed> $newValues, array<string|int, mixed> $propertyList, array<string|int, mixed> $currentValues) : void
Parameters
- $elementId : int
-
Element id.
- $iblockId : int
-
Iblock id.
- $newValues : array<string|int, mixed>
-
New properties values.
- $propertyList : array<string|int, mixed>
-
Changed property list.
- $currentValues : array<string|int, mixed>
-
Current properties values.
handlerIblockElementUpdate()
OnIBlockElementUpdate event handler. Do not use directly.
public
static handlerIblockElementUpdate(array<string|int, mixed> $newFields, array<string|int, mixed> $oldFields) : void
Parameters
- $newFields : array<string|int, mixed>
-
New element data.
- $oldFields : array<string|int, mixed>
-
Current element data.
updateAvailable()
Update product available.
public
static updateAvailable(int $productId[, int $iblockId = 0 ][, array<string|int, mixed> $productFields = array() ]) : bool
deprecated since catalog 17.6.0
Parameters
- $productId : int
-
Product Id.
- $iblockId : int = 0
-
Iblock Id (optional).
- $productFields : array<string|int, mixed> = array()
-
Product fields (optional).
Tags
Return values
boolusedDeferredCalculation()
Return true if allowed deferred calculation parent product available and prices.
public
static usedDeferredCalculation() : bool