Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-catalog
Pricing
Price
MinimalTierPriceCalculator.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Catalog\Pricing\Price
;
8
9
use
Magento\Framework\Pricing\SaleableInterface
;
10
use
Magento\Framework\Pricing\Adjustment\CalculatorInterface
;
11
use
Magento\Framework\Pricing\Amount\AmountInterface
;
12
16
class
MinimalTierPriceCalculator
implements
MinimalPriceCalculatorInterface
17
{
21
private
$calculator;
22
26
public
function
__construct
(
CalculatorInterface
$calculator)
27
{
28
$this->calculator = $calculator;
29
}
30
35
public
function
getValue
(
SaleableInterface
$saleableItem)
36
{
38
$price
= $saleableItem->
getPriceInfo
()->getPrice(
TierPrice::PRICE_CODE
);
39
$tierPriceList =
$price
->getTierPriceList();
40
41
$tierPrices
= [];
42
foreach
($tierPriceList as $tierPrice) {
44
$price
= $tierPrice[
'price'
];
45
$tierPrices
[] =
$price
->getValue();
46
}
47
48
return
$tierPrices
? min(
$tierPrices
) : null;
49
}
50
55
public
function
getAmount
(
SaleableInterface
$saleableItem)
56
{
57
$value
= $this->
getValue
($saleableItem);
58
59
return
$value
===
null
60
? null
61
: $this->calculator->getAmount(
$value
, $saleableItem);
62
}
63
}
Magento\Catalog\Pricing\Price\MinimalPriceCalculatorInterface
Definition:
MinimalPriceCalculatorInterface.php:15
Magento\Catalog\Pricing\Price\MinimalTierPriceCalculator\getAmount
getAmount(SaleableInterface $saleableItem)
Definition:
MinimalTierPriceCalculator.php:55
Magento\Framework\Pricing\SaleableInterface\getPriceInfo
getPriceInfo()
$price
$price
Definition:
product_alert.php:10
Magento\Catalog\Pricing\Price\TierPrice\PRICE_CODE
const PRICE_CODE
Definition:
TierPrice.php:28
$value
$value
Definition:
gender.phtml:16
Magento\Catalog\Pricing\Price\MinimalPriceCalculatorInterface\getValue
getValue(SaleableInterface $saleableItem)
Magento\Framework\Pricing\Amount\AmountInterface
Definition:
AmountInterface.php:15
Magento\Framework\Pricing\Adjustment\CalculatorInterface
Definition:
CalculatorInterface.php:17
Magento\Catalog\Pricing\Price\MinimalTierPriceCalculator\__construct
__construct(CalculatorInterface $calculator)
Definition:
MinimalTierPriceCalculator.php:26
Magento\Catalog\Pricing\Price\MinimalTierPriceCalculator
Definition:
MinimalTierPriceCalculator.php:16
Magento\Catalog\Pricing\Price
Definition:
BasePrice.php:7
Magento\Framework\Pricing\SaleableInterface
Definition:
SaleableInterface.php:15
$tierPrices
$tierPrices
Definition:
product_has_tier_price_show_as_low_as.php:14