Bitrix API

Price

Class Price Provides various useful methods for prices.

Table of Contents

Constants

CACHE_ID  = 'catalog_price_round_'
CACHE_TIME  = 360000
VALUE_EPS  = 1.0E-6

Methods

clearRoundRulesCache()  : void
Clear cache rules for price type.
getRoundRules()  : array<string|int, mixed>
Return round rules list for price type.
handlerAfterUpdateCurrencyBaseRate()  : void
Handler onAfterUpdateCurrencyBaseRate for update field PRICE_SCALE after change currency base rate.
loadRoundRules()  : void
Load round rules list for price types.
roundPrice()  : float|int
Round price.
roundValue()  : float|int
Round value with arbitrary precision.
searchRoundRule()  : array<string|int, mixed>
Get rule for price value.

Constants

CACHE_ID

public mixed CACHE_ID = 'catalog_price_round_'

CACHE_TIME

public mixed CACHE_TIME = 360000

VALUE_EPS

public mixed VALUE_EPS = 1.0E-6

Methods

clearRoundRulesCache()

Clear cache rules for price type.

public static clearRoundRulesCache(int $priceType) : void
Parameters
$priceType : int

Price type id.

getRoundRules()

Return round rules list for price type.

public static getRoundRules(int $priceType) : array<string|int, mixed>
Parameters
$priceType : int

Price type id.

Return values
array<string|int, mixed>

handlerAfterUpdateCurrencyBaseRate()

Handler onAfterUpdateCurrencyBaseRate for update field PRICE_SCALE after change currency base rate.

public static handlerAfterUpdateCurrencyBaseRate(Event $event) : void
Parameters
$event : Event

Event data (old and new currency rate).

loadRoundRules()

Load round rules list for price types.

public static loadRoundRules(array<string|int, mixed> $priceTypes) : void
Parameters
$priceTypes : array<string|int, mixed>

Price type ids.

roundPrice()

Round price.

public static roundPrice(int $priceType, float|int $price, string $currency) : float|int
Parameters
$priceType : int

Price type id.

$price : float|int

Price value.

$currency : string

Currency.

Return values
float|int

roundValue()

Round value with arbitrary precision.

public static roundValue(float|int $value, float|int $precision, int $type) : float|int
Parameters
$value : float|int

Round value.

$precision : float|int

Precision.

$type : int

Round type.

Return values
float|int

searchRoundRule()

Get rule for price value.

public static searchRoundRule(int $priceType, float|int $price[, string $currency = '' ]) : array<string|int, mixed>
Parameters
$priceType : int

Price type id.

$price : float|int

Price value.

$currency : string = ''

Price currency.

Return values
array<string|int, mixed>

        
On this page

Search results