Config.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Sales total nodes config model
  8. */
  9. namespace Magento\Sales\Model;
  10. class Config implements \Magento\Sales\Model\ConfigInterface
  11. {
  12. /**
  13. * Modules configuration model
  14. *
  15. * @var \Magento\Sales\Model\Config\Data
  16. */
  17. protected $_dataContainer;
  18. /**
  19. * @var \Magento\Framework\App\State
  20. */
  21. protected $_appState;
  22. /**
  23. * @param \Magento\Sales\Model\Config\Data $dataContainer
  24. * @param \Magento\Framework\App\State $appState
  25. */
  26. public function __construct(\Magento\Sales\Model\Config\Data $dataContainer, \Magento\Framework\App\State $appState)
  27. {
  28. $this->_dataContainer = $dataContainer;
  29. $this->_appState = $appState;
  30. }
  31. /**
  32. * Retrieve renderer for area from config
  33. *
  34. * @param string $section
  35. * @param string $group
  36. * @param string $code
  37. * @return array
  38. */
  39. public function getTotalsRenderer($section, $group, $code)
  40. {
  41. $path = implode('/', [$section, $group, $code, 'renderers', $this->_appState->getAreaCode()]);
  42. return $this->_dataContainer->get($path);
  43. }
  44. /**
  45. * Retrieve totals for group
  46. * e.g. quote, etc
  47. *
  48. * @param string $section
  49. * @param string $group
  50. * @return array
  51. */
  52. public function getGroupTotals($section, $group)
  53. {
  54. $path = implode('/', [$section, $group]);
  55. return $this->_dataContainer->get($path);
  56. }
  57. /**
  58. * Get available product types
  59. *
  60. * @return array
  61. */
  62. public function getAvailableProductTypes()
  63. {
  64. return $this->_dataContainer->get('order/available_product_types');
  65. }
  66. }