18 private $storeManager;
35 private $storesWithInvalidSettings;
44 \
Magento\Framework\UrlInterface $urlBuilder,
48 $this->urlBuilder = $urlBuilder;
49 $this->taxConfig = $taxConfig;
58 return 'TAX_NOTIFICATION_ROUNDING_ERRORS';
66 if (!$this->taxConfig->isWrongDisplaySettingsIgnored() && $this->getStoresWithWrongSettings()) {
79 if (!empty($this->getStoresWithWrongSettings()) && !$this->taxConfig->isWrongDisplaySettingsIgnored()) {
80 $messageDetails .=
'<strong>';
81 $messageDetails .=
__(
'Your current tax configuration may result in rounding errors. ');
82 $messageDetails .=
'</strong><p>';
83 $messageDetails .=
__(
'Store(s) affected: ');
84 $messageDetails .= implode(
', ', $this->getStoresWithWrongSettings());
85 $messageDetails .=
'</p><p>';
86 $messageDetails .=
__(
87 'Click on the link to <a href="%1">ignore this notification</a>',
88 $this->urlBuilder->getUrl(
'tax/tax/ignoreTaxNotification', [
'section' =>
'price_display'])
90 $messageDetails .=
"</p>";
93 return $messageDetails;
115 private function checkSettings(
$store =
null)
122 && !$this->taxConfig->displayCartPricesBoth(
$store)
123 && !$this->taxConfig->displayCartSubtotalBoth(
$store)
124 && !$this->taxConfig->displayCartShippingBoth(
$store)
125 && !$this->taxConfig->displaySalesPricesBoth(
$store)
126 && !$this->taxConfig->displaySalesSubtotalBoth(
$store)
127 && !$this->taxConfig->displaySalesShippingBoth(
$store);
136 private function getStoresWithWrongSettings()
138 if (
null !== $this->storesWithInvalidSettings) {
139 return $this->storesWithInvalidSettings;
141 $this->storesWithInvalidSettings = [];
142 $storeCollection = $this->storeManager->getStores(
true);
143 foreach ($storeCollection as
$store) {
144 if (!$this->checkSettings(
$store)) {
146 $this->storesWithInvalidSettings[] =
$website->getName() .
' (' .
$store->getName() .
')';
149 return $this->storesWithInvalidSettings;
__construct(\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Tax\Model\Config $taxConfig)