Bitrix API

OrderDiscountManager extends OrderDiscount

Class OrderDiscountManager

Tags
see
OrderDiscount

Table of Contents

Constants

DESCR_LIMIT_MAX  = \Bitrix\Sale\Discount\Formatter::LIMIT_MAX
DESCR_LIMIT_MIN  = \Bitrix\Sale\Discount\Formatter::LIMIT_MIN
DESCR_TYPE_FIXED  = \Bitrix\Sale\Discount\Formatter::TYPE_FIXED
DESCR_TYPE_LIMIT_VALUE  = \Bitrix\Sale\Discount\Formatter::TYPE_LIMIT_VALUE
DESCR_TYPE_MAX_BOUND  = \Bitrix\Sale\Discount\Formatter::TYPE_MAX_BOUND
DESCR_TYPE_SIMPLE  = \Bitrix\Sale\Discount\Formatter::TYPE_SIMPLE
DESCR_TYPE_VALUE  = \Bitrix\Sale\Discount\Formatter::TYPE_VALUE
DESCR_VALUE_ACTION_ACCUMULATE  = \Bitrix\Sale\Discount\Formatter::VALUE_ACTION_CUMULATIVE
DESCR_VALUE_ACTION_CUMULATIVE  = \Bitrix\Sale\Discount\Formatter::VALUE_ACTION_CUMULATIVE
DESCR_VALUE_ACTION_DISCOUNT  = \Bitrix\Sale\Discount\Formatter::VALUE_ACTION_DISCOUNT
DESCR_VALUE_ACTION_EXTRA  = \Bitrix\Sale\Discount\Formatter::VALUE_ACTION_EXTRA
DESCR_VALUE_TYPE_CURRENCY  = \Bitrix\Sale\Discount\Formatter::VALUE_TYPE_CURRENCY
DESCR_VALUE_TYPE_PERCENT  = \Bitrix\Sale\Discount\Formatter::VALUE_TYPE_PERCENT
DESCR_VALUE_TYPE_SUMM  = \Bitrix\Sale\Discount\Formatter::VALUE_TYPE_SUMM
DESCR_VALUE_TYPE_SUMM_BASKET  = \Bitrix\Sale\Discount\Formatter::VALUE_TYPE_SUMM_BASKET
ERROR_ID  = 'BX_SALE_ORDER_DISCOUNT'
EVENT_ON_BUILD_DISCOUNT_PROVIDERS  = 'onBuildDiscountProviders'
PROVIDER_ACTION_APPLY_COUPON  = 'calculateApplyCoupons'
PROVIDER_ACTION_GET_URL  = 'getEditUrl'
PROVIDER_ACTION_PREPARE_DISCOUNT  = 'prepareData'
PROVIDER_ACTION_ROUND_BASKET_PRICES  = 'roundBasket'
PROVIDER_ACTION_ROUND_ITEM_PRICE  = 'roundPrice'
STORAGE_TYPE_BASKET_ITEM  = 'BASKET_ITEM'
STORAGE_TYPE_DISCOUNT_ACTION_DATA  = 'ACTION_DATA'
STORAGE_TYPE_ORDER_CONFIG  = 'ORDER_CONFIG'
STORAGE_TYPE_ROUND_CONFIG  = 'ROUND_CONFIG'

Methods

addResultBlock()  : mixed
addRoundBlock()  : mixed
calculateApplyCoupons()  : bool|array<string|int, mixed>
Check apply discount.
checkDiscountProvider()  : bool
Check existing discount provider for module.
clearCache()  : void
Clear discount cache.
createSimpleDescription()  : array<string|int, mixed>
Create simple description for unknown discount.
deleteByOrder()  : void
Delete all data by order.
formatArrayDescription()  : array<string|int, mixed>|bool
Format discount result.
formatDescription()  : bool|string
Return string discount description.
formatDiscountDescription()  : Result
Format discount description.
getEditUrl()  : string
Return url for edit sale discount.
getManagerConfig()  : array<string|int, mixed>
Return current manager params.
getOrderCouponIterator()  : Result|null
Order coupons getList.
init()  : void
Initial discount manager.
loadResultFromDatabase()  : Result
Load applied discount list
loadResultFromDb()  : Result
Load discount result for order.
prepareDiscountDescription()  : Result
Prepare discount description.
roundBasket()  : array<string|int, mixed>
Round basket prices.
roundPrice()  : array<string|int, mixed>
Round basket item price.
saveCoupon()  : Result
Save coupon.
saveDiscount()  : Result
Convert and save discount.
saveOrderStoredData()  : Result
Save order stored data.
saveStoredDataBlock()  : Result
Save stored data for entities.
setManagerConfig()  : bool
Set manager params.
updateResultBlock()  : mixed
updateRoundBlock()  : mixed

Constants

DESCR_LIMIT_MAX

public mixed DESCR_LIMIT_MAX = \Bitrix\Sale\Discount\Formatter::LIMIT_MAX

DESCR_LIMIT_MIN

