DefaultTotal.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Checkout\Block\Total;
  7. /**
  8. * Default Total Row Renderer
  9. */
  10. class DefaultTotal extends \Magento\Checkout\Block\Cart\Totals
  11. {
  12. /**
  13. * @var string
  14. */
  15. protected $_template = 'Magento_Checkout::total/default.phtml';
  16. /**
  17. * @var \Magento\Store\Model\Store
  18. */
  19. protected $_store;
  20. /**
  21. * @return void
  22. */
  23. protected function _construct()
  24. {
  25. parent::_construct();
  26. $this->_store = $this->_storeManager->getStore();
  27. }
  28. /**
  29. * Get style assigned to total object
  30. *
  31. * @return string
  32. */
  33. public function getStyle()
  34. {
  35. return $this->getTotal()->getStyle();
  36. }
  37. /**
  38. * @param float $total
  39. * @return $this
  40. */
  41. public function setTotal($total)
  42. {
  43. $this->setData('total', $total);
  44. if ($total->getAddress()) {
  45. $this->_store = $total->getAddress()->getQuote()->getStore();
  46. }
  47. return $this;
  48. }
  49. /**
  50. * @return \Magento\Store\Model\Store
  51. */
  52. public function getStore()
  53. {
  54. return $this->_store;
  55. }
  56. }