Bitrix API

Manager

FinalYes

Table of Contents

Methods

disableExistenceDiscountsWithGift()  : void
Disables existence discount with gift.
enableExistenceDiscountsWithGift()  : void
Enables existence discount with gift.
existsDiscountsWithGift()  : bool
Returns true if exists discount with gift.
getCollectionsByBasket()  : array<string|int, mixed>
Returns list of collections with gifts by basket.
getCollectionsByProduct()  : array<string|int, mixed>|null
Returns list of collections with gifts by product and some basket.
getInstance()  : Manager
Returns Singleton of Manager
getUserId()  : int
isContainGiftAction()  : bool
Returns true if the discount contains action with gift.
isGift()  : bool|null
Returns true if the product is gift for basket.
setUserId()  : $this

Methods

disableExistenceDiscountsWithGift()

Disables existence discount with gift.

public disableExistenceDiscountsWithGift() : void

enableExistenceDiscountsWithGift()

Enables existence discount with gift.

public enableExistenceDiscountsWithGift() : void

existsDiscountsWithGift()

Returns true if exists discount with gift.

public existsDiscountsWithGift() : bool
Tags
throws
ArgumentNullException
Return values
bool

getCollectionsByBasket()

Returns list of collections with gifts by basket.

public getCollectionsByBasket(Basket $basket[, array<string|int, mixed>|null $discounts = null ][, array<string|int, mixed>|null $appliedDiscounts = null ]) : array<string|int, mixed>

For performance you may set arguments $discounts and $appliedDiscounts, which respond to basket.

Parameters
$basket : Basket

Target basket.

$discounts : array<string|int, mixed>|null = null

List of all discounts for basket, which already succeed conditions.

$appliedDiscounts : array<string|int, mixed>|null = null

List of all discounts for basket, which already applied to basket.

Return values
array<string|int, mixed>

getCollectionsByProduct()

Returns list of collections with gifts by product and some basket.

public getCollectionsByProduct(Basket $basket, array<string|int, mixed> $product) : array<string|int, mixed>|null

If basket does not contain product, then we calculate gifts without the product. After we add the product to basket, calculate gifts and comparing with previous gifts. If there is difference, then the method returns gifts with the product, else the method returns empty array.

Parameters
$basket : Basket

Target basket.

$product : array<string|int, mixed>

Array which describes product (@see isValidProduct()).

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

getUserId()

public getUserId() : int
Return values
int

isContainGiftAction()

Returns true if the discount contains action with gift.

public isContainGiftAction(array<string|int, mixed> $discount) : bool
Parameters
$discount : array<string|int, mixed>

Discount.

Return values
bool

isGift()

Returns true if the product is gift for basket.

public isGift(Basket $basket, array<string|int, mixed> $product) : bool|null
Parameters
$basket : Basket

Target basket.

$product : array<string|int, mixed>

Array which describes product (@see isValidProduct()).

Return values
bool|null

setUserId()

public setUserId(int $userId) : $this
Parameters
$userId : int
Return values
$this

        
On this page

Search results