12
12
use Magento \Sales \Model \Order ;
13
13
14
14
/**
15
+ * Tax totals modification block.
16
+ *
15
17
* @api
16
18
* @since 100.0.2
17
19
*/
@@ -84,7 +86,11 @@ public function initTotals()
84
86
$ allowTax = $ this ->_source ->getTaxAmount () > 0 || $ this ->_config ->displaySalesZeroTax ($ store );
85
87
$ grandTotal = (double )$ this ->_source ->getGrandTotal ();
86
88
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
+ }
88
94
}
89
95
90
96
$ this ->_initSubtotal ();
@@ -118,6 +124,8 @@ public function getStore()
118
124
}
119
125
120
126
/**
127
+ * Initialization grand total.
128
+ *
121
129
* @return $this
122
130
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
123
131
*/
@@ -199,6 +207,8 @@ protected function _initSubtotal()
199
207
}
200
208
201
209
/**
210
+ * Init shipping.
211
+ *
202
212
* @return $this
203
213
*/
204
214
protected function _initShipping ()
@@ -260,13 +270,17 @@ protected function _initShipping()
260
270
}
261
271
262
272
/**
273
+ * Init discount.
274
+ *
263
275
* @return void
264
276
*/
265
277
protected function _initDiscount ()
266
278
{
267
279
}
268
280
269
281
/**
282
+ * Init grand total.
283
+ *
270
284
* @return $this
271
285
*/
272
286
protected function _initGrandTotal ()
@@ -311,6 +325,8 @@ protected function _initGrandTotal()
311
325
}
312
326
313
327
/**
328
+ * Return order.
329
+ *
314
330
* @return Order
315
331
*/
316
332
public function getOrder ()
@@ -319,6 +335,8 @@ public function getOrder()
319
335
}
320
336
321
337
/**
338
+ * Return label properties.
339
+ *
322
340
* @return array
323
341
*/
324
342
public function getLabelProperties ()
@@ -327,6 +345,8 @@ public function getLabelProperties()
327
345
}
328
346
329
347
/**
348
+ * Retuen value properties.
349
+ *
330
350
* @return array
331
351
*/
332
352
public function getValueProperties ()
0 commit comments