Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ValidationMessage.php
Go to the documentation of this file.
1 <?php
7 
9 {
13  private $storeManager;
14 
18  private $scopeConfig;
19 
24  private $currency;
25 
29  private $priceHelper;
30 
37  public function __construct(
38  \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
39  \Magento\Store\Model\StoreManagerInterface $storeManager,
40  \Magento\Framework\Locale\CurrencyInterface $currency,
41  \Magento\Framework\Pricing\Helper\Data $priceHelper = null
42  ) {
43  $this->scopeConfig = $scopeConfig;
44  $this->storeManager = $storeManager;
45  $this->currency = $currency;
46  $this->priceHelper = $priceHelper ?: \Magento\Framework\App\ObjectManager::getInstance()
47  ->get(\Magento\Framework\Pricing\Helper\Data::class);
48  }
49 
56  public function getMessage()
57  {
58  $message = $this->scopeConfig->getValue(
59  'sales/minimum_order/description',
61  );
62  if (!$message) {
63  $minimumAmount = $this->priceHelper->currency($this->scopeConfig->getValue(
64  'sales/minimum_order/amount',
66  ), true, false);
67 
68  $message = __('Minimum order amount is %1', $minimumAmount);
69  } else {
70  //Added in order to address the issue: https://github.com/magento/magento2/issues/8287
71  $message = __($message);
72  }
73 
74  return $message;
75  }
76 }
__construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Locale\CurrencyInterface $currency, \Magento\Framework\Pricing\Helper\Data $priceHelper=null)
$storeManager
__()
Definition: __.php:13
$message