Skip to content

Commit 8d952c3

Browse files
author
madhu-ranosys
committed
label changes on Totals.php block
1 parent f9d9f8d commit 8d952c3

File tree

2 files changed

+14
-28
lines changed

2 files changed

+14
-28
lines changed

app/code/Magento/Sales/Block/Adminhtml/Order/Totals.php

100755100644
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,23 @@ protected function _initTotals()
4242
'area' => 'footer',
4343
]
4444
);
45-
$this->_totals['due'] = new \Magento\Framework\DataObject(
45+
$code = 'due';
46+
$label = 'Total Due';
47+
$value = $this->getSource()->getTotalDue();
48+
$baseValue = $this->getSource()->getBaseTotalDue();
49+
if ($this->getSource()->getTotalCanceled() > 0 && $this->getSource()->getBaseTotalCanceled() > 0) {
50+
$code = 'canceled';
51+
$label = 'Total Canceled';
52+
$value = $this->getSource()->getTotalCanceled();
53+
$baseValue = $this->getSource()->getBaseTotalCanceled();
54+
}
55+
$this->_totals[$code] = new \Magento\Framework\DataObject(
4656
[
4757
'code' => 'due',
4858
'strong' => true,
49-
'value' => $this->getSource()->getTotalDue(),
50-
'base_value' => $this->getSource()->getBaseTotalDue(),
51-
'label' => $this->getSource()->getTotalDueCancelLabel(),
59+
'value' => $value,
60+
'base_value' => $baseValue,
61+
'label' => __($label),
5262
'area' => 'footer',
5363
]
5464
);

app/code/Magento/Sales/Model/Order.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,30 +1817,6 @@ public function getTotalDue()
18171817
return max($total, 0);
18181818
}
18191819

1820-
/**
1821-
* Retrieve order total due or cancel label
1822-
*
1823-
* @return float|null
1824-
*/
1825-
public function getTotalDueCancelLabel()
1826-
{
1827-
$itemCancel = true;
1828-
foreach ($this->getAllItems() as $item) {
1829-
if ($item->getQtyCanceled() > 0) {
1830-
$itemCancel = false;
1831-
break;
1832-
}
1833-
}
1834-
if ($this->isCanceled() || $itemCancel == false) {
1835-
1836-
$label = __('Total Canceled');
1837-
} else {
1838-
1839-
$label = __('Total Due');
1840-
}
1841-
return $label;
1842-
}
1843-
18441820
/**
18451821
* Retrieve order total due value
18461822
*

0 commit comments

Comments
 (0)