public mixed DESCR_LIMIT_MIN = \Bitrix\Sale\Discount\Formatter::LIMIT_MIN

DESCR_TYPE_FIXED

public mixed DESCR_TYPE_FIXED = \Bitrix\Sale\Discount\Formatter::TYPE_FIXED

DESCR_TYPE_LIMIT_VALUE

public mixed DESCR_TYPE_LIMIT_VALUE = \Bitrix\Sale\Discount\Formatter::TYPE_LIMIT_VALUE

DESCR_TYPE_MAX_BOUND

public mixed DESCR_TYPE_MAX_BOUND = \Bitrix\Sale\Discount\Formatter::TYPE_MAX_BOUND

DESCR_TYPE_SIMPLE

public mixed DESCR_TYPE_SIMPLE = \Bitrix\Sale\Discount\Formatter::TYPE_SIMPLE

DESCR_TYPE_VALUE

public mixed DESCR_TYPE_VALUE = \Bitrix\Sale\Discount\Formatter::TYPE_VALUE

DESCR_VALUE_ACTION_ACCUMULATE

public mixed DESCR_VALUE_ACTION_ACCUMULATE = \Bitrix\Sale\Discount\Formatter::VALUE_ACTION_CUMULATIVE

DESCR_VALUE_ACTION_CUMULATIVE

public mixed DESCR_VALUE_ACTION_CUMULATIVE = \Bitrix\Sale\Discount\Formatter::VALUE_ACTION_CUMULATIVE

DESCR_VALUE_ACTION_DISCOUNT

public mixed DESCR_VALUE_ACTION_DISCOUNT = \Bitrix\Sale\Discount\Formatter::VALUE_ACTION_DISCOUNT

DESCR_VALUE_ACTION_EXTRA

public mixed DESCR_VALUE_ACTION_EXTRA = \Bitrix\Sale\Discount\Formatter::VALUE_ACTION_EXTRA

DESCR_VALUE_TYPE_CURRENCY

public mixed DESCR_VALUE_TYPE_CURRENCY = \Bitrix\Sale\Discount\Formatter::VALUE_TYPE_CURRENCY

DESCR_VALUE_TYPE_PERCENT

public mixed DESCR_VALUE_TYPE_PERCENT = \Bitrix\Sale\Discount\Formatter::VALUE_TYPE_PERCENT

DESCR_VALUE_TYPE_SUMM

public mixed DESCR_VALUE_TYPE_SUMM = \Bitrix\Sale\Discount\Formatter::VALUE_TYPE_SUMM

DESCR_VALUE_TYPE_SUMM_BASKET

public mixed DESCR_VALUE_TYPE_SUMM_BASKET = \Bitrix\Sale\Discount\Formatter::VALUE_TYPE_SUMM_BASKET

EVENT_ON_BUILD_DISCOUNT_PROVIDERS

public mixed EVENT_ON_BUILD_DISCOUNT_PROVIDERS = 'onBuildDiscountProviders'

PROVIDER_ACTION_APPLY_COUPON

public mixed PROVIDER_ACTION_APPLY_COUPON = 'calculateApplyCoupons'

PROVIDER_ACTION_PREPARE_DISCOUNT

public mixed PROVIDER_ACTION_PREPARE_DISCOUNT = 'prepareData'

PROVIDER_ACTION_ROUND_BASKET_PRICES

public mixed PROVIDER_ACTION_ROUND_BASKET_PRICES = 'roundBasket'

PROVIDER_ACTION_ROUND_ITEM_PRICE

public mixed PROVIDER_ACTION_ROUND_ITEM_PRICE = 'roundPrice'

STORAGE_TYPE_BASKET_ITEM

public mixed STORAGE_TYPE_BASKET_ITEM = 'BASKET_ITEM'

STORAGE_TYPE_DISCOUNT_ACTION_DATA

public mixed STORAGE_TYPE_DISCOUNT_ACTION_DATA = 'ACTION_DATA'

STORAGE_TYPE_ORDER_CONFIG

public mixed STORAGE_TYPE_ORDER_CONFIG = 'ORDER_CONFIG'

STORAGE_TYPE_ROUND_CONFIG

public mixed STORAGE_TYPE_ROUND_CONFIG = 'ROUND_CONFIG'

Methods

addResultBlock()

public static addResultBlock(mixed $order, array<string|int, mixed> $block) : mixed
Parameters
$order : mixed
$block : array<string|int, mixed>

addRoundBlock()

public static addRoundBlock(mixed $order, array<string|int, mixed> $block) : mixed
Parameters
$order : mixed
$block : array<string|int, mixed>

calculateApplyCoupons()

Check apply discount.

public static calculateApplyCoupons(string $module, array<string|int, mixed> $discount, array<string|int, mixed> $basket, array<string|int, mixed> $params) : bool|array<string|int, mixed>
Parameters
$module : string

Discount module.

$discount : array<string|int, mixed>

Discount data.

$basket : array<string|int, mixed>

Basket data.

$params : array<string|int, mixed>

Calculate params.

Return values
bool|array<string|int, mixed>

