Subtotal.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Tax\Block\Checkout;
  7. /**
  8. * Subtotal Total Row Renderer
  9. */
  10. class Subtotal extends \Magento\Checkout\Block\Total\DefaultTotal
  11. {
  12. /**
  13. * Template path
  14. *
  15. * @var string
  16. */
  17. protected $_template = 'Magento_Tax::checkout/subtotal.phtml';
  18. /**
  19. * @var \Magento\Tax\Model\Config
  20. */
  21. protected $_taxConfig;
  22. /**
  23. * @param \Magento\Framework\View\Element\Template\Context $context
  24. * @param \Magento\Customer\Model\Session $customerSession
  25. * @param \Magento\Checkout\Model\Session $checkoutSession
  26. * @param \Magento\Sales\Model\Config $salesConfig
  27. * @param \Magento\Tax\Model\Config $taxConfig
  28. * @param array $layoutProcessors
  29. * @param array $data
  30. */
  31. public function __construct(
  32. \Magento\Framework\View\Element\Template\Context $context,
  33. \Magento\Customer\Model\Session $customerSession,
  34. \Magento\Checkout\Model\Session $checkoutSession,
  35. \Magento\Sales\Model\Config $salesConfig,
  36. \Magento\Tax\Model\Config $taxConfig,
  37. array $layoutProcessors = [],
  38. array $data = []
  39. ) {
  40. $this->_taxConfig = $taxConfig;
  41. parent::__construct($context, $customerSession, $checkoutSession, $salesConfig, $layoutProcessors, $data);
  42. $this->_isScopePrivate = true;
  43. }
  44. /**
  45. * @return bool
  46. */
  47. public function displayBoth()
  48. {
  49. return $this->_taxConfig->displayCartSubtotalBoth($this->getStore());
  50. }
  51. }