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
framework
Pricing
Price
AbstractPrice.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Framework\Pricing\Price
;
8
9
use
Magento\Framework\Pricing\Adjustment\CalculatorInterface
;
10
use
Magento\Framework\Pricing\Amount\AmountInterface
;
11
use
Magento\Framework\Pricing\SaleableInterface
;
12
use
Magento\Framework\Pricing\PriceInfoInterface
;
13
21
abstract
class
AbstractPrice
implements
PriceInterface
22
{
26
const
PRICE_CODE
=
'abstract_price'
;
27
31
protected
$amount
;
32
36
protected
$calculator
;
37
41
protected
$product
;
42
46
protected
$priceType
;
47
51
protected
$quantity
;
52
56
protected
$priceInfo
;
57
61
protected
$value
;
62
66
protected
$priceCurrency
;
67
74
public
function
__construct
(
75
SaleableInterface
$saleableItem,
76
$quantity
,
77
CalculatorInterface
$calculator
,
78
\
Magento
\Framework\Pricing\
PriceCurrencyInterface
$priceCurrency
79
) {
80
$this->product = $saleableItem;
81
$this->quantity =
$quantity
;
82
$this->calculator =
$calculator
;
83
$this->priceCurrency =
$priceCurrency
;
84
$this->priceInfo = $saleableItem->
getPriceInfo
();
85
}
86
92
abstract
public
function
getValue
();
93
99
public
function
getAmount
()
100
{
101
if
(!isset($this->
amount
[$this->
getValue
()])) {
102
$this->
amount
[$this->
getValue
()] = $this->calculator->getAmount($this->
getValue
(), $this->
getProduct
());
103
}
104
return
$this->
amount
[$this->
getValue
()];
105
}
106
113
public
function
getCustomAmount
(
$amount
=
null
, $exclude =
null
, $context = [])
114
{
115
if
(
null
!==
$amount
) {
116
$amount
= $this->priceCurrency->convertAndRound(
$amount
);
117
}
else
{
118
$amount
= $this->
getValue
();
119
}
120
return
$this->calculator->getAmount(
$amount
, $this->
getProduct
(), $exclude, $context);
121
}
122
128
public
function
getPriceCode
()
129
{
130
return
static::PRICE_CODE;
131
}
132
136
public
function
getProduct
()
137
{
138
return
$this->product
;
139
}
140
144
public
function
getQuantity
()
145
{
146
return
$this->quantity
;
147
}
148
}
amount
if( $block->displayPriceExclTax()||$block->displayBothPrices())(__('Excl. Tax')) ?>"> <?php if ($block -> displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" data-mage-init=' Magento Weee Helper Data Magento Weee Helper Data title amount
Definition:
unit.phtml:68
Magento\Framework\Pricing\Price\AbstractPrice\getPriceCode
getPriceCode()
Definition:
AbstractPrice.php:128
Magento\Framework\Pricing\Price\AbstractPrice\$amount
$amount
Definition:
AbstractPrice.php:31
Magento\Framework\Pricing\Price\AbstractPrice\__construct
__construct(SaleableInterface $saleableItem, $quantity, CalculatorInterface $calculator, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency)
Definition:
AbstractPrice.php:74
Magento\Framework\Pricing\SaleableInterface\getPriceInfo
getPriceInfo()
Magento\Framework\Pricing\Price\AbstractPrice\$priceCurrency
$priceCurrency
Definition:
AbstractPrice.php:66
Magento\Framework\Pricing\Price\AbstractPrice\getProduct
getProduct()
Definition:
AbstractPrice.php:136
Magento\Framework\Pricing\Price\AbstractPrice
Definition:
AbstractPrice.php:21
Magento\Framework\Pricing\Price\AbstractPrice\$value
$value
Definition:
AbstractPrice.php:61
Magento\Framework\Pricing\Price\AbstractPrice\$priceInfo
$priceInfo
Definition:
AbstractPrice.php:56
Magento\Framework\Pricing\Price\AbstractPrice\$priceType
$priceType
Definition:
AbstractPrice.php:46
Magento\Framework\Pricing\PriceCurrencyInterface
Definition:
PriceCurrencyInterface.php:15
Magento\Framework\Pricing\PriceInfoInterface
Definition:
PriceInfoInterface.php:18
Magento\Framework\Pricing\Price\AbstractPrice\getCustomAmount
getCustomAmount($amount=null, $exclude=null, $context=[])
Definition:
AbstractPrice.php:113
Magento\Framework\Pricing\Amount\AmountInterface
Definition:
AmountInterface.php:15
Magento\Framework\Pricing\Adjustment\CalculatorInterface
Definition:
CalculatorInterface.php:17
Magento\Framework\Pricing\Price
Definition:
AbstractPrice.php:7
Magento\Framework\Pricing\Price\AbstractPrice\PRICE_CODE
const PRICE_CODE
Definition:
AbstractPrice.php:26
Magento
Magento\Framework\Pricing\Price\AbstractPrice\$quantity
$quantity
Definition:
AbstractPrice.php:51
Magento\Framework\Pricing\Price\AbstractPrice\getAmount
getAmount()
Definition:
AbstractPrice.php:99
Magento\Framework\Pricing\Price\AbstractPrice\getQuantity
getQuantity()
Definition:
AbstractPrice.php:144
Magento\Framework\Pricing\Price\AbstractPrice\$product
$product
Definition:
AbstractPrice.php:41
Magento\Framework\Pricing\SaleableInterface
Definition:
SaleableInterface.php:15
Magento\Framework\Pricing\Price\AbstractPrice\$calculator
$calculator
Definition:
AbstractPrice.php:36
Magento\Framework\Pricing\Price\AbstractPrice\getValue
getValue()
Magento\Framework\Pricing\Price\PriceInterface
Definition:
PriceInterface.php:17