Bitrix API

ProductTable extends DataManager

Class ProductTable

Fields:

  • ID int mandatory
  • QUANTITY double mandatory
  • QUANTITY_TRACE bool optional default 'N'
  • WEIGHT double mandatory
  • TIMESTAMP_X datetime mandatory default 'CURRENT_TIMESTAMP'
  • PRICE_TYPE string(1) mandatory default 'S'
  • RECUR_SCHEME_LENGTH int optional
  • RECUR_SCHEME_TYPE string(1) mandatory default 'D'
  • TRIAL_PRICE_ID int optional
  • WITHOUT_ORDER bool optional default 'N'
  • SELECT_BEST_PRICE bool optional default 'Y'
  • VAT_ID int optional
  • VAT_INCLUDED bool optional default 'Y'
  • CAN_BUY_ZERO bool optional default 'N'
  • NEGATIVE_AMOUNT_TRACE string(1) mandatory default 'D'
  • TMP_ID string(40) optional
  • PURCHASING_PRICE double optional
  • PURCHASING_CURRENCY string(3) optional
  • BARCODE_MULTI bool optional default 'N'
  • QUANTITY_RESERVED double optional
  • SUBSCRIBE string(1) optional
  • WIDTH double optional
  • LENGTH double optional
  • HEIGHT double optional
  • MEASURE int optional
  • TYPE int optional
  • AVAILABLE string(1) optional
  • BUNDLE string(1) optional
  • IBLOCK_ELEMENT reference to [](\Bitrix\Iblock\ElementTable)
  • TRIAL_IBLOCK_ELEMENT reference to [](\Bitrix\Iblock\ElementTable)
  • TRIAL_PRODUCT reference to [](\Bitrix\Catalog\ProductTable)

Table of Contents

Constants

EVENT_ON_ADD  = "OnAdd"
EVENT_ON_AFTER_ADD  = "OnAfterAdd"
EVENT_ON_AFTER_DELETE  = "OnAfterDelete"
EVENT_ON_AFTER_UPDATE  = "OnAfterUpdate"
EVENT_ON_BEFORE_ADD  = "OnBeforeAdd"
EVENT_ON_BEFORE_DELETE  = "OnBeforeDelete"
EVENT_ON_BEFORE_UPDATE  = "OnBeforeUpdate"
EVENT_ON_DELETE  = "OnDelete"
EVENT_ON_UPDATE  = "OnUpdate"
PAYMENT_PERIOD_DAY  = 'D'
PAYMENT_PERIOD_DOUBLE_YEAR  = 'T'
PAYMENT_PERIOD_HOUR  = 'H'
PAYMENT_PERIOD_MONTH  = 'M'
PAYMENT_PERIOD_QUART  = 'Q'
PAYMENT_PERIOD_SEMIYEAR  = 'S'
PAYMENT_PERIOD_WEEK  = 'W'
PAYMENT_PERIOD_YEAR  = 'Y'
PAYMENT_TYPE_REGULAR  = 'R'
PAYMENT_TYPE_SINGLE  = 'S'
PAYMENT_TYPE_TRIAL  = 'T'
PRICE_MODE_QUANTITY  = 'Q'
PRICE_MODE_RATIO  = 'R'
PRICE_MODE_SIMPLE  = 'S'
STATUS_DEFAULT  = 'D'
STATUS_NO  = 'N'
STATUS_YES  = 'Y'
TYPE_EMPTY_SKU  = 6
TYPE_FREE_OFFER  = 5
TYPE_OFFER  = 4
TYPE_PRODUCT  = 1
TYPE_SERVICE  = 7
TYPE_SET  = 2
TYPE_SKU  = 3
USER_FIELD_ENTITY_ID  = 'PRODUCT'

Methods

