Skip to content

Commit

Permalink
added SCOPE_STORE to scopeconfig for gtm codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joris Wagter committed Aug 8, 2024
1 parent d09f5d3 commit 04f81be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions Block/Gtag.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}

Expand All @@ -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);
}

/**
Expand Down Expand Up @@ -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),
]);
}
}
5 changes: 3 additions & 2 deletions Block/NoScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;
}

Expand All @@ -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;
}
Expand Down

0 comments on commit 04f81be

Please sign in to comment.