907 lines
42 KiB
PHP
907 lines
42 KiB
PHP
<?php
|
|
|
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
// Custom functions
|
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
// Get country list
|
|
function get_countries() {
|
|
$default_country = country_default;
|
|
return [$default_country, "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "France Metropolitan", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and Mc Donald Islands", "Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran (Islamic Republic of)", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan", "Lao, People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia, The Former Yugoslav Republic of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of", "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Seychelles", "Sierra Leone", "Singapore", "Slovakia (Slovak Republic)", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "St. Helena", "St. Pierre and Miquelon", "Sudan", "Suriname", "Svalbard and Jan Mayen Islands", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (U.S.)", "Wallis and Futuna Islands", "Western Sahara", "Yemen", "Yugoslavia", "Zambia", "Zimbabwe"];
|
|
}
|
|
|
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
// PAGE HEADER / FOOTER and MENU
|
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
// Template Header default including MENU
|
|
function template_header($title,$head) {
|
|
|
|
include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';
|
|
|
|
//variables
|
|
$num_items_in_cart = isset($_SESSION['cart']) ? array_sum(array_column($_SESSION['cart'], 'quantity')) : 0;
|
|
$default_country = isset($_SESSION['country_code']) ? strtolower($_SESSION['country_code']) : language_code;
|
|
|
|
//LINKS
|
|
$admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 1 ? '<a href="' . base_url . 'admin/index.php" aria-label="Settings" target="_blank"><i class="fa-solid fa-sliders"></i></a> ': '';
|
|
$logout_link = isset($_SESSION['account_loggedin']) ? '<a title="Logout" href="' . url('index.php?page=logout') . '"><i class="fas fa-sign-out-alt"></i></a>' : '';
|
|
|
|
//check for age_consent
|
|
if (age_verification_enabled){
|
|
if (isset($_POST['age_consent_allow'])){$_SESSION["age_consent"] = 1;}
|
|
$age_consent = (isset($_SESSION["age_consent"]) && $_SESSION["age_consent"] == 1) ? '' : consent();
|
|
} else {
|
|
$age_consent = '';
|
|
}
|
|
|
|
//check for maintenanceMode
|
|
if (maintenanceMode){$maintenanceMode = maintenanceMode();} else {$maintenanceMode = '';}
|
|
|
|
$veliti_analytics = '';
|
|
if (veliti_analytics && $_COOKIE['cookie_consent'] == 'accepted'){
|
|
$veliti_analytics = '<script src="'.$base_url.'/lib/analytics/analytics.js"></script>';
|
|
}
|
|
|
|
$tag_manager_header = '';
|
|
$tag_manager_body = '';
|
|
|
|
if (isset($_COOKIE['cookie_consent']) && $_COOKIE['cookie_consent'] == 'accepted') {
|
|
|
|
$tag_manager_header = "
|
|
<script>
|
|
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
|
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
|
})(window,document,'script','dataLayer','GTM-WZTRW84Q');
|
|
</script>";
|
|
|
|
$tag_manager_body = '<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WZTRW84Q" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>';
|
|
}
|
|
|
|
$view = '
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,minimum-scale=1">
|
|
<title>'.$title.' - '.site_title.'</title>
|
|
<link rel="icon" type="image/png" href="'.base_url.icon_image.'">
|
|
<link href="'.base_url.'custom/css/main.css" rel="stylesheet" type="text/css">
|
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.0.0/css/all.css">
|
|
'.$head.'
|
|
'.$tag_manager_header.'
|
|
<script>
|
|
// Wait for DOM to be ready before accessing elements
|
|
document.addEventListener(\'DOMContentLoaded\', function() {
|
|
// Get loading screen element
|
|
const loadingScreen = document.getElementById(\'loadingScreen\');
|
|
|
|
// Only proceed if the element exists
|
|
if (!loadingScreen) {
|
|
console.error(\'Loading screen element not found!\');
|
|
return;
|
|
}
|
|
|
|
// Show loading screen
|
|
function showLoading() {
|
|
loadingScreen.classList.add(\'active\');
|
|
}
|
|
|
|
// Hide loading screen
|
|
function hideLoading() {
|
|
loadingScreen.classList.remove(\'active\');
|
|
}
|
|
|
|
// Show loading when page initially loads
|
|
showLoading();
|
|
|
|
// Hide loading when everything is loaded
|
|
window.addEventListener(\'load\', hideLoading);
|
|
|
|
// In case the page loads very quickly
|
|
setTimeout(hideLoading, 500);
|
|
|
|
// Intercept form submissions
|
|
setupFormInterception();
|
|
|
|
// Intercept fetch and XMLHttpRequest
|
|
interceptNetworkRequests();
|
|
|
|
|
|
// Intercept all form submissions
|
|
function setupFormInterception() {
|
|
const forms = document.querySelectorAll(\'form\');
|
|
|
|
forms.forEach(form => {
|
|
form.addEventListener(\'submit\', function(e) {
|
|
// Show loading screen before form submission
|
|
showLoading();
|
|
});
|
|
});
|
|
}
|
|
|
|
// Intercept all network requests (fetch and XMLHttpRequest)
|
|
function interceptNetworkRequests() {
|
|
// Track active requests
|
|
let activeRequests = 0;
|
|
|
|
// Intercept fetch API
|
|
const originalFetch = window.fetch;
|
|
window.fetch = function() {
|
|
showLoading();
|
|
activeRequests++;
|
|
|
|
return originalFetch.apply(this, arguments)
|
|
.then(response => {
|
|
activeRequests--;
|
|
if (activeRequests === 0) hideLoading();
|
|
return response;
|
|
})
|
|
.catch(error => {
|
|
activeRequests--;
|
|
if (activeRequests === 0) hideLoading();
|
|
throw error;
|
|
});
|
|
};
|
|
|
|
// Intercept XMLHttpRequest
|
|
const originalXHROpen = XMLHttpRequest.prototype.open;
|
|
const originalXHRSend = XMLHttpRequest.prototype.send;
|
|
|
|
XMLHttpRequest.prototype.open = function() {
|
|
return originalXHROpen.apply(this, arguments);
|
|
};
|
|
|
|
XMLHttpRequest.prototype.send = function() {
|
|
showLoading();
|
|
activeRequests++;
|
|
|
|
this.addEventListener(\'loadend\', function() {
|
|
activeRequests--;
|
|
if (activeRequests === 0) hideLoading();
|
|
});
|
|
|
|
return originalXHRSend.apply(this, arguments);
|
|
};
|
|
}
|
|
});
|
|
</script>
|
|
'.$veliti_analytics.'
|
|
</head>
|
|
<body>
|
|
'.$tag_manager_body.'
|
|
<!-- Loading Bar -->
|
|
<div class="loading-container" id="loadingScreen">
|
|
<div class="loading-bar">
|
|
<div class="progress"></div>
|
|
</div>
|
|
<div class="loading-text">Loading, please wait...</div>
|
|
</div>
|
|
<!-- Top Info Bar -->
|
|
<div class="top-info-bar">
|
|
<div>
|
|
<i class="fas fa-home"></i>
|
|
'.($header_manufacturing ?? 'Swiss quality and Dutch manufacturing').'
|
|
</div>
|
|
<div>
|
|
<i class="fas fa-euro-sign"></i>
|
|
'.($header_shipping ?? 'Free shipping on all of our watches').'
|
|
</div>
|
|
<div>
|
|
<i class="fas fa-truck"></i>
|
|
'.($header_delivery ?? 'Fast service and delivery').'
|
|
</div>
|
|
<div>
|
|
<span class="star-rating">★★★★★</span>
|
|
'.($header_rating ?? 'Client rate 5.0/5.0').'
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Header -->
|
|
<header>
|
|
|
|
<div class="logo">
|
|
<a href="'.url('index.php').'" style="color:inherit;text-decoration:inherit;">
|
|
<img src="'.base_url.icon_image.'" alt="'.site_name.'" style="width: 50px;height: 50px;padding:1px;border-radius: 10px;">
|
|
</a>
|
|
</div>
|
|
|
|
<nav>
|
|
<ul class="nav-links">
|
|
<li><a href="'.url('index.php').'">'.$home_text.'</a></li>
|
|
<li><a href="'.url(link_to_collection).'">'.$products_text.'</a></li>
|
|
<li><a href="'.url('index.php?page=dealers').'">'.($dealer_text ?? 'Dealers').'</a></li>
|
|
<li><a href="'.url('index.php?page=about').'">'.$about_text.'</a></li>
|
|
</ul>
|
|
</nav>
|
|
|
|
<div class="header-icons">
|
|
<a href="'.url('index.php?page=cart').'" aria-label="Shopping Cart">
|
|
<i class="fas fa-shopping-cart"></i>
|
|
<span class="cart-count">'.$num_items_in_cart.'</span>
|
|
</a>
|
|
<a href="'.url('index.php?page=myaccount').'" aria-label="Account">
|
|
<i class="fas fa-user"></i>
|
|
</a>
|
|
'.$admin_link.'
|
|
'.$logout_link.'
|
|
<div class="language-selector">
|
|
<button class="language-btn" id="lang-toggle">
|
|
<img src="'.base_url.'custom/css/'.$default_country.'.png" alt="English" class="flag-icon">
|
|
<i class="fas fa-chevron-down"></i>
|
|
</button>
|
|
<div class="language-dropdown" id="lang-dropdown">
|
|
<a href="'.base_url.'index.php?language=us" class="active">
|
|
<img src="'.base_url.'custom/css/us.png" alt="English" class="flag-icon">
|
|
<span>English</span>
|
|
</a>
|
|
<a href="'.base_url.'index.php?language=de">
|
|
<img src="'.base_url.'custom/css/de.png" alt="Deutsch" class="flag-icon">
|
|
<span>Deutsch</span>
|
|
</a>
|
|
<a href="'.base_url.'index.php?language=fr">
|
|
<img src="'.base_url.'custom/css/fr.png" alt="Français" class="flag-icon">
|
|
<span>Français</span>
|
|
</a>
|
|
<a href="'.base_url.'index.php?language=nl">
|
|
<img src="'.base_url.'custom/css/nl.png" alt="Nederlands" class="flag-icon">
|
|
<span>Nederlands</span>
|
|
</a>
|
|
<a href="'.base_url.'index.php?language=es">
|
|
<img src="'.base_url.'custom/css/es.png" alt="Español" class="flag-icon">
|
|
<span>Español</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<button class="hamburger" id="menu-btn">
|
|
<i class="fas fa-bars"></i>
|
|
</button>
|
|
</header>
|
|
|
|
<!-- Mobile Menu -->
|
|
<div class="mobile-menu" id="mobile-menu">
|
|
<button class="close-menu" id="close-menu-btn">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
<ul class="mobile-nav-links">
|
|
<li><a href="'.url('index.php').'">'.$home_text.'</a></li>
|
|
<li><a href="'.url(link_to_collection).'">'.$products_text.'</a></li>
|
|
<li><a href="'.url('index.php?page=dealers').'">'.($dealer_text ?? 'Dealers').'</a></li>
|
|
<li><a href="'.url('index.php?page=about').'">'.$about_text.'</a></li>
|
|
<li><a href="'.url('index.php?page=cart').'">Cart</a></li>
|
|
<li><a href="'.url('index.php?page=myaccount').'">Account</a></li>
|
|
</ul>
|
|
</div>
|
|
'. $age_consent.'
|
|
'.$maintenanceMode . cookie_consent();
|
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
// Template Header (related to MENU function)
|
|
function template_header_top($title, $head = '') {
|
|
|
|
include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';
|
|
// Get the amount of items in the shopping cart, this will be displayed in the header.
|
|
$num_items_in_cart = isset($_SESSION['cart']) ? array_sum(array_column($_SESSION['cart'], 'quantity')) : 0;
|
|
$home_link = url('index.php');
|
|
$products_link = url(link_to_collection);
|
|
$about_link = url('index.php?page=about');
|
|
$myaccount_link = url('index.php?page=myaccount');
|
|
$cart_link = url('index.php?page=cart');
|
|
$admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 1 ? '<a href="' . base_url . 'admin/index.php" target="_blank">Admin</a>' : '';
|
|
$logout_link = isset($_SESSION['account_loggedin']) ? '<a title="Logout" href="' . url('index.php?page=logout') . '"><i class="fas fa-sign-out-alt"></i></a>' : '';
|
|
$site_name = site_name;
|
|
$site_title = site_title;
|
|
$base_url = base_url;
|
|
$icon_image = icon_image;
|
|
|
|
|
|
//check for age_consent
|
|
if (age_verification_enabled){
|
|
$age_consent = (isset($_SESSION["age_consent"]) && $_SESSION["age_consent"] == 1) ? '' : consent();
|
|
} else {
|
|
$age_consent = '';
|
|
}
|
|
|
|
//check for banners
|
|
if (banner_enabled){
|
|
$banner = (isset($_SESSION["banner"]) && $_SESSION["banner"] == 1) ? '' : banner();
|
|
} else {
|
|
$banner = '';
|
|
}
|
|
|
|
//check for maintenanceMode
|
|
if (maintenanceMode){$maintenanceMode = maintenanceMode();} else {$maintenanceMode = '';}
|
|
|
|
$veliti_analytics = '';
|
|
if (veliti_analytics){
|
|
$veliti_analytics = '<script src="'.$base_url.'/lib/analytics/analytics.js"></script>';
|
|
}
|
|
// DO NOT INDENT THE BELOW CODE
|
|
echo <<<EOT
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,minimum-scale=1">
|
|
<title>$site_title - $title</title>
|
|
<link rel="icon" type="image/png" href="{$base_url}$icon_image">
|
|
<link href="{$base_url}custom/css/style.css" rel="stylesheet" type="text/css">
|
|
<link href="{$base_url}custom/css/custom.css" rel="stylesheet" type="text/css">
|
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.0.0/css/all.css">
|
|
<script>
|
|
// Wait for DOM to be ready before accessing elements
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Get loading screen element
|
|
const loadingScreen = document.getElementById('loadingScreen');
|
|
|
|
// Only proceed if the element exists
|
|
if (!loadingScreen) {
|
|
console.error('Loading screen element not found!');
|
|
return;
|
|
}
|
|
|
|
// Show loading screen
|
|
function showLoading() {
|
|
loadingScreen.classList.add('active');
|
|
}
|
|
|
|
// Hide loading screen
|
|
function hideLoading() {
|
|
loadingScreen.classList.remove('active');
|
|
}
|
|
|
|
// Show loading when page initially loads
|
|
showLoading();
|
|
|
|
// Hide loading when everything is loaded
|
|
window.addEventListener('load', hideLoading);
|
|
|
|
// In case the page loads very quickly
|
|
setTimeout(hideLoading, 500);
|
|
|
|
// Intercept form submissions
|
|
setupFormInterception();
|
|
|
|
// Intercept fetch and XMLHttpRequest
|
|
interceptNetworkRequests();
|
|
|
|
|
|
// Intercept all form submissions
|
|
function setupFormInterception() {
|
|
const forms = document.querySelectorAll('form');
|
|
|
|
forms.forEach(form => {
|
|
form.addEventListener('submit', function(e) {
|
|
// Show loading screen before form submission
|
|
showLoading();
|
|
});
|
|
});
|
|
}
|
|
|
|
// Intercept all network requests (fetch and XMLHttpRequest)
|
|
function interceptNetworkRequests() {
|
|
// Track active requests
|
|
let activeRequests = 0;
|
|
|
|
// Intercept fetch API
|
|
const originalFetch = window.fetch;
|
|
window.fetch = function() {
|
|
showLoading();
|
|
activeRequests++;
|
|
|
|
return originalFetch.apply(this, arguments)
|
|
.then(response => {
|
|
activeRequests--;
|
|
if (activeRequests === 0) hideLoading();
|
|
return response;
|
|
})
|
|
.catch(error => {
|
|
activeRequests--;
|
|
if (activeRequests === 0) hideLoading();
|
|
throw error;
|
|
});
|
|
};
|
|
|
|
// Intercept XMLHttpRequest
|
|
const originalXHROpen = XMLHttpRequest.prototype.open;
|
|
const originalXHRSend = XMLHttpRequest.prototype.send;
|
|
|
|
XMLHttpRequest.prototype.open = function() {
|
|
return originalXHROpen.apply(this, arguments);
|
|
};
|
|
|
|
XMLHttpRequest.prototype.send = function() {
|
|
showLoading();
|
|
activeRequests++;
|
|
|
|
this.addEventListener('loadend', function() {
|
|
activeRequests--;
|
|
if (activeRequests === 0) hideLoading();
|
|
});
|
|
|
|
return originalXHRSend.apply(this, arguments);
|
|
};
|
|
}
|
|
});
|
|
</script>
|
|
$veliti_analytics
|
|
$head
|
|
</head>
|
|
<body>
|
|
<!-- Loading Bar -->
|
|
<div class="loading-container" id="loadingScreen">
|
|
<div class="loading-bar">
|
|
<div class="progress"></div>
|
|
</div>
|
|
<div class="loading-text">Loading, please wait...</div>
|
|
</div>
|
|
<main>
|
|
$banner
|
|
$age_consent
|
|
$maintenanceMode
|
|
EOT;
|
|
}
|
|
// Template Menu
|
|
function template_menu(){
|
|
include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';
|
|
// Get the amount of items in the shopping cart, this will be displayed in the header.
|
|
$num_items_in_cart = isset($_SESSION['cart']) ? array_sum(array_column($_SESSION['cart'], 'quantity')) : 0;
|
|
$home_link = url('index.php');
|
|
$products_link = url(link_to_collection);
|
|
$dealer_link = url('index.php?page=dealers');
|
|
$about_link = url('index.php?page=about');
|
|
$myaccount_link = url('index.php?page=myaccount');
|
|
$cart_link = url('index.php?page=cart');
|
|
$logout_link = isset($_SESSION['account_loggedin']) ? '<a title="Logout" href="' . url('index.php?page=logout') . '"><i class="fas fa-sign-out-alt"></i></a>' : '';
|
|
$site_name = site_name;
|
|
$site_title = site_title;
|
|
$base_url = base_url;
|
|
$icon_image = icon_image;
|
|
$basename = url('index.php?');
|
|
$default_country = isset($_SESSION['country_code']) ? strtolower($_SESSION['country_code']) : language_code;
|
|
|
|
//build up settings
|
|
$admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 1 ? '<a href="' . base_url . 'admin/index.php" title="Settings" target="_blank"><i class="fa-solid fa-sliders"></i></a> ': '';
|
|
|
|
|
|
// DO NOT INDENT THE BELOW CODE
|
|
echo <<<EOT
|
|
<header_menu>
|
|
<div class="content-wrapper">
|
|
<h1>
|
|
<a href="$home_link" style="color:inherit;text-decoration:inherit;">
|
|
<img src="{$base_url}$icon_image" alt="$site_name" style="width: 50px;height: 50px;padding:1px;border-radius: 10px;">
|
|
</a>
|
|
</h1>
|
|
<nav style="flex-grow: 1;flex-basis: 0px;justify-content: center;align-items: center;text-align: center;">
|
|
<a href="$home_link">$home_text</a>
|
|
<a href="$products_link">$products_text</a>
|
|
<a href="$dealer_link">Dealers</a>
|
|
<a href="$about_link">$about_text</a>
|
|
</nav>
|
|
<div class="link-icons">
|
|
<div class="search">
|
|
<i class="fas fa-search" title="Search"></i>
|
|
<input type="text" placeholder="Search...">
|
|
</div>
|
|
<a href="$cart_link" title="Shopping Cart">
|
|
<i class="fas fa-shopping-cart"></i>
|
|
<span>$num_items_in_cart</span>
|
|
</a>
|
|
<a href="$myaccount_link" title="My Account">
|
|
<i class="fa fa-user"></i>
|
|
</a>
|
|
$admin_link
|
|
<div class="dropdown">
|
|
<img src="{$base_url}custom/css/{$default_country}.png" id="title" alt="{$default_country} Flag" style="width:40px; height:auto; margin-right:10px;">
|
|
<div class="dropdown-content">
|
|
<a href="{$basename}language=us" style="padding:2px;" onclick="changeLanguage('English', 'us', '{$base_url}custom/css/us.png')">
|
|
<img src="{$base_url}custom/css/us.png" style="padding:2px;" alt="US Flag">
|
|
</a>
|
|
<a href="{$basename}language=es" style="padding:2px;" onclick="changeLanguage('Spanish', 'es', '{$base_url}custom/css/es.png')">
|
|
<img src="{$base_url}custom/css/es.png" style="padding:2px;" alt="Spanish Flag">
|
|
</a>
|
|
<a href="{$basename}language=fr" style="padding:2px;" onclick="changeLanguage('French', 'fr', '{$base_url}custom/css/fr.png')">
|
|
<img src="{$base_url}custom/css/fr.png" style="padding:2px;" alt="French Flag">
|
|
</a>
|
|
<a href="{$basename}language=de" style="padding:2px;" onclick="changeLanguage('German', 'de', '{$base_url}custom/css/de.png')">
|
|
<img src="{$base_url}custom/css/de.png" style="padding:2px;" alt="German Flag">
|
|
</a>
|
|
<a href="{$basename}language=it" style="padding:2px;" onclick="changeLanguage('Italian', 'it', '{$base_url}custom/css/it.png')">
|
|
<img src="{$base_url}custom/css/it.png" style="padding:2px;" alt="Italian Flag">
|
|
</a>
|
|
<a href="{$basename}language=nl" style="padding:2px;" onclick="changeLanguage('Dutch', 'nl', '{$base_url}custom/css/nl.png')">
|
|
<img src="{$base_url}custom/css/nl.png" style="padding:2px;" alt="Italian Flag">
|
|
</a>
|
|
</div>
|
|
</div>
|
|
$logout_link
|
|
<a class="responsive-toggle" onclick="openMenu('header_menu nav')" href="#">
|
|
<i class="fas fa-bars"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</header_menu>
|
|
EOT;
|
|
}
|
|
|
|
// Template footer
|
|
function template_footer() {
|
|
include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';
|
|
/*
|
|
$footer = '
|
|
<section class="newsletter">
|
|
<div class="container newsletter-container">
|
|
<div class="newsletter-text">
|
|
<h2>'.($newsletter_h2 ?? 'Sign up for<br>the newsletter').'</h2>
|
|
<p>'.($newsletter_p ?? 'Stay connected with our latest updates, tips, and exclusive offers—straight to your inbox.').'</p>
|
|
</div>
|
|
<div class="newsletter-form">
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" placeholder="'.($shipping_first_name ?? 'Name').' - '.($shipping_last_name ?? 'surname').' *" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<input type="email" class="form-control" placeholder="'.($account_create_email ?? 'E-mailaddress').' *" required>
|
|
</div>
|
|
<div class="checkbox-group">
|
|
<label>
|
|
<input type="checkbox" required>
|
|
'.($newsletter_confirm ?? 'I have read and agree with the privacy policy').'
|
|
</label>
|
|
</div>
|
|
<button type="submit" class="btn-submit">'.($newsletter_submit ?? 'submit').'</button>
|
|
</div>
|
|
</div>
|
|
</section>';
|
|
*/
|
|
$footer = '
|
|
<footer class="footer">
|
|
<div class="container footer-container">
|
|
<div class="footer-info">
|
|
<h3>'.company_name.'</h3>
|
|
<p>'.footer_city.' - '.footer_country.'</p>
|
|
<p>Tel: '.footer_phone.' - '.footer_email.'</p>
|
|
</div>
|
|
<div class="social-icons">
|
|
<a href="'.instagram_link.'" class="social-icon">
|
|
<svg width="45" height="45" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M21.5 7.5V16.5C21.5 19 19.5 21 17 21H7C4.5 21 2.5 19 2.5 16.5V7.5C2.5 5 4.5 3 7 3H17C19.5 3 21.5 5 21.5 7.5Z" stroke="#1f3d6b" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
<path d="M12 15.5C13.933 15.5 15.5 13.933 15.5 12C15.5 10.067 13.933 8.5 12 8.5C10.067 8.5 8.5 10.067 8.5 12C8.5 13.933 10.067 15.5 12 15.5Z" stroke="#1f3d6b" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
<path d="M17.5 7.5H17.51" stroke="#1f3d6b" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
</svg>
|
|
</a>
|
|
<a href="'.facebook_link.'" class="social-icon">
|
|
<svg width="45" height="45" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M14 9.3V12.2H16.6C16.8 12.2 16.9 12.4 16.9 12.6L16.5 14.5C16.5 14.6 16.3 14.7 16.2 14.7H14V22H11V14.8H9.3C9.1 14.8 9 14.7 9 14.5V12.6C9 12.4 9.1 12.3 9.3 12.3H11V9C11 7.3 12.3 6 14 6H16.7C16.9 6 17 6.1 17 6.3V8.7C17 8.9 16.9 9 16.7 9H14.3C14.1 9 14 9.1 14 9.3Z" stroke="#1f3d6b" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round"/>
|
|
<path d="M15 22H9C4 22 2 20 2 15V9C2 4 4 2 9 2H15C20 2 22 4 22 9V15C22 20 20 22 15 22Z" stroke="#1f3d6b" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
</svg>
|
|
</a>
|
|
<a href="https://wa.me/'.footer_phone.'?text=Hello%20I%20have%20a%20question!" class="social-icon">
|
|
<svg width="45" height="45" viewBox="0 0 45 45" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<circle cx="22.5" cy="22.5" r="22.5" fill="#25D366"/>
|
|
<g transform="translate(9, 9)">
|
|
<!-- Speech bubble -->
|
|
<path d="M13.5 3C19.299 3 24 7.701 24 13.5C24 19.299 19.299 24 13.5 24C11.8395 24 10.2673 23.6203 8.8584 22.9383L3 24L4.0617 18.1416C3.3797 16.7327 3 15.1605 3 13.5C3 7.701 7.701 3 13.5 3Z" fill="white"/>
|
|
<!-- Phone handset -->
|
|
<path d="M11.2 9.8C11.0 9.4 10.8 9.39 10.6 9.38C10.45 9.37 10.28 9.37 10.11 9.37C9.94 9.37 9.64 9.44 9.39 9.69C9.14 9.94 8.5 10.54 8.5 11.76C8.5 12.98 9.4 14.16 9.52 14.33C9.64 14.5 11.26 17.06 13.83 18.12C15.96 19 16.4 18.82 16.89 18.78C17.38 18.74 18.35 18.18 18.56 17.6C18.77 17.02 18.77 16.52 18.7 16.41C18.63 16.3 18.46 16.23 18.2 16.09C17.94 15.95 16.72 15.35 16.48 15.26C16.24 15.17 16.07 15.13 15.9 15.39C15.73 15.65 15.26 16.23 15.11 16.4C14.96 16.57 14.81 16.59 14.55 16.45C14.29 16.31 13.49 16.05 12.54 15.21C11.8 14.56 11.31 13.77 11.16 13.51C11.01 13.25 11.14 13.11 11.28 12.97C11.4 12.85 11.55 12.65 11.69 12.5C11.83 12.35 11.87 12.24 11.96 12.07C12.05 11.9 12.01 11.75 11.94 11.61C11.87 11.47 11.38 10.25 11.2 9.8Z" fill="#25D366"/>
|
|
</g>
|
|
</svg>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div class="payment-methods">
|
|
<img src="'.base_url.'custom/assets/iDEAL.png" alt="iDeal" class="payment-method">
|
|
<img src="'.base_url.'custom/assets/mastercard.png" alt="Mastercard" class="payment-method">
|
|
<img src="'.base_url.'custom/assets/visa.png" alt="Visa" class="payment-method">
|
|
<img src="'.base_url.'custom/assets/paypal.png" alt="Pay Pal" class="payment-method">
|
|
</div>
|
|
|
|
<div class="footer-bottom">
|
|
<div class="copyright">
|
|
©2025 All rights reserved
|
|
</div>
|
|
<div class="footer-links">
|
|
<a href="'.url('index.php?page=termsandconditions').'">'.$terms_text.'</a>
|
|
<a href="'.url('index.php?page=privacy').'">'.$privacy_text.'</a>
|
|
<a href="'.url('index.php?page=cookies').'">'.$cookie_text.'</a>
|
|
<a href="'.url('index.php?page=contact').'">'.$contact_text.'</a>
|
|
<a href="'.url('index.php?page=returns').'">'.$returns_text.'</a>
|
|
<a href="'.url('index.php?page=complaints').'">'.$complaint_text.'</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
<script>
|
|
//Mobile menu functionality
|
|
const menuBtn = document.getElementById(\'menu-btn\');
|
|
const closeMenuBtn = document.getElementById(\'close-menu-btn\');
|
|
const mobileMenu = document.getElementById(\'mobile-menu\');
|
|
|
|
menuBtn.addEventListener(\'click\', () => {
|
|
mobileMenu.classList.add(\'mobile-menu-open\');
|
|
document.body.style.overflow = \'hidden\';
|
|
});
|
|
|
|
closeMenuBtn.addEventListener(\'click\', () => {
|
|
mobileMenu.classList.remove(\'mobile-menu-open\');
|
|
document.body.style.overflow = \'auto\';
|
|
});
|
|
</script>
|
|
<script>
|
|
document.addEventListener(\'DOMContentLoaded\', function() {
|
|
// Get the language toggle button and dropdown
|
|
const langToggle = document.getElementById(\'lang-toggle\');
|
|
const langDropdown = document.getElementById(\'lang-dropdown\');
|
|
|
|
// Add click event to toggle button
|
|
langToggle.addEventListener(\'click\', function(e) {
|
|
e.stopPropagation(); // Prevent click from immediately bubbling to document
|
|
langDropdown.classList.toggle(\'show\');
|
|
});
|
|
|
|
// Add click events to each language option
|
|
const languageLinks = langDropdown.querySelectorAll(\'a\');
|
|
languageLinks.forEach(link => {
|
|
link.addEventListener(\'click\', function(e) {
|
|
// No need to prevent default as we want the href to be followed
|
|
// URL will be triggered naturally by the link
|
|
langDropdown.classList.remove(\'show\');
|
|
});
|
|
});
|
|
|
|
// Close dropdown when clicking elsewhere on the page
|
|
document.addEventListener(\'click\', function(e) {
|
|
if (!e.target.closest(\'.language-selector\')) {
|
|
langDropdown.classList.remove(\'show\');
|
|
}
|
|
});
|
|
});
|
|
const currency_code = "'.currency_code.'", base_url = "'.base_url.'", rewrite_url = "'.rewrite_url.'";
|
|
</script>
|
|
<script src="'.base_url.'script.js"></script>
|
|
';
|
|
|
|
return $footer;
|
|
|
|
}
|
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
// Order email
|
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
//Template header order email
|
|
function template_order_email_header($user_language) {
|
|
|
|
$user_language = ((isset($_SESSION['country_code']))? $_SESSION['country_code'] :$user_language);
|
|
|
|
include './custom/translations/translations_'.strtoupper($user_language).'.php';
|
|
|
|
$home_link = url('index.php');
|
|
$myaccount_link = url('index.php?page=myaccount');
|
|
$site_name = site_name;
|
|
$base_url = 'https://'.$_SERVER['SERVER_NAME'].'/'; //base_url;
|
|
$featured_order_image = $base_url.featured_order_image;
|
|
|
|
$company_name = company_name;
|
|
$company_adres = company_adres;
|
|
$company_postal = company_postal;
|
|
$company_bank = company_bank;
|
|
$company_kvk = company_kvk;
|
|
$company_city = footer_city;
|
|
$company_country = footer_country;
|
|
$company_email = footer_email;
|
|
|
|
// DO NOT INDENT THE BELOW CODE
|
|
echo <<<EOT
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,minimum-scale=1">
|
|
<title>$site_name</title>
|
|
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
background: #fff;
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
|
|
font-size: 14px;
|
|
color: #222;
|
|
}
|
|
.content-wrapper {
|
|
width: 100%;
|
|
max-width: 700px;
|
|
margin: auto;
|
|
padding: 24px 8px 40px 8px;
|
|
}
|
|
|
|
header, .header-table td {
|
|
font-family: inherit;
|
|
font-size: 14px;
|
|
font-weight: normal;
|
|
color: #222;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
header h1, header h2, header h3 {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
margin: 16px 0 8px 0;
|
|
}
|
|
.order-table th, .order-table td {
|
|
font-family: inherit;
|
|
font-size: 14px;
|
|
text-align: left;
|
|
padding: 8px 4px;
|
|
}
|
|
.order-table th {
|
|
background: #f5f5f5;
|
|
font-weight: 600;
|
|
}
|
|
header img {
|
|
max-width: 220px;
|
|
width: 100%;
|
|
height: auto;
|
|
display: block;
|
|
margin-bottom: 16px;
|
|
}
|
|
.header-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
.header-table td {
|
|
vertical-align: top;
|
|
padding: 8px;
|
|
}
|
|
.order-table table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
.order-table th, .order-table td {
|
|
padding: 8px 4px;
|
|
font-size: 14px;
|
|
text-align: left;
|
|
}
|
|
.order-table th {
|
|
background: #f5f5f5;
|
|
font-weight: 600;
|
|
}
|
|
.order-table .num {
|
|
text-align: right;
|
|
}
|
|
.order-table tr.item-list-end td {
|
|
border-bottom: 2px solid #0e0f10;
|
|
}
|
|
.subtotal, .shipping, .tax, .total {
|
|
font-weight: bold;
|
|
text-align: right;
|
|
}
|
|
.emailfooter {
|
|
margin: 32px 0 0 0;
|
|
text-align: center;
|
|
border-top: 1px solid #eee;
|
|
padding-top: 16px;
|
|
font-size: 13px;
|
|
}
|
|
.emailfooter a {
|
|
margin: 0 8px;
|
|
color: #555;
|
|
text-decoration: none;
|
|
font-size: inherit;
|
|
}
|
|
@media only screen and (max-width: 600px) {
|
|
.order-table {
|
|
width: 100%;
|
|
overflow-x: auto;
|
|
}
|
|
.order-table table {
|
|
min-width: 600px;
|
|
width: 100%;
|
|
display: table;
|
|
}
|
|
.order-table th, .order-table td {
|
|
display: table-cell;
|
|
width: auto !important;
|
|
padding: 8px 4px;
|
|
font-size: 13px;
|
|
text-align: left;
|
|
vertical-align: middle;
|
|
}
|
|
.order-table thead {
|
|
display: table-header-group;
|
|
}
|
|
.order-table tr {
|
|
display: table-row;
|
|
margin-bottom: 0;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
.order-table .num {
|
|
text-align: right !important;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<div class="content-wrapper">
|
|
<table class="header-table">
|
|
<tr>
|
|
<td>
|
|
<a href="$home_link">
|
|
<img src="$featured_order_image" alt="$site_name" style="max-width: 220px;width: 100%;height: auto;display: block; smargin-bottom: 16px;" />
|
|
</a>
|
|
</td>
|
|
<td>
|
|
$company_name<br>
|
|
$company_adres<br>
|
|
$company_postal $company_city<br>
|
|
$company_country<br>
|
|
<br>
|
|
$company_email <br>
|
|
<br>
|
|
Bank: $company_bank<br>
|
|
KvK: $company_kvk
|
|
</td>
|
|
</tr>
|
|
EOT;
|
|
}
|
|
// Template order footer
|
|
function template_order_email_footer() {
|
|
include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';
|
|
$home_link = url('index.php');
|
|
$products_link = url(link_to_collection);
|
|
$about_link = url('index.php?page=about');
|
|
$privacy_link = url('index.php?page=privacy');
|
|
$terms_link = url('index.php?page=termsandconditions');
|
|
$myaccount_link = url('index.php?page=myaccount');
|
|
$cart_link = url('index.php?page=cart');
|
|
|
|
// DO NOT INDENT THE BELOW CODE
|
|
echo <<<EOT
|
|
|
|
<div class="emailfooter">
|
|
<a href="$products_link">$products_text</a> - <a href="$myaccount_link">$myaccount_text</a> - <a href="$privacy_link">$privacy_text</a> - <a href="$terms_link">$terms_text</a>
|
|
</div>
|
|
</main>
|
|
</body>
|
|
</html>
|
|
EOT;
|
|
|
|
}
|
|
|
|
// Cookie consent banner
|
|
function cookie_consent() {
|
|
if (isset($_COOKIE['cookie_consent']) && $_COOKIE['cookie_consent'] == 'accepted') {
|
|
return '';
|
|
}
|
|
|
|
include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';
|
|
|
|
$cookie_policy_link = url('index.php?page=cookies');
|
|
|
|
$html = '
|
|
<div id="cookie-consent-banner" style="position: fixed; bottom: 0; left: 0; right: 0; background: #333; color: #fff; padding: 10px; text-align: center; z-index: 1000;">
|
|
'.($cookie_consent_text ?? 'This website uses cookies to improve your experience.').' <a href="' . $cookie_policy_link . '" style="color: #4CAF50; text-decoration: underline; margin-left: 5px;">'.($cookie_consent_learn_more ?? 'Learn more').'</a> <button id="accept-cookies" style="margin-left: 10px; padding: 5px 10px;">'.($cookie_consent_accept ?? 'Accept').'</button> <button id="decline-cookies" style="margin-left: 10px; padding: 5px 10px;">'.($cookie_consent_decline ?? 'Decline').'</button>
|
|
</div>
|
|
<script>
|
|
document.getElementById("accept-cookies").onclick = function() {
|
|
document.cookie = "cookie_consent=accepted; path=/; max-age=15768000";
|
|
location.reload();
|
|
};
|
|
document.getElementById("decline-cookies").onclick = function() {
|
|
document.cookie = "cookie_consent=declined; path=/; max-age=15768000";
|
|
document.getElementById("cookie-consent-banner").style.display = "none";
|
|
};
|
|
</script>
|
|
';
|
|
return $html;
|
|
}
|
|
?>
|