Skip to content

Commit 6aed8d1

Browse files
committed
Tax in sales order email is displayed after grand total row
1 parent 6e534ad commit 6aed8d1

File tree

1 file changed

+21
-1
lines changed
  • app/code/Magento/Tax/Block/Sales/Order

1 file changed

+21
-1
lines changed

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use Magento\Sales\Model\Order;
1313

1414
/**
15+
* Tax totals modification block.
16+
*
1517
* @api
1618
* @since 100.0.2
1719
*/
@@ -84,7 +86,11 @@ public function initTotals()
8486
$allowTax = $this->_source->getTaxAmount() > 0 || $this->_config->displaySalesZeroTax($store);
8587
$grandTotal = (double)$this->_source->getGrandTotal();
8688
if (!$grandTotal || $allowTax && !$this->_config->displaySalesTaxWithGrandTotal($store)) {
87-
$this->_addTax();
89+
$taxTotal = new \Magento\Framework\DataObject(['code' => 'tax', 'block_name' => $this->getNameInLayout()]);
90+
$totals = $this->getParentBlock()->getTotals();
91+
if ($totals['grand_total']) {
92+
$this->getParentBlock()->addTotalBefore($taxTotal, 'grand_total');
93+
}
8894
}
8995

9096
$this->_initSubtotal();
@@ -118,6 +124,8 @@ public function getStore()
118124
}
119125

120126
/**
127+
* Initialization grand total.
128+
*
121129
* @return $this
122130
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
123131
*/
@@ -199,6 +207,8 @@ protected function _initSubtotal()
199207
}
200208

201209
/**
210+
* Init shipping.
211+
*
202212
* @return $this
203213
*/
204214
protected function _initShipping()
@@ -260,13 +270,17 @@ protected function _initShipping()
260270
}
261271

262272
/**
273+
* Init discount.
274+
*
263275
* @return void
264276
*/
265277
protected function _initDiscount()
266278
{
267279
}
268280

269281
/**
282+
* Init grand total.
283+
*
270284
* @return $this
271285
*/
272286
protected function _initGrandTotal()
@@ -311,6 +325,8 @@ protected function _initGrandTotal()
311325
}
312326

313327
/**
328+
* Return order.
329+
*
314330
* @return Order
315331
*/
316332
public function getOrder()
@@ -319,6 +335,8 @@ public function getOrder()
319335
}
320336

321337
/**
338+
* Return label properties.
339+
*
322340
* @return array
323341
*/
324342
public function getLabelProperties()
@@ -327,6 +345,8 @@ public function getLabelProperties()
327345
}
328346

329347
/**
348+
* Retuen value properties.
349+
*
330350
* @return array
331351
*/
332352
public function getValueProperties()

0 commit comments

Comments
 (0)