Skip to content

Commit 35ab7e2

Browse files
ENGCOM-5919: Issue #24225 fixed: FPT / Tax Totals Sorting Not Correct #24663
2 parents 610752d + 7a8c830 commit 35ab7e2

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

app/code/Magento/Tax/Block/Sales/Order/Tax.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ protected function _addTax($after = 'discount')
106106
{
107107
$taxTotal = new \Magento\Framework\DataObject(['code' => 'tax', 'block_name' => $this->getNameInLayout()]);
108108
$totals = $this->getParentBlock()->getTotals();
109-
if ($totals['grand_total']) {
110-
$this->getParentBlock()->addTotalBefore($taxTotal, 'grand_total');
109+
if (isset($totals['grand_total_incl'])) {
110+
$this->getParentBlock()->addTotal($taxTotal, 'grand_total');
111111
}
112112
$this->getParentBlock()->addTotal($taxTotal, $after);
113113
return $this;
@@ -322,8 +322,8 @@ protected function _initGrandTotal()
322322
'label' => __('Grand Total (Incl.Tax)'),
323323
]
324324
);
325-
$parent->addTotal($totalExcl, 'grand_total');
326-
$parent->addTotal($totalIncl, 'tax');
325+
$parent->addTotal($totalIncl, 'grand_total');
326+
$parent->addTotal($totalExcl, 'tax');
327327
$this->_addTax('grand_total');
328328
}
329329
return $this;

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Weee\Block\Sales\Order;
77

88
/**
9+
* Wee tax total column block
10+
*
911
* @api
1012
* @since 100.0.2
1113
*/
@@ -54,6 +56,8 @@ public function initTotals()
5456
$weeeTotal = $this->weeeData->getTotalAmounts($items, $store);
5557
$weeeBaseTotal = $this->weeeData->getBaseTotalAmounts($items, $store);
5658
if ($weeeTotal) {
59+
$totals = $this->getParentBlock()->getTotals();
60+
5761
// Add our total information to the set of other totals
5862
$total = new \Magento\Framework\DataObject(
5963
[
@@ -63,10 +67,10 @@ public function initTotals()
6367
'base_value' => $weeeBaseTotal
6468
]
6569
);
66-
if ($this->getBeforeCondition()) {
67-
$this->getParentBlock()->addTotalBefore($total, $this->getBeforeCondition());
70+
if (isset($totals['grand_total_incl'])) {
71+
$this->getParentBlock()->addTotalBefore($total, 'grand_total');
6872
} else {
69-
$this->getParentBlock()->addTotal($total, $this->getAfterCondition());
73+
$this->getParentBlock()->addTotalBefore($total, $this->getBeforeCondition());
7074
}
7175
}
7276
return $this;

0 commit comments

Comments
 (0)