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
Render
PriceBox.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Catalog\Pricing\Render
;
7
8
use
Magento\Catalog\Model\Product
;
9
use
Magento\Framework\Json\Helper\Data
;
10
use
Magento\Framework\Math\Random
;
11
use
Magento\Framework\Pricing\Price\PriceInterface
;
12
use
Magento\Framework\Pricing\Render\PriceBox
as PriceBoxRender;
13
use
Magento\Framework\Pricing\Render\RendererPool
;
14
use
Magento\Framework\View\Element\Template\Context
;
15
22
class
PriceBox
extends
PriceBoxRender
23
{
27
protected
$jsonHelper
;
28
32
protected
$mathRandom
;
33
44
public
function
__construct
(
45
Context
$context,
46
Product
$saleableItem
,
47
PriceInterface
$price
,
48
RendererPool
$rendererPool
,
49
Data
$jsonHelper
,
50
Random
$mathRandom
,
51
array
$data
= []
52
) {
53
$this->jsonHelper =
$jsonHelper
;
54
$this->mathRandom =
$mathRandom
;
55
parent::__construct($context,
$saleableItem
,
$price
,
$rendererPool
);
56
}
57
64
public
function
jsonEncode
($valueToEncode)
65
{
66
return
$this->jsonHelper->jsonEncode($valueToEncode);
67
}
68
76
public
function
getRandomString
($length, $chars =
null
)
77
{
78
return
$this->mathRandom->getRandomString($length, $chars);
79
}
80
88
public
function
getCanDisplayQty
(
Product
$product
)
89
{
90
//TODO Refactor - change to const similar to Model\Product\Type\Grouped::TYPE_CODE
91
if
(
$product
->getTypeId() ==
'grouped'
) {
92
return
false
;
93
}
94
return
true
;
95
}
96
}
Magento\Framework\Pricing\Render\PriceBox\$saleableItem
$saleableItem
Definition:
PriceBox.php:29
Magento\Catalog\Pricing\Render\PriceBox\$jsonHelper
$jsonHelper
Definition:
PriceBox.php:27
Magento\Framework\Json\Helper\Data
Definition:
Data.php:13
Magento\Catalog\Pricing\Render\PriceBox\$mathRandom
$mathRandom
Definition:
PriceBox.php:32
Magento\Framework\View\Element\Template\Context
Definition:
Context.php:23
Magento\Framework\Pricing\Render\PriceBox
Definition:
PriceBox.php:21
Magento\Framework\Pricing\Render\PriceBox\$rendererPool
$rendererPool
Definition:
PriceBox.php:39
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Catalog\Pricing\Render
Magento\Catalog\Model\Product
Definition:
Product.php:42
Magento\Catalog\Pricing\Render\PriceBox
Definition:
PriceBox.php:22
Magento\Catalog\Model\Product
Definition:
ActionTest.php:6
Magento\Framework\Pricing\Render\PriceBox\$price
$price
Definition:
PriceBox.php:34
Magento\Framework\Math\Random
Definition:
Random.php:17
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Catalog\Pricing\Render\PriceBox\getCanDisplayQty
getCanDisplayQty(Product $product)
Definition:
PriceBox.php:88
Magento\Catalog\Pricing\Render\PriceBox\__construct
__construct(Context $context, Product $saleableItem, PriceInterface $price, RendererPool $rendererPool, Data $jsonHelper, Random $mathRandom, array $data=[])
Definition:
PriceBox.php:44
Magento\Catalog\Pricing\Render\PriceBox\jsonEncode
jsonEncode($valueToEncode)
Definition:
PriceBox.php:64
Magento\Catalog\Pricing\Render\PriceBox\getRandomString
getRandomString($length, $chars=null)
Definition:
PriceBox.php:76
Magento\Framework\Pricing\Price\PriceInterface
Definition:
PriceInterface.php:17
Magento\Framework\Pricing\Render\RendererPool
Definition:
RendererPool.php:18