forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBasePrice.php
More file actions
39 lines (35 loc) · 968 Bytes
/
BasePrice.php
File metadata and controls
39 lines (35 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Pricing\Price;
use Magento\Framework\Pricing\Price\AbstractPrice;
use Magento\Framework\Pricing\Price\BasePriceProviderInterface;
/**
* Class BasePrice
*/
class BasePrice extends AbstractPrice
{
/**
* Price type identifier string
*/
const PRICE_CODE = 'base_price';
/**
* Get Base Price Value
*
* @return float|bool
*/
public function getValue()
{
if ($this->value === null) {
$this->value = false;
foreach ($this->priceInfo->getPrices() as $price) {
if ($price instanceof BasePriceProviderInterface && $price->getValue() !== false) {
$this->value = min($price->getValue(), $this->value !== false ? $this->value: $price->getValue());
}
}
}
return $this->value;
}
}