Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Shipping.php
Go to the documentation of this file.
1 <?php
7 
12 {
18  protected $_template = 'Magento_Tax::checkout/shipping.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 displayBoth()
54  {
55  return $this->_taxConfig->displayCartShippingBoth($this->getStore());
56  }
57 
63  public function displayIncludeTax()
64  {
65  return $this->_taxConfig->displayCartShippingInclTax($this->getStore());
66  }
67 
73  public function getShippingIncludeTax()
74  {
75  return $this->getTotal()->getShippingInclTax();
76  }
77 
83  public function getShippingExcludeTax()
84  {
85  return $this->getTotal()->getValue();
86  }
87 
93  public function getIncludeTaxLabel()
94  {
95  return __(
96  'Shipping Incl. Tax (%1)',
97  $this->escapeHtml($this->getQuote()->getShippingAddress()->getShippingDescription())
98  );
99  }
100 
106  public function getExcludeTaxLabel()
107  {
108  return __(
109  'Shipping Excl. Tax (%1)',
110  $this->escapeHtml($this->getQuote()->getShippingAddress()->getShippingDescription())
111  );
112  }
113 
119  public function displayShipping()
120  {
121  if (!$this->getQuote()->getShippingAddress()->getShippingMethod()) {
122  return false;
123  }
124  return true;
125  }
126 }
__()
Definition: __.php:13
__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: Shipping.php:34