Skip to content

Commit

Permalink
Backport PR-9711 for Magento 2.1 - changed user dependend isUserNotAl…
Browse files Browse the repository at this point in the history
…lowSaveCookie condition in notice.phtml to fix varnish caching issue #6455

(cherry picked from commit 058f287)
  • Loading branch information
bka authored and hostep committed Sep 2, 2017
1 parent dc79eb7 commit 7a611cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion app/code/Magento/Cookie/Helper/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,22 @@ public function __construct(
public function isUserNotAllowSaveCookie()
{
$acceptedSaveCookiesWebsites = $this->_getAcceptedSaveCookiesWebsites();
return $this->isCookieRestrictionModeEnabled() &&
empty($acceptedSaveCookiesWebsites[$this->_website->getId()]);
}

/**
* Check if cookie restriction mode is enabled for this store
*
* @return bool
*/
public function isCookieRestrictionModeEnabled()
{
return $this->scopeConfig->getValue(
self::XML_PATH_COOKIE_RESTRICTION,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$this->_currentStore
) && empty($acceptedSaveCookiesWebsites[$this->_website->getId()]);
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

?>
<?php /** @var \Magento\Cookie\Block\Html\Notices $block */ ?>
<?php if ($this->helper('Magento\Cookie\Helper\Cookie')->isUserNotAllowSaveCookie()): ?>
<?php if ($this->helper('Magento\Cookie\Helper\Cookie')->isCookieRestrictionModeEnabled()): ?>
<div class="message global cookie" id="notice-cookie-block" style="display: none">
<div class="content">
<p>
Expand Down

0 comments on commit 7a611cc

Please sign in to comment.