Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
batchmanager.php
1<?php
3
4use Bitrix\Catalog\EO_StoreBatch;
5use Bitrix\Catalog\EO_StoreBatch_Collection;
12
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
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}
calculateCostPrice(float $quantity, int $storeId, string $currency=null)
static getList(array $parameters=array())