checkDiscountProvider()

Check existing discount provider for module.

public static checkDiscountProvider(string $module) : bool
Parameters
$module : string

Module id.

Return values
bool

createSimpleDescription()

Create simple description for unknown discount.

public static createSimpleDescription(float $newPrice, float $oldPrice, string $currency) : array<string|int, mixed>
Parameters
$newPrice : float

New price.

$oldPrice : float

Old price.

$currency : string

Currency.

Tags
see
CompatibleFormat::createResultDescription
Return values
array<string|int, mixed>

deleteByOrder()

Delete all data by order.

public static deleteByOrder(int $order) : void
Parameters
$order : int

Order id.

formatArrayDescription()

Format discount result.

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

Description data.

Tags
see
Formatter::formatList
Return values
array<string|int, mixed>|bool

formatDescription()

Return string discount description.

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

Description.

Tags
see
Formatter::formatRow
Return values
bool|string

formatDiscountDescription()

Format discount description.

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

Discount description.

Tags
see
Formatter::formatRow
Return values
Result

getEditUrl()

Return url for edit sale discount.

public static getEditUrl(array<string|int, mixed> $discount) : string
Parameters
$discount : array<string|int, mixed>

Discount data.

Return values
string

getManagerConfig()

Return current manager params.

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

getOrderCouponIterator()

Order coupons getList.

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

\Bitrix\Main\Entity\DataManager::getList parameters.

Return values
Result|null

loadResultFromDatabase()

Load applied discount list

public static loadResultFromDatabase(int $order[, bool $extendedMode = false ][, array<string|int, mixed>|bool $basketList = false ][, array<string|int, mixed> $basketData = array() ]) : Result
Parameters
$order : int

Order id.

$extendedMode : bool = false

Get full information by discount - unused.

$basketList : array<string|int, mixed>|bool = false

Correspondence between basket ids and basket codes.

$basketData : array<string|int, mixed> = array()

Basket data.

Tags
see
OrderDiscount::loadResultFromDb
Return values
Result

loadResultFromDb()

Load discount result for order.

public static loadResultFromDb(int $order[, array<string|int, mixed>|bool $basketList = [] ][, array<string|int, mixed> $basketData = [] ]) : Result
Parameters
$order : int

Order id.

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

Correspondence between basket ids and basket codes.

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

Basket data.

Return values
Result

prepareDiscountDescription()

Prepare discount description.

public static prepareDiscountDescription(int $type, array<string|int, mixed>|string $data) : Result
Parameters
$type : int

Description type.

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

Description data.

Tags
see
Formatter::prepareRow
Return values
Result

roundBasket()

Round basket prices.

public static roundBasket(array<string|int, mixed> $basket[, array<string|int, mixed> $roundData = array() ][, array<string|int, mixed> $orderData = array() ]) : array<string|int, mixed>
Parameters
$basket : array<string|int, mixed>

Basket.

$roundData : array<string|int, mixed> = array()

Round data.

$orderData : array<string|int, mixed> = array()

Order (without basket).

Return values
array<string|int, mixed>

roundPrice()

Round basket item price.

public static roundPrice(array<string|int, mixed> $basketItem[, array<string|int, mixed> $roundData = array() ]) : array<string|int, mixed>
Parameters
$basketItem : array<string|int, mixed>

Basket item data.

$roundData : array<string|int, mixed> = array()

Round data.

Return values
array<string|int, mixed>

saveCoupon()

Save coupon.

public static saveCoupon(array<string|int, mixed> $coupon) : Result
Parameters
$coupon : array<string|int, mixed>

Coupon data.

Return values
Result

saveDiscount()

Convert and save discount.

public static saveDiscount(array<string|int, mixed> $discount[, bool $extResult = false ]) : Result
Parameters
$discount : array<string|int, mixed>

Discount data.

$extResult : bool = false

Result extended result data.

Return values
Result

saveOrderStoredData()

Save order stored data.

public static saveOrderStoredData(int $order, string $storageType, array<string|int, mixed> $data[, array<string|int, mixed> $options = array() ]) : Result
Parameters
$order : int
$storageType : string
$data : array<string|int, mixed>
$options : array<string|int, mixed> = array()
Return values
Result

saveStoredDataBlock()

Save stored data for entities.

public static saveStoredDataBlock(int $order, string $storageType, array<string|int, mixed> $block[, array<string|int, mixed> $options = array() ]) : Result
Parameters
$order : int
$storageType : string
$block : array<string|int, mixed>
$options : array<string|int, mixed> = array()
Tags
throws
SqlQueryException
Return values
Result

setManagerConfig()

Set manager params.

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

Manager params (site, currency, etc).

Return values
bool

updateResultBlock()

public static updateResultBlock(mixed $order, array<string|int, mixed> $block) : mixed
Parameters
$order : mixed
$block : array<string|int, mixed>

updateRoundBlock()

public static updateRoundBlock(mixed $order, array<string|int, mixed> $block) : mixed
Parameters
$order : mixed
$block : array<string|int, mixed>

        
On this page

Search results