add()  : AddResult
Adds row to entity table
addMulti()  : AddResult
Adds several rows to entity table.
calculateAvailable()  : string
Calculate available for product.
checkFields()  : mixed
Checks the data fields before saving to DB. Result stores in the $result object
cleanCache()  : void
Cleans the tablet cache after data modifications.
clearProductCache()  : void
Clear product cache.
createCollection()  : EO_Product_Collection
createObject()  : EO_Product
cryptoEnabled()  : bool
Returns true if crypto is enabled for a field.
delete()  : DeleteResult
Deletes row in entity table by primary key
enableCrypto()  : mixed
Sets a flag indicating crypto support for a field.
getById()  : EO_Product_Result
Returns selection by entity's primary key
getByPrimary()  : EO_Product_Result
Returns selection by entity's primary key and optional parameters for getList()
getCollectionClass()  : string|Collection
Returns class of Object collection for current entity.
getCollectionClassName()  : string
Returns class name (without namespace) of Object collection for current entity.
getCollectionParentClass()  : Collection|string
getConnectionName()  : string
Returns connection name for entity
getCount()  : int
Performs COUNT query on entity and returns the result.
getCurrentRatioWithMeasure()  : array<string|int, mixed>|bool
Returns ratio and measure for products.
getDefaultAvailableSettings()  : array<string|int, mixed>
Return default alailable settings.
getEntity()  : EO_Product_Entity
Returns entity object
getEntityClass()  : Entity|string
getList()  : EO_Product_Result
Executes the query and returns selection by parameters of the query. This function is an alias to the Query object functions
getMap()  : array<string|int, mixed>
Returns entity map definition.
getObjectClass()  : string|EntityObject
Returns class of Object for current entity.
getObjectClassName()  : string
Returns class name (without namespace) of Object for current entity.
getObjectParentClass()  : EntityObject|string
getPaymentPeriods()  : array<string|int, mixed>
Return payment period list.
getPaymentTypes()  : array<string|int, mixed>
Return payment type list.
getProductTypes()  : array<string|int, mixed>
Return product type list.
getQueryClass()  : Query|string
getRow()  : array<string|int, mixed>|null
Returns one row (or null) by parameters for getList()
getRowById()  : array<string|int, mixed>|null
Returns one row (or null) by entity's primary key
getStoreDocumentRestrictedProductTypes()  : array<string|int, mixed>|array<string|int, int>
Returns products types that are not supported and/or relevant in inventory management
getTableName()  : string
Returns DB table name for entity.
getTitle()  : string|null
getTradingEntityNameByType()  : string|null
getUfId()  : string
Returns user fields entity id.
isCacheable()  : bool
You can disable cache for the tablet completely.
isExistProduct()  : bool
Return is exist product.
isNeedCheckQuantity()  : bool
Returns true if need check maximum product quantity.
isUtm()  : mixed
isUts()  : mixed
onAdd()  : mixed
onAfterAdd()  : mixed
onAfterDelete()  : mixed
onAfterUpdate()  : mixed
onBeforeAdd()  : mixed
onBeforeDelete()  : mixed
onBeforeUpdate()  : mixed
onDelete()  : mixed
onUpdate()  : mixed
postInitialize()  : null
query()  : EO_Product_Query
Creates and returns the Query object for the entity
setCurrentDeletingObject()  : void
setDefaultScope()  : Query
unsetEntity()  : mixed
update()  : UpdateResult
Updates row in entity table by primary key
updateMulti()  : UpdateResult
wakeUpCollection()  : EO_Product_Collection
wakeUpObject()  : EO_Product

Constants

EVENT_ON_AFTER_ADD

public mixed EVENT_ON_AFTER_ADD = "OnAfterAdd"

EVENT_ON_AFTER_DELETE

public mixed EVENT_ON_AFTER_DELETE = "OnAfterDelete"

EVENT_ON_AFTER_UPDATE

public mixed EVENT_ON_AFTER_UPDATE = "OnAfterUpdate"

EVENT_ON_BEFORE_ADD

public mixed EVENT_ON_BEFORE_ADD = "OnBeforeAdd"

EVENT_ON_BEFORE_DELETE

public mixed EVENT_ON_BEFORE_DELETE = "OnBeforeDelete"

EVENT_ON_BEFORE_UPDATE

public mixed EVENT_ON_BEFORE_UPDATE = "OnBeforeUpdate"

EVENT_ON_DELETE

public mixed EVENT_ON_DELETE = "OnDelete"

