Skip to content

Commit 825fcb1

Browse files
Fixed frontend tax sorting issue and on order email.
1 parent adcbfdd commit 825fcb1

File tree

8 files changed

+13
-11
lines changed

8 files changed

+13
-11
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ 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']) {
109+
if (isset($totals['grand_total_incl'])) {
110110
$this->getParentBlock()->addTotal($taxTotal, 'grand_total');
111111
}
112112
$this->getParentBlock()->addTotal($taxTotal, $after);
@@ -319,8 +319,8 @@ protected function _initGrandTotal()
319319
'label' => __('Grand Total (Incl.Tax)'),
320320
]
321321
);
322-
$parent->addTotal($totalExcl, 'grand_total');
323322
$parent->addTotal($totalIncl, 'grand_total');
323+
$parent->addTotal($totalExcl, 'tax');
324324
$this->_addTax('grand_total');
325325
}
326326
return $this;

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public function initTotals()
5454
$weeeTotal = $this->weeeData->getTotalAmounts($items, $store);
5555
$weeeBaseTotal = $this->weeeData->getBaseTotalAmounts($items, $store);
5656
if ($weeeTotal) {
57+
$totals = $this->getParentBlock()->getTotals();
58+
5759
// Add our total information to the set of other totals
5860
$total = new \Magento\Framework\DataObject(
5961
[
@@ -63,10 +65,10 @@ public function initTotals()
6365
'base_value' => $weeeBaseTotal
6466
]
6567
);
66-
if ($this->getBeforeCondition()) {
67-
$this->getParentBlock()->addTotalBefore($total, $this->getBeforeCondition());
68+
if (isset($totals['grand_total_incl'])) {
69+
$this->getParentBlock()->addTotalBefore($total, 'grand_total');
6870
} else {
69-
$this->getParentBlock()->addTotal($total, $this->getAfterCondition());
71+
$this->getParentBlock()->addTotalBefore($total, $this->getBeforeCondition());
7072
}
7173
}
7274
return $this;

app/code/Magento/Weee/view/adminhtml/layout/sales_order_creditmemo_new.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<referenceBlock name="creditmemo_totals">
1111
<block class="Magento\Weee\Block\Sales\Order\Totals" name="weee_cm_totals">
1212
<action method="setBeforeCondition">
13-
<argument name="condition" xsi:type="string">grand_total</argument>
13+
<argument name="condition" xsi:type="string">tax</argument>
1414
</action>
1515
</block>
1616
</referenceBlock>

app/code/Magento/Weee/view/adminhtml/layout/sales_order_creditmemo_view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<referenceBlock name="creditmemo_totals">
1111
<block class="Magento\Weee\Block\Sales\Order\Totals" name="weee_cm_totals">
1212
<action method="setBeforeCondition">
13-
<argument name="condition" xsi:type="string">grand_total</argument>
13+
<argument name="condition" xsi:type="string">tax</argument>
1414
</action>
1515
</block>
1616
</referenceBlock>

app/code/Magento/Weee/view/adminhtml/layout/sales_order_invoice_new.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<referenceBlock name="invoice_totals">
1111
<block class="Magento\Weee\Block\Sales\Order\Totals" name="weee_inv_totals">
1212
<action method="setBeforeCondition">
13-
<argument name="condition" xsi:type="string">grand_total</argument>
13+
<argument name="condition" xsi:type="string">tax</argument>
1414
</action>
1515
</block>
1616
</referenceBlock>

app/code/Magento/Weee/view/adminhtml/layout/sales_order_invoice_view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<referenceBlock name="invoice_totals">
1111
<block class="Magento\Weee\Block\Sales\Order\Totals" name="weee_inv_totals">
1212
<action method="setBeforeCondition">
13-
<argument name="condition" xsi:type="string">grand_total</argument>
13+
<argument name="condition" xsi:type="string">tax</argument>
1414
</action>
1515
</block>
1616
</referenceBlock>

app/code/Magento/Weee/view/adminhtml/layout/sales_order_view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<referenceBlock name="order_totals">
1111
<block class="Magento\Weee\Block\Sales\Order\Totals" name="weee_ord_totals">
1212
<action method="setBeforeCondition">
13-
<argument name="condition" xsi:type="string">grand_total</argument>
13+
<argument name="condition" xsi:type="string">tax</argument>
1414
</action>
1515
</block>
1616
</referenceBlock>

app/code/Magento/Weee/view/frontend/layout/sales_email_order_items.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<referenceBlock name="order_totals">
1111
<block class="Magento\Weee\Block\Sales\Order\Totals" name="weee_ord_totals">
1212
<action method="setBeforeCondition">
13-
<argument name="condition" xsi:type="string">tax</argument>
13+
<argument name="condition" xsi:type="string">grand_total</argument>
1414
</action>
1515
</block>
1616
</referenceBlock>

0 commit comments

Comments
 (0)