Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
batchmanager.php
1
<?php
2
namespace
Bitrix\Catalog\Product\Store
;
3
4
use Bitrix\Catalog\EO_StoreBatch;
5
use Bitrix\Catalog\EO_StoreBatch_Collection;
6
use
Bitrix\Catalog\StoreBatchTable
;
7
use
Bitrix\Currency\CurrencyManager
;
8
use
Bitrix\Main\ArgumentException
;
9
use
Bitrix\Main\Loader
;
10
use
Bitrix\Main\ObjectPropertyException
;
11
use
Bitrix\Main\SystemException
;
12
18
class
BatchManager
19
{
20
private
int
$productId;
21
22
public
function
__construct
(
int
$productId)
23
{
24
$this->productId = $productId;
25
}
26
30
public
function
getProductId
(): int
31
{
32
return
$this->productId;
33
}
34
44
public
function
getStoreCollection
(array $filter =
null
): EO_StoreBatch_Collection
45
{
46
$filter[
'=ELEMENT_ID'
] = $this->
getProductId
();
47
48
return
StoreBatchTable::getList
([
49
'filter'
=> $filter,
50
'order'
=> [
'ID'
=>
'ASC'
],
51
])
52
->fetchCollection()
53
;
54
}
55
65
public
function
getAvailableStoreCollection
(
int
$storeId): EO_StoreBatch_Collection
66
{
67
return
$this->
getStoreCollection
([
68
'>AVAILABLE_AMOUNT'
=> 0,
69
'=STORE_ID'
=> $storeId,
70
]);
71
}
72
82
public
function
calculateCostPrice
(
float
$quantity,
int
$storeId,
string
$currency =
null
): float
83
{
84
if
(empty($currency) && Loader::includeModule(
'currency'
))
85
{
86
$currency = CurrencyManager::getBaseCurrency();
87
}
88
89
return
(
new
CostPriceCalculator
($this))->calculate($quantity, $storeId, $currency);
90
}
91
}
Bitrix\Catalog\Product\Store\BatchManager
Definition
batchmanager.php:19
Bitrix\Catalog\Product\Store\BatchManager\getStoreCollection
getStoreCollection(array $filter=null)
Definition
batchmanager.php:44
Bitrix\Catalog\Product\Store\BatchManager\getProductId
getProductId()
Definition
batchmanager.php:30
Bitrix\Catalog\Product\Store\BatchManager\getAvailableStoreCollection
getAvailableStoreCollection(int $storeId)
Definition
batchmanager.php:65
Bitrix\Catalog\Product\Store\BatchManager\__construct
__construct(int $productId)
Definition
batchmanager.php:22
Bitrix\Catalog\Product\Store\BatchManager\calculateCostPrice
calculateCostPrice(float $quantity, int $storeId, string $currency=null)
Definition
batchmanager.php:82
Bitrix\Catalog\Product\Store\CostPriceCalculator
Definition
costpricecalculator.php:19
Bitrix\Catalog\StoreBatchTable
Definition
storebatchtable.php:27
Bitrix\Currency\CurrencyManager
Definition
currencymanager.php:15
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Definition
datamanager.php:441
Bitrix\Main\ObjectPropertyException
Definition
exception.php:181
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Catalog\Product\Store
modules
catalog
lib
product
store
batchmanager.php
Создано системой
1.10.0