EVENT_ON_UPDATE

public mixed EVENT_ON_UPDATE = "OnUpdate"

PAYMENT_PERIOD_DAY

public mixed PAYMENT_PERIOD_DAY = 'D'

PAYMENT_PERIOD_DOUBLE_YEAR

public mixed PAYMENT_PERIOD_DOUBLE_YEAR = 'T'

PAYMENT_PERIOD_HOUR

public mixed PAYMENT_PERIOD_HOUR = 'H'

PAYMENT_PERIOD_MONTH

public mixed PAYMENT_PERIOD_MONTH = 'M'

PAYMENT_PERIOD_QUART

public mixed PAYMENT_PERIOD_QUART = 'Q'

PAYMENT_PERIOD_SEMIYEAR

public mixed PAYMENT_PERIOD_SEMIYEAR = 'S'

PAYMENT_PERIOD_WEEK

public mixed PAYMENT_PERIOD_WEEK = 'W'

PAYMENT_PERIOD_YEAR

public mixed PAYMENT_PERIOD_YEAR = 'Y'

PAYMENT_TYPE_REGULAR

public mixed PAYMENT_TYPE_REGULAR = 'R'

PAYMENT_TYPE_SINGLE

public mixed PAYMENT_TYPE_SINGLE = 'S'

PAYMENT_TYPE_TRIAL

public mixed PAYMENT_TYPE_TRIAL = 'T'

PRICE_MODE_QUANTITY

public mixed PRICE_MODE_QUANTITY = 'Q'

PRICE_MODE_RATIO

public mixed PRICE_MODE_RATIO = 'R'

PRICE_MODE_SIMPLE

public mixed PRICE_MODE_SIMPLE = 'S'

STATUS_DEFAULT

public mixed STATUS_DEFAULT = 'D'

STATUS_NO

public mixed STATUS_NO = 'N'

STATUS_YES

public mixed STATUS_YES = 'Y'

TYPE_EMPTY_SKU

public mixed TYPE_EMPTY_SKU = 6

TYPE_FREE_OFFER

public mixed TYPE_FREE_OFFER = 5

TYPE_OFFER

public mixed TYPE_OFFER = 4

TYPE_PRODUCT

public mixed TYPE_PRODUCT = 1

TYPE_SERVICE

public mixed TYPE_SERVICE = 7

USER_FIELD_ENTITY_ID

public mixed USER_FIELD_ENTITY_ID = 'PRODUCT'

Methods

add()

Adds row to entity table

public static add(array<string|int, mixed> $data) : AddResult
Parameters
$data : array<string|int, mixed>

An array with fields like array( "fields" => array( "FIELD1" => "value1", "FIELD2" => "value2", ), "auth_context" => \Bitrix\Main\Authentication\Context object ) or just a plain array of fields.

This method uses the default strategy defined in the class.

Tags
throws
Exception
Return values
AddResult —

Contains ID of inserted row

addMulti()

Adds several rows to entity table.

public static addMulti(mixed $rows[, bool $ignoreEvents = false ]) : AddResult

This method uses the default strategy defined in the class.

Parameters
$rows : mixed
$ignoreEvents : bool = false
Tags
throws
ArgumentException
throws
SystemException
Return values
AddResult

calculateAvailable()

Calculate available for product.

public static calculateAvailable(array<string|int, mixed> $fields) : string
Parameters
$fields : array<string|int, mixed>

Product data.

Return values
string

checkFields()

Checks the data fields before saving to DB. Result stores in the $result object

public static checkFields(Result $result, mixed $primary, array<string|int, mixed> $data) : mixed
Parameters
$result : Result
$primary : mixed
$data : array<string|int, mixed>
Tags
throws
ArgumentException
throws
SystemException

cleanCache()

Cleans the tablet cache after data modifications.

public static cleanCache() : void

clearProductCache()

Clear product cache.

public static clearProductCache([int $product = 0 ]) : void

deprecated since catalog 20.100.0

Parameters
$product : int = 0

Product id or zero (clear all cache).

Tags
see
Product::clearCacheItem()

createCollection()

