Skip to content

Commit 7a611cc

Browse files
bkahostep
authored andcommitted
Backport PR-9711 for Magento 2.1 - changed user dependend isUserNotAllowSaveCookie condition in notice.phtml to fix varnish caching issue #6455
(cherry picked from commit 058f287)
1 parent dc79eb7 commit 7a611cc

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

app/code/Magento/Cookie/Helper/Cookie.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,22 @@ public function __construct(
6969
public function isUserNotAllowSaveCookie()
7070
{
7171
$acceptedSaveCookiesWebsites = $this->_getAcceptedSaveCookiesWebsites();
72+
return $this->isCookieRestrictionModeEnabled() &&
73+
empty($acceptedSaveCookiesWebsites[$this->_website->getId()]);
74+
}
75+
76+
/**
77+
* Check if cookie restriction mode is enabled for this store
78+
*
79+
* @return bool
80+
*/
81+
public function isCookieRestrictionModeEnabled()
82+
{
7283
return $this->scopeConfig->getValue(
7384
self::XML_PATH_COOKIE_RESTRICTION,
7485
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
7586
$this->_currentStore
76-
) && empty($acceptedSaveCookiesWebsites[$this->_website->getId()]);
87+
);
7788
}
7889

7990
/**

app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

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

0 commit comments

Comments
 (0)