test branch

This commit is contained in:
“VeLiTi”
2025-05-26 11:51:25 +02:00
parent cd0e04981c
commit b9193fc3dc
36 changed files with 4998 additions and 917 deletions

View File

@@ -178,6 +178,7 @@ function template_admin_header($title, $selected = 'orders', $selected_child = '
$admin_links = '
<a href="index.php?page=settings"' . ($selected == 'settings' ? ' class="selected"' : '') . '><i class="fas fa-tools"></i>Settings</a>
<div class="sub">
<a href="index.php?page=countries"' . ($selected == 'countries' && $selected_child == '' ? ' class="selected"' : '') . '><span>&#9724;</span>Countries</a>
<a href="index.php?page=settings"' . ($selected == 'settings' && $selected_child == '' ? ' class="selected"' : '') . '><span>&#9724;</span>Settings</a>
<a href="index.php?page=language"' . ($selected == 'language' && $selected_child == '' ? ' class="selected"' : '') . '><span>&#9724;</span>Language</a>
</div>
@@ -597,109 +598,48 @@ function getPictureID($pdo,$id,$config){
//++++++++++++++++++++++++++++++++++++++++
//HomePage Products
//++++++++++++++++++++++++++++++++++++++++
function highlightedProducts($clientsecret,$categoryID,$range){
function highlightedProducts2($clientsecret,$categoryID,$range, $subtitle){
include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';
//GET CATALOG DATA
$products = ioAPIv2('/v2/catalog/category='.$categoryID,'',$clientsecret);
$products = json_decode($products,true);
$view = '
<h2>'.$range.'<span class="limited">Limited edition</span></h2>
<div class="products">';
foreach ($products as $product){
// Ensure product price is a numeric value
$product_price = isset($product['price']) && $product['price'] > 0 ? floatval($product['price']) : 0.00;
$section = '
<section class="watches-section">
<div class="container">
<div class="section-header">
<h2 class="section-title">'.($range ?? 'Featured Timepieces').'</h2>
<p class="section-subtitle">'.($subtitle ?? 'Explore our most popular and exquisite watch collections.').'</p>
</div>
<div class="product-slider">
<div class="product-container-slider">';
//SHOW LARGE PICTURE
$view .= '
<div class="product">
<a href="'.url('index.php?page=product&rowID=' . ($product['url_slug'] ? ($product['url_slug'] ) : $product['rowID'])).'" id="'.$product['rowID'].'A" class="product">
<img src="'.img_url.$product['full_path'].'" id="'.$product['rowID'].'" width="200" height="" alt="'.(${$product['productname']} ?? $product['productname']).'">
</a>';
//CHECK IF CONFIGURATION SETTING IS FOUND AND NOT EMPTY => USE GROUP TO DISPLAY IMAGES
if (isset($product['configurations']) && isset($product['config_setting']) && $product['config_setting'] != ''){
//GET THE CONFIG_SETTING GROuP AND DISPLAY
foreach ($product['configurations'] as $config){
//MATCH ASSIGNMENT WITH CONFIG SETTING
if($config['assignment'] == $product['config_setting']){
$view .= '<div class="" style="display:flex;justify-content: center">';
//GET ALL RELATED ATTRIBUTES
foreach ($config['attributes'] as $attribute){
$option_id = $attribute['attribute_id']; // ID of the LARGE IMAGE
$IMG_small_id = img_url.$attribute['full_path']; //URL TO SMALL IMAGE
$IMG_large_id = img_url.$attribute['alternative_media_full_path']; //URL TO LARGE IMAGE
// Ensure attribute price is a numeric value
$attribute_price = isset($attribute['price']) ? floatval($attribute['price']) : 0.00;
$option_price = isset($attribute['price'])
// If price modifier is 1, add prices; otherwise, subtract
? ((isset($attribute['price_modifier']) && $attribute['price_modifier'] == 1) ? currency_code . number_format(floatval($product_price + $attribute_price), 2) : currency_code . number_format(floatval($product_price - $attribute_price), 2))
// If product price is not zero, format it
: (($product_price != 0.00) ? currency_code . number_format(floatval($product_price), 2) : '');
$view .= '
<div>
<img class="img_config" src="'.$IMG_small_id.'" id="'.$attribute['item_media'].'" onclick="update(\''.$product['rowID'].'\',\''.$IMG_large_id.'\',\''.url('index.php?page=product&rowID=' . ($product['url_slug'] ? $product['url_slug'].'/'.$option_id : $product['rowID'].'/'.$option_id )).'\',\''.$option_price.'\')" />
</div>';
}
$view .= '</div>';
}
}
} else {
//SHOW SMALL IMAGE
$view .= '<div class="" style="display:flex;justify-content: center">
<div>
<img class="img_config" src="'.img_url.$product['full_path'].'"/>
</div>
</div>';
}
//Stock status
$stock_status = (isset($product['quantity']) && $product['quantity'] != 0) ? $product_on_stock : $out_of_stock;
$style = ($stock_status == $product_on_stock) ? 'style="background-color: green;"' : 'style="background-color:gray;font-weight: lighter;"';
$view .= '
<span class="stock">
<p '.$style.'> '.$stock_status.'</p>
</span>';
if (free_shipment_indicator){
$shipment = freeShipment($product_price,'span');
$view .= $shipment;
}
$option_id ='';
$view .='<a href="'.url('index.php?page=product&rowID=' . ($product['url_slug'] ? $product['url_slug'].$option_id : $product['rowID'])).'" id="'.$product['rowID'].'B" class="product">
<span class="name">'.(${$product['productname']} ?? $product['productname']).'</span>';
if (isset($product_price)){
$view .= '<span class="price" id="'.$product['rowID'].'C">'.(($product_price != 0.00) ? currency_code.number_format($product_price,2) : '').'';
if (isset($product['rrp']) && $product['rrp'] > 0){
$view .= '<span class="rrp">'.currency_code.number_format($product['rrp'],2).'</span>';
}
$view .= '</span>';
}
$view .= '
</a>
</div>';
foreach ($products as $product){
$product_price = isset($product['price']) && $product['price'] > 0 ? floatval($product['price']) : 0.00;
$section .= '
<div class="product-card-slider">
<a href="'.url('index.php?page=product&rowID=' . ($product['url_slug'] ? ($product['url_slug'] ) : $product['rowID'])).'" id="'.$product['rowID'].'A" class="product">
<img src="'.img_url.$product['full_path'].'" alt="'.(${$product['productname']} ?? $product['productname']).'" class="product-image-slider">
<h3 class="product-name-slider">'.(${$product['productname']} ?? $product['productname']).'</h3>
<p class="product-price-slider">'.(($product_price != 0.00) ? currency_code.number_format($product_price,2) : '').'</p>
</a>
</div>';
}
$view .= '</div>';
return $view;
$section .= '</div>
<button class="slider-nav prev-btn"><i class="fas fa-chevron-left"></i></button>
<button class="slider-nav next-btn"><i class="fas fa-chevron-right"></i></button>
</div>
</div>
</section>
<div class="divider"></div>
';
return $section ;
}
//---------------------------