Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Weee.php
Go to the documentation of this file.
1 <?php
7 
11 class Weee extends \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal
12 {
16  protected $_weeeData;
17 
25  public function __construct(
26  \Magento\Tax\Helper\Data $taxHelper,
27  \Magento\Tax\Model\Calculation $taxCalculation,
28  \Magento\Tax\Model\ResourceModel\Sales\Order\Tax\CollectionFactory $ordersFactory,
29  \Magento\Weee\Helper\Data $_weeeData,
30  array $data = []
31  ) {
32  $this->_weeeData = $_weeeData;
33  parent::__construct($taxHelper, $taxCalculation, $ordersFactory, $data);
34  }
35 
48  public function getTotalsForDisplay()
49  {
51  $items = $this->getSource()->getAllItems();
52  $store = $this->getSource()->getStore();
53 
54  $weeeTotal = $this->_weeeData->getTotalAmounts($items, $store);
55 
56  // If we have no Weee, check if we still need to display it
57  if (!$weeeTotal && !filter_var($this->getDisplayZero(), FILTER_VALIDATE_BOOLEAN)) {
58  return [];
59  }
60 
61  // Display the Weee total amount
62  $fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
63  $totals = [
64  [
65  'amount' => $this->getOrder()->formatPriceTxt($weeeTotal),
66  'label' => __($this->getTitle()) . ':',
67  'font_size' => $fontSize,
68  ],
69  ];
70 
71  return $totals;
72  }
73 }
__construct(\Magento\Tax\Helper\Data $taxHelper, \Magento\Tax\Model\Calculation $taxCalculation, \Magento\Tax\Model\ResourceModel\Sales\Order\Tax\CollectionFactory $ordersFactory, \Magento\Weee\Helper\Data $_weeeData, array $data=[])
Definition: Weee.php:25
__()
Definition: __.php:13
$totals
Definition: totalbar.phtml:10
$items