CMXX - Language selection

This commit is contained in:
“VeLiTi”
2025-02-19 16:48:48 +01:00
parent 0e9d133ff9
commit 8bb78d2a08
19 changed files with 139 additions and 58 deletions

View File

@@ -2005,4 +2005,32 @@ input.banner_deny:hover {
.news-grid {
grid-template-columns: 1fr;
}
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 80px;
box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown-content a {
text-decoration: none;
display: flex;
align-items: center;
}
.dropdown-content a:hover {
background-color: #ddd;
}
.dropdown-content img {
width: 20px;
height: auto;
}

BIN
custom/css/de.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

BIN
custom/css/es.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
custom/css/fr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
custom/css/it.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

BIN
custom/css/nl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

BIN
custom/css/us.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -17,7 +17,7 @@ function get_countries() {
// Template Header default including MENU
function template_header($title, $head = '') {
include './custom/translations/translations_'.strtoupper(language_code).'.php';
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;
@@ -110,7 +110,7 @@ if (veliti_analytics){
// Template Header (related to MENU function)
function template_header_top($title, $head = '') {
include './custom/translations/translations_'.strtoupper(language_code).'.php';
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');
@@ -171,7 +171,7 @@ function template_header_top($title, $head = '') {
}
// Template Menu
function template_menu(){
include './custom/translations/translations_'.strtoupper(language_code).'.php';
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');
@@ -212,7 +212,27 @@ function template_menu(){
</a>
<a href="$myaccount_link" title="My Account">
<i class="fa fa-user"></i>
</a>
</a>
<div class="dropdown">
<img src="{$base_url}custom/css/us.png" id="title" alt="English Flag" style="width:40px; height:auto; margin-right:10px;">
<div class="dropdown-content">
<a href="javascript:void(0)" style="padding:2px;" onclick="changeLanguage('English', 'en', '{$base_url}custom/css/us.png')">
<img src="{$base_url}custom/css/us.png" style="padding:2px;" alt="English Flag">
</a>
<a href="javascript:void(0)" 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="javascript:void(0)" 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="javascript:void(0)" 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="javascript:void(0)" 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>
</div>
</div>
$logout_link
<a class="responsive-toggle" onclick="openMenu('header_menu nav')" href="#">
<i class="fas fa-bars"></i>
@@ -225,7 +245,7 @@ function template_menu(){
// Template footer
function template_footer() {
include './custom/translations/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';
$base_url = base_url;
$rewrite_url = rewrite_url ? 'true' : 'false';
$year = date('Y');
@@ -292,7 +312,7 @@ function template_footer() {
//++++++++++++++++++++++++++++++++++++++++++++++++++++
//Template header order email
function template_order_email_header() {
include './custom/translations/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';
$home_link = url('index.php');
$myaccount_link = url('index.php?page=myaccount');
@@ -502,7 +522,7 @@ EOT;
}
// Template order footer
function template_order_email_footer() {
include './custom/translations/translations_'.strtoupper(language_code).'.php';
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');

View File

@@ -1,7 +1,7 @@
<?php defined(security_key) or exit; ?>
<?=template_order_email_header()?>
<?php include './custom/translations/translations_'.strtoupper(language_code).'.php';?>
<?php include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';?>
</tr>
<tr><td><br></td></tr>
<tr>
@@ -18,8 +18,8 @@
<h1><?=$order_email_message_1?></h1>
<p><?=$order_email_message_2?></p></td>
<td>
<p>Order: <?=$order_id?></p>
<p>Date: <?php echo date("Y-m-d");?></p></td>
<p><?=$order_number_text ?? 'Order' ?>: <?=$order_id?></p>
<p><?=$order_date_text ?? 'Date'?>: <?php echo date("Y-m-d");?></p></td>
</tr>
</table>
</div>
@@ -30,17 +30,17 @@
<table>
<thead>
<tr>
<td><?=$tr_product?></td>
<td>Opties</td>
<td><?=$tr_quantity?></td>
<td><?=$tr_price?></td>
<td><?=$tr_product ?? 'Product' ?></td>
<td><?=$tr_options ?? 'Options' ?></td>
<td><?=$tr_quantity ?? 'Quantity'?></td>
<td><?=$tr_price ?? 'Price' ?></td>
<td style="text-align:right;"><?=$tr_total?></td>
</tr>
</thead>
<tbody>
<?php foreach($products['products'] as $product): ?>
<tr>
<td><?=$product['meta']['name']?></td>
<td><?=${$product['meta']['name']} ?? $product['meta']['name']?></td>
<td><?=implode(", ", $product['options'])?></td>
<td><?=$product['quantity']?></td>
<td><?=currency_code?><?=number_format($product['options_price'],2)?></td>

View File

@@ -3,7 +3,7 @@
//(defined(security_key) or defined('admin')) or exit; ?>
<?=template_order_email_header()?>
<?php include './custom/translations/translations_'.strtoupper(language_code).'.php';?>
<?php include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';?>
</tr>
<tr><td><br></td></tr>
<tr>
@@ -16,8 +16,8 @@
</tr>
<tr><td><br></td></tr>
<tr>
<td><h2>Invoice: <?=$invoice_cust['invoice']['id']?></h2></td>
<td><p>Date: <?php echo date("Y-m-d", strtotime($invoice_cust['invoice']['created']))?></p></td>
<td><h2><?=$order_invoice_text ?? 'Invoice'?>: <?=$invoice_cust['invoice']['id']?></h2></td>
<td><p><?=$order_date_text ?? 'Date'?>: <?php echo date("Y-m-d", strtotime($invoice_cust['invoice']['created']))?></p></td>
</tr>
</table>
@@ -29,10 +29,10 @@
<table>
<thead>
<tr>
<td><?=$tr_product?></td>
<td>Options</td>
<td><?=$tr_quantity?></td>
<td><?=$tr_price?></td>
<td><?=$tr_product ?? 'Product' ?></td>
<td><?=$tr_options ?? 'Options' ?></td>
<td><?=$tr_quantity ?? 'Quantity'?></td>
<td><?=$tr_price ?? 'Price' ?></td>
<td style="text-align:right;"><?=$tr_total?></td>
</tr>
</thead>
@@ -77,7 +77,7 @@
<?php if($invoice_cust['invoice']['payment_status'] === 1){
echo '
<div class="content-wrapper">
<p>Het totaalbedrag van deze factuur is betaald</p>
<p>'.($invoice_payment_paid_text ?? 'Het totaalbedrag van deze factuur is betaald').'</p>
</div>';
}
?>

View File

@@ -1,7 +1,7 @@
<?php defined(security_key) or exit; ?>
<?=template_order_email_header()?>
<?php include './custom/translations/translations_'.strtoupper(language_code).'.php';?>
<?php include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';?>
</tr>
<tr><td><br></td></tr>
@@ -31,17 +31,17 @@
<table>
<thead>
<tr>
<td><?=$tr_product?></td>
<td>Options</td>
<td><?=$tr_quantity?></td>
<td><?=$tr_price?></td>
<td><?=$tr_product ?? 'Product' ?></td>
<td><?=$tr_options ?? 'Options' ?></td>
<td><?=$tr_quantity ?? 'Quantity'?></td>
<td><?=$tr_price ?? 'Price' ?></td>
<td style="text-align:right;"><?=$tr_total?></td>
</tr>
</thead>
<tbody>
<?php foreach($products['products'] as $product): ?>
<tr>
<td><?=$product['meta']['name']?></td>
<td><?=${$product['product_name']} ?? $product['product_name']?></td>
<td><?=implode(", ", $product['options'])?></td>
<td><?=$product['quantity']?></td>
<td><?=currency_code?><?=number_format($product['options_price'],2)?></td>