Bitrix API

DiscountTable extends DataManager

Class DiscountTable

Fields:

  • ID int mandatory
  • XML_ID string(255) optional
  • SITE_ID string(2) mandatory
  • TYPE int mandatory
  • ACTIVE bool optional default 'Y'
  • ACTIVE_FROM datetime optional
  • ACTIVE_TO datetime optional
  • RENEWAL bool optional default 'N'
  • NAME string(255) optional
  • SORT int optional default 100
  • MAX_DISCOUNT double optional
  • VALUE_TYPE string(1) mandatory default 'P'
  • VALUE double mandatory default 0.0000
  • CURRENCY string(3) mandatory
  • TIMESTAMP_X datetime mandatory default 'CURRENT_TIMESTAMP'
  • COUNT_PERIOD string(1) mandatory default 'U'
  • COUNT_SIZE int mandatory
  • COUNT_TYPE bool optional default 'Y'
  • COUNT_FROM datetime optional
  • COUNT_TO datetime optional
  • ACTION_SIZE int mandatory
  • ACTION_TYPE bool optional default 'Y'
  • MODIFIED_BY int optional
  • DATE_CREATE datetime optional
  • CREATED_BY int optional
  • PRIORITY int optional default 1
  • LAST_DISCOUNT bool optional default 'Y'
  • VERSION int optional default 1
  • NOTES string(255) optional
  • CONDITIONS string optional
  • UNPACK string optional
  • USE_COUPONS bool optional default 'N'
  • CREATED_BY_USER reference to [](\Bitrix\Main\UserTable)
  • MODIFIED_BY_USER reference to [](\Bitrix\Main\UserTable)
  • RESTRICTION reference to [](\Bitrix\Catalog\DiscountRestriction)

Table of Contents

Constants

ACTION_PERIOD_TYPE_ALL  = 'U'
ACTION_PERIOD_TYPE_INTERVAL  = 'D'
ACTION_PERIOD_TYPE_PERIOD  = 'P'
ACTION_TYPE_SIZE_DAY  = 'D'
ACTION_TYPE_SIZE_MONTH  = 'M'
ACTION_TYPE_SIZE_YEAR  = 'Y'
ACTUAL_VERSION  = 2
COUNT_PERIOD_TYPE_ALL  = 'U'
COUNT_PERIOD_TYPE_INTERVAL  = 'D'
COUNT_PERIOD_TYPE_PERIOD  = 'P'
COUNT_TYPE_SIZE_DAY  = 'D'
COUNT_TYPE_SIZE_MONTH  = 'M'
COUNT_TYPE_SIZE_YEAR  = 'Y'
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"
OLD_VERSION  = 1
TYPE_DISCOUNT  = 0
TYPE_DISCOUNT_SAVE  = 1
VALUE_TYPE_FIX  = 'F'
VALUE_TYPE_PERCENT  = 'P'
VALUE_TYPE_SALE  = 'S'

Methods

add()  : AddResult
Add discount.
addMulti()  : AddResult
Adds several rows to entity table.
checkFields()  : mixed
Checks the data fields before saving to DB. Result stores in the $result object
checkType()  : bool|string
Check TYPE field.
cleanCache()  : void
Cleans the tablet cache after data modifications.
convertCurrency()  : void
Convert discount data to other currency (sale currency).
createCollection()  : EO_Discount_Collection
createObject()  : EO_Discount
cryptoEnabled()  : bool
Returns true if crypto is enabled for a field.
delete()  : DeleteResult
Deletes discount by primary key.
enableCrypto()  : mixed
Sets a flag indicating crypto support for a field.
getById()  : EO_Discount_Result
Returns selection by entity's primary key
getByPrimary()  : EO_Discount_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.
getEntity()  : EO_Discount_Entity
Returns entity object
getEntityClass()  : Entity|string
getList()  : EO_Discount_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
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
getTableName()  : string
Returns DB table name for entity.
getTitle()  : string|null
getUfId()  : mixed
isCacheable()  : bool
You can disable cache for the tablet completely.
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_Discount_Query
Creates and returns the Query object for the entity
setCurrentDeletingObject()  : void
setDefaultScope()  : Query
setUseCoupons()  : void
Set exist coupons flag for discount list.
unsetEntity()  : mixed
update()  : UpdateResult
Updates discount by primary key.
updateMulti()  : UpdateResult
validateCurrency()  : array<string|int, mixed>
Returns validators for CURRENCY field.
validateName()  : array<string|int, mixed>
Returns validators for NAME field.
validateNotes()  : array<string|int, mixed>
Returns validators for NOTES field.
validateSiteId()  : array<string|int, mixed>
Returns validators for SITE_ID field.
validateType()  : array<string|int, mixed>
Returns validators for TYPE field.
validateXmlId()  : array<string|int, mixed>
Returns validators for XML_ID field.
wakeUpCollection()  : EO_Discount_Collection
wakeUpObject()  : EO_Discount

