mirror of
https://git.hexahost.dev/smueller/HexaHost-Frontend.git
synced 2026-06-02 13:08:43 +00:00
Update product configuration and enhance order functionality: Added shop URLs for various products in the backend configuration, improving the management of product links. Implemented new functions to generate order URLs for featured and first packages, enhancing the user experience on product pages. Updated contact and product pages to utilize the new order URL functionality for streamlined ordering.
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* HexaHost.de Produkt-Konfiguration
|
||||
*
|
||||
* Hier können Sie alle Preise und Produktinformationen zentral verwalten.
|
||||
* Hier können Sie alle Preise, Shop-Links und Produktinformationen zentral verwalten.
|
||||
* Pro Paket: shop_url (WHMCS/Warenkorb-Link, z. B. https://shop.hexahost.de/cart.php?a=add&pid=123)
|
||||
* Nach Änderungen: npm run build && npm run deploy
|
||||
*
|
||||
* Verwendung in PHP-Seiten:
|
||||
@@ -30,6 +31,7 @@ $PRODUCTS['vpc'] = [
|
||||
'starter' => [
|
||||
'name' => 'VPC Starter',
|
||||
'price' => '4,99',
|
||||
'shop_url' => '',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'CPU Kerne', 'value' => '1 vCore'],
|
||||
@@ -49,6 +51,7 @@ $PRODUCTS['vpc'] = [
|
||||
'business' => [
|
||||
'name' => 'VPC Business',
|
||||
'price' => '9,99',
|
||||
'shop_url' => '',
|
||||
'featured' => true,
|
||||
'specs' => [
|
||||
['label' => 'CPU Kerne', 'value' => '2 vCores'],
|
||||
@@ -69,6 +72,7 @@ $PRODUCTS['vpc'] = [
|
||||
'professional' => [
|
||||
'name' => 'VPC Professional',
|
||||
'price' => '19,99',
|
||||
'shop_url' => '',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'CPU Kerne', 'value' => '4 vCores'],
|
||||
@@ -90,6 +94,7 @@ $PRODUCTS['vpc'] = [
|
||||
'enterprise' => [
|
||||
'name' => 'VPC Enterprise',
|
||||
'price' => '39,99',
|
||||
'shop_url' => '',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'CPU Kerne', 'value' => '8 vCores'],
|
||||
@@ -132,6 +137,7 @@ $PRODUCTS['vps'] = [
|
||||
'starter' => [
|
||||
'name' => 'VPS Starter',
|
||||
'price' => '9,99',
|
||||
'shop_url' => '',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'CPU Kerne', 'value' => '1 vCore'],
|
||||
@@ -151,6 +157,7 @@ $PRODUCTS['vps'] = [
|
||||
'business' => [
|
||||
'name' => 'VPS Business',
|
||||
'price' => '19,99',
|
||||
'shop_url' => '',
|
||||
'featured' => true,
|
||||
'specs' => [
|
||||
['label' => 'CPU Kerne', 'value' => '2 vCores'],
|
||||
@@ -171,6 +178,7 @@ $PRODUCTS['vps'] = [
|
||||
'professional' => [
|
||||
'name' => 'VPS Professional',
|
||||
'price' => '39,99',
|
||||
'shop_url' => '',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'CPU Kerne', 'value' => '4 vCores'],
|
||||
@@ -192,6 +200,7 @@ $PRODUCTS['vps'] = [
|
||||
'enterprise' => [
|
||||
'name' => 'VPS Enterprise',
|
||||
'price' => '79,99',
|
||||
'shop_url' => '',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'CPU Kerne', 'value' => '8 vCores'],
|
||||
@@ -234,6 +243,7 @@ $PRODUCTS['mail-gateway'] = [
|
||||
'starter' => [
|
||||
'name' => 'Mail Starter',
|
||||
'price' => '4,99',
|
||||
'shop_url' => '',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'Postfächer', 'value' => '5'],
|
||||
@@ -252,6 +262,7 @@ $PRODUCTS['mail-gateway'] = [
|
||||
'business' => [
|
||||
'name' => 'Mail Business',
|
||||
'price' => '14,99',
|
||||
'shop_url' => '',
|
||||
'featured' => true,
|
||||
'specs' => [
|
||||
['label' => 'Postfächer', 'value' => '25'],
|
||||
@@ -272,6 +283,7 @@ $PRODUCTS['mail-gateway'] = [
|
||||
'professional' => [
|
||||
'name' => 'Mail Professional',
|
||||
'price' => '29,99',
|
||||
'shop_url' => '',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'Postfächer', 'value' => '100'],
|
||||
@@ -293,6 +305,7 @@ $PRODUCTS['mail-gateway'] = [
|
||||
'enterprise' => [
|
||||
'name' => 'Mail Enterprise',
|
||||
'price' => '59,99',
|
||||
'shop_url' => '',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'Postfächer', 'value' => 'Unbegrenzt'],
|
||||
@@ -336,6 +349,7 @@ $PRODUCTS['webhosting'] = [
|
||||
'starter' => [
|
||||
'name' => 'Webhosting Starter',
|
||||
'price' => '4,99',
|
||||
'shop_url' => 'https://shop.hexahost.de/store/webserver/webhosting-starter',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'Webspace', 'value' => '10 GB'],
|
||||
@@ -358,6 +372,7 @@ $PRODUCTS['webhosting'] = [
|
||||
'business' => [
|
||||
'name' => 'Webhosting Business',
|
||||
'price' => '7,99',
|
||||
'shop_url' => 'https://shop.hexahost.de/store/webserver/webhosting-business',
|
||||
'featured' => true,
|
||||
'specs' => [
|
||||
['label' => 'Webspace', 'value' => '30 GB'],
|
||||
@@ -380,6 +395,7 @@ $PRODUCTS['webhosting'] = [
|
||||
'professional' => [
|
||||
'name' => 'Webhosting Professional',
|
||||
'price' => '9,99',
|
||||
'shop_url' => 'https://shop.hexahost.de/store/webserver/webhosting-professional',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'Webspace', 'value' => '50 GB'],
|
||||
@@ -402,6 +418,7 @@ $PRODUCTS['webhosting'] = [
|
||||
'enterprise' => [
|
||||
'name' => 'Webhosting Enterprise',
|
||||
'price' => '29,99',
|
||||
'shop_url' => '',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'Webspace', 'value' => '200 GB'],
|
||||
@@ -485,6 +502,38 @@ function formatPrice($price, $withCurrency = true) {
|
||||
return $withCurrency ? $price . '€' : $price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bestell-Link für ein Paket (Online-Shop oder Kontaktformular)
|
||||
*/
|
||||
function getOrderUrl($productId, $packageId) {
|
||||
$package = getPackage($productId, $packageId);
|
||||
if ($package && !empty($package['shop_url'])) {
|
||||
return $package['shop_url'];
|
||||
}
|
||||
|
||||
return sprintf('contact.php?package=%s-%s', $productId, $packageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bestell-Link für CTA (beliebtes Paket oder erstes Paket)
|
||||
*/
|
||||
function getProductOrderUrl($productId) {
|
||||
$packages = getProductPackages($productId);
|
||||
|
||||
foreach ($packages as $packageId => $package) {
|
||||
if (!empty($package['featured'])) {
|
||||
return getOrderUrl($productId, $packageId);
|
||||
}
|
||||
}
|
||||
|
||||
$firstPackageId = array_key_first($packages);
|
||||
if ($firstPackageId !== null) {
|
||||
return getOrderUrl($productId, $firstPackageId);
|
||||
}
|
||||
|
||||
return sprintf('contact.php?product=%s', $productId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generiert HTML für eine Paket-Karte
|
||||
*/
|
||||
@@ -522,7 +571,7 @@ function renderPackageCard($productId, $packageId, $package) {
|
||||
<div class="package-features">
|
||||
%s
|
||||
</div>
|
||||
<a href="contact.php?package=%s-%s" class="btn btn-primary">Jetzt bestellen</a>
|
||||
<a href="%s" class="btn btn-primary">Jetzt bestellen</a>
|
||||
</div>',
|
||||
$featuredClass,
|
||||
$featuredBadge,
|
||||
@@ -530,8 +579,7 @@ function renderPackageCard($productId, $packageId, $package) {
|
||||
$package['price'],
|
||||
$specsHtml,
|
||||
$featuresHtml,
|
||||
$productId,
|
||||
$packageId
|
||||
htmlspecialchars(getOrderUrl($productId, $packageId), ENT_QUOTES, 'UTF-8')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user