Skip to content

Commit

Permalink
Merge pull request #217 from collabpl/bugfix/GH-216-Cookie_Restrictio…
Browse files Browse the repository at this point in the history
…n_Fixes

GH-216
  • Loading branch information
jissereitsma authored Feb 27, 2024
2 parents cfac4c2 + e8b1b43 commit d505505
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ public function getCookieRestrictionModeName(): string
return '';
}

/**
* @return int
*/
public function getCurrentWebsiteId(): int
{
return (int)$this->storeManager->getStore()->getWebsiteId();
}

/**
* @return string
*/
Expand Down
1 change: 1 addition & 0 deletions ViewModel/Commons.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function getConfiguration(): array
{
$configuration = [];
$configuration['cookie_restriction_mode'] = $this->config->getCookieRestrictionModeName();
$configuration['website_id'] = $this->config->getCurrentWebsiteId();
$configuration['data_layer'] = $this->dataLayer->getDataLayer();
$configuration['id'] = $this->config->getId();
$configuration['debug'] = $this->config->isDebug();
Expand Down
4 changes: 3 additions & 1 deletion view/frontend/web/js/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ define([
return true;
}

return $.cookie(moduleConfig.cookie_restriction_mode);
const parsedCookie = JSON.parse($.cookie(moduleConfig.cookie_restriction_mode) || '{}');

return parsedCookie[moduleConfig.website_id] || false;
};

var isLoggedIn = function () {
Expand Down

0 comments on commit d505505

Please sign in to comment.