Bitrix API

BasketReservationHistoryService

Service for working with the history of basket reserves

Table of Contents

Methods

__construct()  : mixed
add()  : Result
Add history row
addByReservation()  : Result
Add history row by reservation
delete()  : Result
Delete history row
deleteByReservation()  : Result
Delete history rows by reservation.
getAvailableCountForBasketItem()  : float
The available amount to be debited based on the reservation history.
getAvailableCountForBasketItems()  : array<string|int, mixed>
The available amount to be debited based on the reservation history.
getAvailableCountForOrder()  : array<string|int, mixed>
The available amount to be debited based on the reservation history.
getQuantityByReservation()  : float
Total reserved quantity by reservation history
update()  : Result
Update history row
updateByReservation()  : Result
Update history row by reservation

Methods

add()

Add history row

public add(array<string|int, mixed> $fields) : Result
Parameters
$fields : array<string|int, mixed>
Return values
Result

addByReservation()

Add history row by reservation

public addByReservation(int $reservationId) : Result
Parameters
$reservationId : int
Return values
Result

deleteByReservation()

Delete history rows by reservation.

public deleteByReservation(int $reservationId) : Result

All related rows will be deleted!

Parameters
$reservationId : int
Return values
Result

getAvailableCountForBasketItem()

The available amount to be debited based on the reservation history.

public getAvailableCountForBasketItem(int $basketId, int $storeId) : float

Example 1, there are 100pcs of product A in stock, then:

  1. Deal #1 - 80pcs reserved;
  2. Deal #2 - 40pcs reserved;
  3. Deal #1 - the reserve has been changed from 80pcs to 90pcs - in this situation, another record with a reserve of 10pcs is added to the history.

Thus, deal #1 can write off only 80pcs (because 10pcs were reserved after deal #2), and deal #2 only 20pcs (because they were reserved after deal #1).

Example 2, there are 100pcs of product A in stock, then:

  1. Deal #1 - 40pcs reserved;
  2. Deal #2 - 50pcs reserved;

Thus, deal #1 can write off 50pcs (40 reserved + 10 non-reserved store balance), and deal #2 60pcs (50 reserved + 10 non-reserved store balance).

Parameters
$basketId : int
$storeId : int
Return values
float

avaiable quantity

getAvailableCountForBasketItems()

The available amount to be debited based on the reservation history.

public getAvailableCountForBasketItems(array<string|int, mixed> $basketItemFilter) : array<string|int, mixed>
Parameters
$basketItemFilter : array<string|int, mixed>

filter for BasketTable tablet.

Tags
see
example

in getAvailableCountForBasketItem method

Return values
array<string|int, mixed>

in format $ret[$productId][$storeId]; // avaiableQuantity

getAvailableCountForOrder()

The available amount to be debited based on the reservation history.

public getAvailableCountForOrder(int $orderId) : array<string|int, mixed>
Parameters
$orderId : int
Tags
see
example

in getAvailableCountForBasketItem method

Return values
array<string|int, mixed>

in format $ret[$productId][$storeId]; // avaiableQuantity

getQuantityByReservation()

Total reserved quantity by reservation history

public getQuantityByReservation(int $reservationId) : float
Parameters
$reservationId : int
Return values
float

update()

Update history row

public update(int $id, array<string|int, mixed> $fields) : Result
Parameters
$id : int
$fields : array<string|int, mixed>
Return values
Result

updateByReservation()

Update history row by reservation

public updateByReservation(int $reservationId) : Result
Parameters
$reservationId : int
Return values
Result

        
On this page

Search results