public static createCollection() : EO_Product_Collection
Return values
EO_Product_Collection

createObject()

public static createObject([mixed $setDefaultValues = = 'true' ]) : EO_Product
Parameters
$setDefaultValues : mixed = = 'true'
Return values
EO_Product

cryptoEnabled()

Returns true if crypto is enabled for a field.

public static cryptoEnabled(string $field[, string $table = null ]) : bool
Parameters
$field : string
$table : string = null
Return values
bool

delete()

Deletes row in entity table by primary key

public static delete(mixed $primary) : DeleteResult
Parameters
$primary : mixed
Tags
throws
Exception
Return values
DeleteResult

enableCrypto()

Sets a flag indicating crypto support for a field.

public static enableCrypto(string $field[, string $table = null ][, bool $mode = true ]) : mixed
Parameters
$field : string
$table : string = null
$mode : bool = true

getById()

Returns selection by entity's primary key

public static getById(mixed $id) : EO_Product_Result
Parameters
$id : mixed

Primary key of the entity

Return values
EO_Product_Result

getByPrimary()

Returns selection by entity's primary key and optional parameters for getList()

public static getByPrimary(mixed $primary[, array<string|int, mixed> $parameters = = '[]' ]) : EO_Product_Result
Parameters
$primary : mixed

Primary key of the entity

$parameters : array<string|int, mixed> = = '[]'

Additional parameters for getList()

Return values
EO_Product_Result

getCollectionClass()

Returns class of Object collection for current entity.

public static getCollectionClass() : string|Collection
Return values
string|Collection

getCollectionClassName()

Returns class name (without namespace) of Object collection for current entity.

public final static getCollectionClassName() : string
Return values
string

getConnectionName()

Returns connection name for entity

public static getConnectionName() : string
Return values
string

getCount()

Performs COUNT query on entity and returns the result.

public static getCount([array<string|int, mixed>|ConditionTree $filter = array() ][, array<string|int, mixed> $cache = array() ]) : int
Parameters
$filter : array<string|int, mixed>|ConditionTree = array()
$cache : array<string|int, mixed> = array()

An array of cache options "ttl" => integer indicating cache TTL

Tags
throws
ObjectPropertyException
throws
SystemException
Return values
int

getCurrentRatioWithMeasure()

Returns ratio and measure for products.

public static getCurrentRatioWithMeasure(array<string|int, mixed>|int $product) : array<string|int, mixed>|bool
Parameters
$product : array<string|int, mixed>|int

Product ids.

Tags
throws
ArgumentException
Return values
array<string|int, mixed>|bool

getDefaultAvailableSettings()

Return default alailable settings.

public static getDefaultAvailableSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>

getEntity()

Returns entity object

public static getEntity() : EO_Product_Entity
Return values
EO_Product_Entity

getList()

Executes the query and returns selection by parameters of the query. This function is an alias to the Query object functions

public static getList([array<string|int, mixed> $parameters = = '[]' ]) : EO_Product_Result
Parameters
$parameters : array<string|int, mixed> = = '[]'

An array of query parameters, available keys are:
"select" => array of fields in the SELECT part of the query, aliases are possible in the form of "alias"=>"field";
"filter" => array of filters in the WHERE/HAVING part of the query in the form of "(condition)field"=>"value"; also could be an instance of Filter;
"group" => array of fields in the GROUP BY part of the query;
"order" => array of fields in the ORDER BY part of the query in the form of "field"=>"asc|desc";
"limit" => integer indicating maximum number of rows in the selection (like LIMIT n in MySql);
"offset" => integer indicating first row number in the selection (like LIMIT n, 100 in MySql);
"runtime" => array of entity fields created dynamically;
"cache => array of cache options:
"ttl" => integer indicating cache TTL;
"cache_joins" => boolean enabling to cache joins, false by default.

Return values
EO_Product_Result

getMap()

Returns entity map definition.

public static getMap() : array<string|int, mixed>
Return values
array<string|int, mixed>

getObjectClassName()

Returns class name (without namespace) of Object for current entity.

public final static getObjectClassName() : string
Return values
string

