22 private int $productId;
23 private ?
float $purchasePrice;
24 private ?
string $purchasePriceCurrency;
25 private ?
float $basePrice;
26 private ?
string $basePriceCurrency;
37 ?
float $purchasePrice,
38 ?
string $purchasePriceCurrency,
39 ?
float $basePrice =
null,
40 ?
string $basePriceCurrency =
null
43 $this->productId = $productId;
44 $this->purchasePrice = $purchasePrice;
45 $this->purchasePriceCurrency = $purchasePriceCurrency;
46 $this->basePrice = $basePrice;
47 $this->basePriceCurrency = $basePriceCurrency;
58 private function getDefaultCurrency(): string
66 elseif (Loader::includeModule(
'currency'))
68 $currency = CurrencyManager::getBaseCurrency();
72 $currency = LANGUAGE_ID ===
'ru' ?
'RUB' :
'EUR';
83 private function getBasePriceRowId(): ?int
90 '=PRODUCT_ID' => $this->productId,
91 '=CATALOG_GROUP_ID' => $this->getBasePriceGroupId(),
97 return $row[
'ID'] ??
null;
105 private function getBasePriceGroupId(): ?int
125 if (isset($this->purchasePrice))
128 'PURCHASING_PRICE' => $this->purchasePrice ?:
null,
129 'PURCHASING_CURRENCY' => $this->purchasePriceCurrency ?? $this->getDefaultCurrency(),
131 if (!$saveResult->isSuccess())
134 $saveResult->getErrors()
139 if (isset($this->basePrice))
141 $basePriceRowId = $this->getBasePriceRowId();
145 'PRICE' => $this->basePrice,
146 'CURRENCY' => $this->basePriceCurrency,
152 'PRODUCT_ID' => $this->productId,
153 'CATALOG_GROUP_ID' => $this->getBasePriceGroupId(),
154 'PRICE' => $this->basePrice,
155 'CURRENCY' => $this->basePriceCurrency ?? $this->getDefaultCurrency(),
159 if (!$saveResult->isSuccess())
162 $saveResult->getErrors()
static getRow(array $parameters)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)