File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -69,11 +69,22 @@ public function __construct(
69
69
public function isUserNotAllowSaveCookie ()
70
70
{
71
71
$ 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
+ {
72
83
return $ this ->scopeConfig ->getValue (
73
84
self ::XML_PATH_COOKIE_RESTRICTION ,
74
85
\Magento \Store \Model \ScopeInterface::SCOPE_STORE ,
75
86
$ this ->_currentStore
76
- ) && empty ( $ acceptedSaveCookiesWebsites [ $ this -> _website -> getId ()]) ;
87
+ );
77
88
}
78
89
79
90
/**
Original file line number Diff line number Diff line change 8
8
9
9
?>
10
10
<?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 ()): ?>
12
12
<div class="message global cookie" id="notice-cookie-block" style="display: none">
13
13
<div class="content">
14
14
<p>
Original file line number Diff line number Diff line change @@ -20,7 +20,10 @@ define([
20
20
$ ( this . options . cookieAllowButtonSelector ) . on ( 'click' , $ . proxy ( function ( ) {
21
21
var cookieExpires = new Date ( new Date ( ) . getTime ( ) + this . options . cookieLifetime * 1000 ) ;
22
22
23
- $ . mage . cookies . set ( this . options . cookieName , this . options . cookieValue , { expires : cookieExpires } ) ;
23
+ $ . mage . cookies . set ( this . options . cookieName , JSON . stringify ( this . options . cookieValue ) , {
24
+ expires : cookieExpires
25
+ } ) ;
26
+
24
27
if ( $ . mage . cookies . get ( this . options . cookieName ) ) {
25
28
window . location . reload ( ) ;
26
29
} else {
You can’t perform that action at this time.
0 commit comments