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-sales
Block
Adminhtml
Order
Totalbar.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Sales\Block\Adminhtml\Order
;
7
16
class
Totalbar
extends
\Magento\Sales\Block\Adminhtml\Order\AbstractOrder
17
{
23
protected
$_totals
= [];
24
31
protected
function
_beforeToHtml
()
32
{
33
if
(!$this->
getParentBlock
()) {
34
throw
new \Magento\Framework\Exception\LocalizedException(
35
__
(
'Please correct the parent block for this block.'
)
36
);
37
}
38
$this->setOrder($this->
getParentBlock
()->
getOrder
());
39
$this->setSource($this->
getParentBlock
()->getSource());
40
$this->setCurrency($this->
getParentBlock
()->
getOrder
()->getOrderCurrency());
41
42
foreach
($this->
getParentBlock
()->getOrderTotalbarData() as $v) {
43
$this->
addTotal
($v[0], $v[1], $v[2]);
44
}
45
46
parent::_beforeToHtml();
47
}
48
54
protected
function
getTotals
()
55
{
56
return
$this->_totals
;
57
}
58
67
public
function
addTotal
(
$label
,
$value
, $grand =
false
)
68
{
69
$this->_totals[] = [
'label'
=>
$label
,
'value'
=>
$value
,
'grand'
=> $grand];
70
return
$this;
71
}
72
}
Magento\Framework\View\Element\AbstractBlock\getParentBlock
getParentBlock()
Definition:
AbstractBlock.php:251
Magento\Sales\Block\Adminhtml\Order\Totalbar
Definition:
Totalbar.php:16
Magento\Sales\Block\Adminhtml\Order\Totalbar\_beforeToHtml
_beforeToHtml()
Definition:
Totalbar.php:31
__
__()
Definition:
__.php:13
$label
$label
Definition:
details.phtml:21
$value
$value
Definition:
gender.phtml:16
Magento\Sales\Block\Adminhtml\Order\Totalbar\getTotals
getTotals()
Definition:
Totalbar.php:54
Magento\Sales\Block\Adminhtml\Order\Totalbar\addTotal
addTotal($label, $value, $grand=false)
Definition:
Totalbar.php:67
Magento\Sales\Block\Adminhtml\Order
Magento\Sales\Block\Adminhtml\Order\AbstractOrder\getOrder
getOrder()
Definition:
AbstractOrder.php:56
Magento\Sales\Block\Adminhtml\Order\Totalbar\$_totals
$_totals
Definition:
Totalbar.php:23