getPaymentPeriods()

Return payment period list.

public static getPaymentPeriods([bool $descr = false ]) : array<string|int, mixed>
Parameters
$descr : bool = false

With description.

Return values
array<string|int, mixed>

getPaymentTypes()

Return payment type list.

public static getPaymentTypes([bool $descr = false ]) : array<string|int, mixed>
Parameters
$descr : bool = false

With description.

Return values
array<string|int, mixed>

getProductTypes()

Return product type list.

public static getProductTypes([bool $descr = false ]) : array<string|int, mixed>
Parameters
$descr : bool = false

With description.

Return values
array<string|int, mixed>

getRow()

Returns one row (or null) by parameters for getList()

public static getRow(array<string|int, mixed> $parameters) : array<string|int, mixed>|null
Parameters
$parameters : array<string|int, mixed>

Primary key of the entity

Tags
throws
ArgumentException
throws
ObjectPropertyException
throws
SystemException
Return values
array<string|int, mixed>|null

getRowById()

Returns one row (or null) by entity's primary key

public static getRowById(mixed $id[, array<string|int, mixed> $parameters = [] ]) : array<string|int, mixed>|null
Parameters
$id : mixed

Primary key of the entity

$parameters : array<string|int, mixed> = []

Additional parameters for getList()

Tags
throws
ArgumentException
throws
ObjectPropertyException
throws
SystemException
Return values
array<string|int, mixed>|null

getStoreDocumentRestrictedProductTypes()

Returns products types that are not supported and/or relevant in inventory management

public static getStoreDocumentRestrictedProductTypes() : array<string|int, mixed>|array<string|int, int>
Return values
array<string|int, mixed>|array<string|int, int>

getTableName()

Returns DB table name for entity.

public static getTableName() : string
Return values
string

getTitle()

public static getTitle() : string|null
Return values
string|null

getTradingEntityNameByType()

public static getTradingEntityNameByType(int $type) : string|null
Parameters
$type : int
Return values
string|null

getUfId()

Returns user fields entity id.

public static getUfId() : string
Return values
string

isCacheable()

You can disable cache for the tablet completely.

public static isCacheable() : bool
Return values
bool

isExistProduct()

Return is exist product.

public static isExistProduct(int $product) : bool

deprecated since catalog 20.100.0

Parameters
$product : int

Product id.

Tags
see
Product::getCacheItem()
throws
ArgumentException
Return values
bool

isNeedCheckQuantity()

Returns true if need check maximum product quantity.

public static isNeedCheckQuantity(array<string|int, mixed> $fields) : bool
Parameters
$fields : array<string|int, mixed>

Product data.

Return values
bool

postInitialize()

public static postInitialize(Entity $entity) : null
Parameters
$entity : Entity
Return values
null

query()

Creates and returns the Query object for the entity

public static query() : EO_Product_Query
Return values
EO_Product_Query

unsetEntity()

public static unsetEntity(mixed $class) : mixed
Parameters
$class : mixed

update()

Updates row in entity table by primary key

public static update(mixed $primary, array<string|int, mixed> $data) : UpdateResult
Parameters
$primary : mixed
$data : array<string|int, mixed>

An array with fields like array( "fields" => array( "FIELD1" => "value1", "FIELD2" => "value2", ), "auth_context" => \Bitrix\Main\Authentication\Context object ) or just a plain array of fields.

Tags
throws
Exception
Return values
UpdateResult

updateMulti()

public static updateMulti(array<string|int, mixed> $primaries, array<string|int, mixed> $data[, bool $ignoreEvents = false ]) : UpdateResult
Parameters
$primaries : array<string|int, mixed>
$data : array<string|int, mixed>
$ignoreEvents : bool = false
Tags
throws
ArgumentException
throws
SystemException
Return values
UpdateResult

wakeUpCollection()

public static wakeUpCollection(mixed $rows) : EO_Product_Collection
Parameters
$rows : mixed
Return values
EO_Product_Collection

wakeUpObject()

public static wakeUpObject(mixed $row) : EO_Product
Parameters
$row : mixed
Return values
EO_Product

        
On this page

Search results