Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Grandtotal.php
Go to the documentation of this file.
1 <?php
7 
12 {
18  protected $_template = 'Magento_Tax::checkout/grandtotal.phtml';
19 
23  protected $_taxConfig;
24 
34  public function __construct(
35  \Magento\Framework\View\Element\Template\Context $context,
36  \Magento\Customer\Model\Session $customerSession,
37  \Magento\Checkout\Model\Session $checkoutSession,
38  \Magento\Sales\Model\Config $salesConfig,
39  \Magento\Tax\Model\Config $taxConfig,
40  array $layoutProcessors = [],
41  array $data = []
42  ) {
43  $this->_taxConfig = $taxConfig;
44  parent::__construct($context, $customerSession, $checkoutSession, $salesConfig, $layoutProcessors, $data);
45  $this->_isScopePrivate = true;
46  }
47 
53  public function includeTax()
54  {
55  if ($this->getTotal()->getValue()) {
56  return $this->_taxConfig->displayCartTaxWithGrandTotal($this->getStore());
57  }
58  return false;
59  }
60 
66  public function getTotalExclTax()
67  {
68  $excl = $this->getTotal()->getValue() - $this->_totals['tax']->getValue();
69  $excl = max($excl, 0);
70  return $excl;
71  }
72 }
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Sales\Model\Config $salesConfig, \Magento\Tax\Model\Config $taxConfig, array $layoutProcessors=[], array $data=[])
Definition: Grandtotal.php:34