diff --git a/Block/Gtag.php b/Block/Gtag.php index 9fa3ebd..fd61755 100644 --- a/Block/Gtag.php +++ b/Block/Gtag.php @@ -7,6 +7,7 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\View\Element\Template; use Magento\Framework\View\Element\Template\Context; +use Magento\Store\Model\ScopeInterface; use Taggrs\DataLayer\Helper\QuoteDataHelper; /** @@ -42,7 +43,7 @@ public function __construct( */ public function getGtmCode(): ?string { - $gtmCode = $this->_scopeConfig->getValue('taggrs_datalayer/gtm/gtm_code'); + $gtmCode = $this->_scopeConfig->getValue('taggrs_datalayer/gtm/gtm_code', ScopeInterface::SCOPE_STORE); return is_string($gtmCode) ? trim($gtmCode) : null; } @@ -54,7 +55,7 @@ public function getGtmCode(): ?string */ public function getGtmUrl(): string { - if ($gtmUrl = $this->_scopeConfig->getValue('taggrs_datalayer/gtm/gtm_url')) { + if ($gtmUrl = $this->_scopeConfig->getValue('taggrs_datalayer/gtm/gtm_url', ScopeInterface::SCOPE_STORE)) { return $gtmUrl; } @@ -68,7 +69,7 @@ public function getGtmUrl(): string */ public function isDebugMode(): bool { - return (bool)$this->_scopeConfig->getValue('taggrs_datalayer/gtm/debug_mode'); + return (bool)$this->_scopeConfig->getValue('taggrs_datalayer/gtm/debug_mode', ScopeInterface::SCOPE_STORE); } /** @@ -103,7 +104,7 @@ public function getCurrency(): ?string public function getAjaxEventsConfig(): string { return json_encode([ - 'remove_from_cart' => (bool)$this->_scopeConfig->getValue('taggrs_datalayer/events/remove_from_cart'), + 'remove_from_cart' => (bool)$this->_scopeConfig->getValue('taggrs_datalayer/events/remove_from_cart', ScopeInterface::SCOPE_STORE), ]); } } diff --git a/Block/NoScript.php b/Block/NoScript.php index 3040ca7..5f2fbaa 100644 --- a/Block/NoScript.php +++ b/Block/NoScript.php @@ -5,6 +5,7 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\View\Element\Template; use Magento\Framework\View\Element\Template\Context; +use Magento\Store\Model\ScopeInterface; use Taggrs\DataLayer\Helper\QuoteDataHelper; /** @@ -19,7 +20,7 @@ class NoScript extends Template */ public function getGtmUrl(): string { - if ($gtmUrl = $this->_scopeConfig->getValue('taggrs_datalayer/gtm/gtm_url')) { + if ($gtmUrl = $this->_scopeConfig->getValue('taggrs_datalayer/gtm/gtm_url', ScopeInterface::SCOPE_STORE)) { return $gtmUrl; } @@ -33,7 +34,7 @@ public function getGtmUrl(): string */ public function getGtmCode(): ?string { - $gtmCode = $this->_scopeConfig->getValue('taggrs_datalayer/gtm/gtm_code'); + $gtmCode = $this->_scopeConfig->getValue('taggrs_datalayer/gtm/gtm_code', ScopeInterface::SCOPE_STORE); return is_string($gtmCode) ? trim($gtmCode) : null; }