Constants

ACTION_PERIOD_TYPE_ALL

public mixed ACTION_PERIOD_TYPE_ALL = 'U'

ACTION_PERIOD_TYPE_INTERVAL

public mixed ACTION_PERIOD_TYPE_INTERVAL = 'D'

ACTION_PERIOD_TYPE_PERIOD

public mixed ACTION_PERIOD_TYPE_PERIOD = 'P'

ACTION_TYPE_SIZE_DAY

public mixed ACTION_TYPE_SIZE_DAY = 'D'

ACTION_TYPE_SIZE_MONTH

public mixed ACTION_TYPE_SIZE_MONTH = 'M'

ACTION_TYPE_SIZE_YEAR

public mixed ACTION_TYPE_SIZE_YEAR = 'Y'

ACTUAL_VERSION

public mixed ACTUAL_VERSION = 2

COUNT_PERIOD_TYPE_ALL

public mixed COUNT_PERIOD_TYPE_ALL = 'U'

COUNT_PERIOD_TYPE_INTERVAL

public mixed COUNT_PERIOD_TYPE_INTERVAL = 'D'

COUNT_PERIOD_TYPE_PERIOD

public mixed COUNT_PERIOD_TYPE_PERIOD = 'P'

COUNT_TYPE_SIZE_DAY

public mixed COUNT_TYPE_SIZE_DAY = 'D'

COUNT_TYPE_SIZE_MONTH

public mixed COUNT_TYPE_SIZE_MONTH = 'M'

COUNT_TYPE_SIZE_YEAR

public mixed COUNT_TYPE_SIZE_YEAR = 'Y'

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"

OLD_VERSION

public mixed OLD_VERSION = 1

TYPE_DISCOUNT

public mixed TYPE_DISCOUNT = 0

TYPE_DISCOUNT_SAVE

public mixed TYPE_DISCOUNT_SAVE = 1

VALUE_TYPE_FIX

public mixed VALUE_TYPE_FIX = 'F'

VALUE_TYPE_PERCENT

public mixed VALUE_TYPE_PERCENT = 'P'

VALUE_TYPE_SALE

public mixed VALUE_TYPE_SALE = 'S'

Methods

add()

Add discount.

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

Discount data.

Return values
AddResult

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

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

checkType()

Check TYPE field.

public static checkType(int $value, int|array<string|int, mixed> $primary, array<string|int, mixed> $row, Field $field) : bool|string
Parameters
$value : int

Current field value.

$primary : int|array<string|int, mixed>

Primary key.

$row : array<string|int, mixed>

Current data.

$field : Field

Field object.

Return values
bool|string

cleanCache()

Cleans the tablet cache after data modifications.

public static cleanCache() : void

convertCurrency()

Convert discount data to other currency (sale currency).

public static convertCurrency(array<string|int, mixed> &$discount, string $currency) : void
Parameters
$discount : array<string|int, mixed>

Discout data.

$currency : string

New currency.

createCollection()

public static createCollection() : EO_Discount_Collection
Return values
EO_Discount_Collection

createObject()

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

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 discount by primary key.

public static delete(mixed $primary) : DeleteResult
Parameters
$primary : mixed

Discount primary key.

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_Discount_Result
Parameters
$id : mixed

Primary key of the entity

Return values
EO_Discount_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_Discount_Result
Parameters
$primary : mixed

Primary key of the entity

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

Additional parameters for getList()

Return values
EO_Discount_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

getEntity()

Returns entity object

public static getEntity() : EO_Discount_Entity
Return values
EO_Discount_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_Discount_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_Discount_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

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

getTableName()

Returns DB table name for entity.

public static getTableName() : string
Return values
string

getTitle()

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

isCacheable()

You can disable cache for the tablet completely.

public static isCacheable() : bool
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_Discount_Query
Return values
EO_Discount_Query

setUseCoupons()

Set exist coupons flag for discount list.

public static setUseCoupons(array<string|int, mixed>|int $discountList, string $use) : void
Parameters
$discountList : array<string|int, mixed>|int

Discount ids for update.

$use : string

Value for update use coupons.

unsetEntity()

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

update()

Updates discount by primary key.

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

Discount primary key.

$data : array<string|int, mixed>

Discount data.

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

validateCurrency()

Returns validators for CURRENCY field.

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

validateName()

Returns validators for NAME field.

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

validateNotes()

Returns validators for NOTES field.

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

validateSiteId()

Returns validators for SITE_ID field.

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

validateType()

Returns validators for TYPE field.

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

validateXmlId()

Returns validators for XML_ID field.

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

wakeUpCollection()

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

wakeUpObject()

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

        
On this page

Search results