OrderIdentity.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Model\Order\Email\Container;
  7. class OrderIdentity extends Container implements IdentityInterface
  8. {
  9. /**
  10. * Configuration paths
  11. */
  12. const XML_PATH_EMAIL_COPY_METHOD = 'sales_email/order/copy_method';
  13. const XML_PATH_EMAIL_COPY_TO = 'sales_email/order/copy_to';
  14. const XML_PATH_EMAIL_IDENTITY = 'sales_email/order/identity';
  15. const XML_PATH_EMAIL_GUEST_TEMPLATE = 'sales_email/order/guest_template';
  16. const XML_PATH_EMAIL_TEMPLATE = 'sales_email/order/template';
  17. const XML_PATH_EMAIL_ENABLED = 'sales_email/order/enabled';
  18. /**
  19. * @return bool
  20. */
  21. public function isEnabled()
  22. {
  23. return $this->scopeConfig->isSetFlag(
  24. self::XML_PATH_EMAIL_ENABLED,
  25. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  26. $this->getStore()->getStoreId()
  27. );
  28. }
  29. /**
  30. * Return email copy_to list
  31. *
  32. * @return array|bool
  33. */
  34. public function getEmailCopyTo()
  35. {
  36. $data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId());
  37. if (!empty($data)) {
  38. return explode(',', $data);
  39. }
  40. return false;
  41. }
  42. /**
  43. * Return copy method
  44. *
  45. * @return mixed
  46. */
  47. public function getCopyMethod()
  48. {
  49. return $this->getConfigValue(self::XML_PATH_EMAIL_COPY_METHOD, $this->getStore()->getStoreId());
  50. }
  51. /**
  52. * Return guest template id
  53. *
  54. * @return mixed
  55. */
  56. public function getGuestTemplateId()
  57. {
  58. return $this->getConfigValue(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $this->getStore()->getStoreId());
  59. }
  60. /**
  61. * Return template id
  62. *
  63. * @return mixed
  64. */
  65. public function getTemplateId()
  66. {
  67. return $this->getConfigValue(self::XML_PATH_EMAIL_TEMPLATE, $this->getStore()->getStoreId());
  68. }
  69. /**
  70. * Return email identity
  71. *
  72. * @return mixed
  73. */
  74. public function getEmailIdentity()
  75. {
  76. return $this->getConfigValue(self::XML_PATH_EMAIL_IDENTITY, $this->getStore()->getStoreId());
  77. }
  78. }