From 16113d26395148a8d39b38f900f971bc91274f4b Mon Sep 17 00:00:00 2001 From: "Max W." Date: Tue, 8 Apr 2025 00:49:35 +0200 Subject: [PATCH] Several adjustments - Add settings button --- gdprcookieconsent.php | 11 +++-------- views/js/gdpr_cookie.js | 24 +++++++++++++----------- views/templates/hook/footer.tpl | 8 +++++--- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/gdprcookieconsent.php b/gdprcookieconsent.php index c5b546c..c14ed38 100644 --- a/gdprcookieconsent.php +++ b/gdprcookieconsent.php @@ -48,7 +48,7 @@ class GdprCookieConsent extends Module Configuration::updateValue('GDPR_COOKIE_DECLINE', 'Decline Non-Essential') && Configuration::updateValue('GDPR_COOKIE_SETTINGS', 'Cookie Settings') && Configuration::updateValue('GDPR_COOKIE_MORE_INFO', 'More Information') && - Configuration::updateValue('GDPR_COOKIE_MORE_INFO_URL', 'content/2-privacy-policy') && + Configuration::updateValue('GDPR_COOKIE_MORE_INFO_URL', 'https://yourstore.net/content/privacy-policy') && Configuration::updateValue('GDPR_COOKIE_DATA_CONTROLLER', 'Your Company Name') && Configuration::updateValue('GDPR_COOKIE_RETENTION_PERIOD', '365 days') && Configuration::updateValue('GDPR_COOKIE_THIRD_PARTIES', 'Google Analytics, Facebook, etc.') && @@ -303,9 +303,7 @@ class GdprCookieConsent extends Module 'gdprCookieDecline' => Configuration::get('GDPR_COOKIE_DECLINE'), 'gdprCookieSettings' => Configuration::get('GDPR_COOKIE_SETTINGS'), 'gdprCookieMoreInfo' => Configuration::get('GDPR_COOKIE_MORE_INFO'), - 'gdprCookieMoreInfoUrl' => $this->context->link->getCMSLink( - Configuration::get('GDPR_COOKIE_MORE_INFO_URL') - ), + 'gdprCookieMoreInfoUrl' => Configuration::get('GDPR_COOKIE_MORE_INFO_URL'), 'gdprCookieDataController' => Configuration::get('GDPR_COOKIE_DATA_CONTROLLER', ''), 'gdprCookieRetentionPeriod' => Configuration::get('GDPR_COOKIE_RETENTION_PERIOD', '365 days'), 'gdprCookieThirdParties' => Configuration::get('GDPR_COOKIE_THIRD_PARTIES', ''), @@ -339,10 +337,7 @@ class GdprCookieConsent extends Module 'gdprCookieDecline' => Configuration::get('GDPR_COOKIE_DECLINE'), 'gdprCookieSettings' => Configuration::get('GDPR_COOKIE_SETTINGS'), 'gdprCookieMoreInfo' => Configuration::get('GDPR_COOKIE_MORE_INFO'), - 'gdprCookieMoreInfoUrl' => $this->context->link->getCMSLink( - Configuration::get('GDPR_COOKIE_MORE_INFO_URL') - ), - // New variables + 'gdprCookieMoreInfoUrl' => Configuration::get('GDPR_COOKIE_MORE_INFO_URL'), 'gdprCookieDataController' => Configuration::get('GDPR_COOKIE_DATA_CONTROLLER'), 'gdprCookieRetentionPeriod' => Configuration::get('GDPR_COOKIE_RETENTION_PERIOD'), 'gdprCookieThirdParties' => Configuration::get('GDPR_COOKIE_THIRD_PARTIES'), diff --git a/views/js/gdpr_cookie.js b/views/js/gdpr_cookie.js index 72c1317..6f6ee41 100644 --- a/views/js/gdpr_cookie.js +++ b/views/js/gdpr_cookie.js @@ -68,25 +68,27 @@ document.addEventListener('DOMContentLoaded', function() { document.getElementById('gdpr-cookie-banner-decline').addEventListener('click', function() { declineAllCookies(); }); + } - document.getElementById('gdpr-cookie-banner-settings').addEventListener('click', function() { - showModal(); + document.getElementById('gdpr-cookie-banner-settings').addEventListener('click', function() { + showModal(); + }); + + // Modal buttons + if(!gdprCookieOnlyRequired) { + document.getElementById('gdpr-cookie-decline').addEventListener('click', function() { + declineAllCookies(); + }); + + document.getElementById('gdpr-cookie-accept-selected').addEventListener('click', function() { + acceptSelectedCookies(); }); } - // Modal buttons document.getElementById('gdpr-cookie-accept-all').addEventListener('click', function() { acceptAllCookies(); }); - document.getElementById('gdpr-cookie-decline').addEventListener('click', function() { - declineAllCookies(); - }); - - document.getElementById('gdpr-cookie-accept-selected').addEventListener('click', function() { - acceptSelectedCookies(); - }); - // Manage button (for after consent is given) document.getElementById('gdpr-cookie-manage').addEventListener('click', function() { showModal(); diff --git a/views/templates/hook/footer.tpl b/views/templates/hook/footer.tpl index c9407f8..b838617 100644 --- a/views/templates/hook/footer.tpl +++ b/views/templates/hook/footer.tpl @@ -49,8 +49,10 @@ @@ -67,8 +69,8 @@