feat(kasse, warenkorb): neue Ansicht ist Standard, Rueckfall ?ansicht=alt per Session

- Weiche in website_shoppingcart.php / website_cashdesk.php gedreht: content_*_neu.tpl
  ist Standard, ?ansicht=alt schaltet die Sitzung auf die alten Templates, ?ansicht=neu zurueck
- Parameter ansicht=neu aus Form-Actions und Links der neuen Templates entfernt
- Erfolgsseite completed.tpl und payment_result.tpl (theme2) im Stil der neuen Kasse
  (Schrittleiste 3 Fertig, Karte, Bestellnummer, Text aus cash_desk_order_completed)
- Erfolgsseite ohne Navigation (site_type full_width) wie Warenkorb/Kasse
- sticky Bestellkasten unter dem klebenden Theme-Kopf (top 105px statt 16px)
- fix: Korbsumme 0 teilte in manage_gift_certificate() durch null (HTTP 500)
This commit is contained in:
Thomas Bartelt
2026-09-26 23:43:41 +02:00
parent 6cea66126a
commit def156e1c2
6 changed files with 189 additions and 35 deletions
+25 -6
View File
@@ -67,6 +67,10 @@ class website_cashdesk {
if (isset($_GET['order'])) {
$this->layout_object->assign('order_number', $_GET['order']);
}
// 27.09.2026: Erfolgsseite ohne Navigation, wie Warenkorb und Kasse der neuen Ansicht
if (!$this->alte_ansicht()) {
$this->layout_object->assign('site_type', 'full_width');
}
// Success-Template anzeigen - auch bei Reload!
return $this->layout_object->_fetch('content_cash_desk/completed.tpl');
}
@@ -362,12 +366,13 @@ class website_cashdesk {
// "Bestellen" als denselben Vorgang erkennbar (siehe save_order()).
$this->layout_object->assign('checkout_nonce', $this->checkout_nonce_holen());
// 18.09.2026 -- Entwurf der neuen Kassenansicht zum Anschauen: /Kasse/?ansicht=neu
if (isset($_GET['ansicht']) && $_GET['ansicht'] === 'neu') {
$this->layout_object->assign('site_type', 'full_width'); // ohne Navigation, mehr Breite (Tom, 18.09.)
return $this->layout_object->_fetch('content_cash_desk_neu.tpl');
// 27.09.2026 -- die neue Kasse (content_cash_desk_neu.tpl) ist Standard.
// Rueckfall auf das alte Template: /Kasse/?ansicht=alt (siehe alte_ansicht()).
if ($this->alte_ansicht()) {
return $this->layout_object->_fetch('content_cash_desk.tpl');
}
return $this->layout_object->_fetch('content_cash_desk.tpl');
$this->layout_object->assign('site_type', 'full_width'); // ohne Navigation, mehr Breite (Tom, 18.09.)
return $this->layout_object->_fetch('content_cash_desk_neu.tpl');
} else if (isset($_GET['token']) && $_GET['token']) {
return $this->change_order('paypal');
@@ -382,6 +387,18 @@ class website_cashdesk {
// end run
/**
* Rueckfall auf die alte Kassen-/Warenkorbansicht (27.09.2026, Go-Live der neuen Ansicht):
* ?ansicht=alt schaltet fuer die Sitzung auf die alten Templates, ?ansicht=neu hebt das auf.
* Dieselbe Weiche steht in website_shoppingcart.php.
*/
private function alte_ansicht() {
if (isset($_GET['ansicht'])) {
$_SESSION['easyshop']['ansicht_alt'] = ($_GET['ansicht'] === 'alt') ? 1 : 0;
}
return !empty($_SESSION['easyshop']['ansicht_alt']);
}
// ------------------------------------------------------------ Express
/** Start aus dem Warenkorb: /Kasse/?payment_express_start=<modul> */
@@ -886,8 +903,10 @@ class website_cashdesk {
$this->has_gift_certificate = false;
}
// 27.09.2026: Korbsumme 0 (Artikel ohne Preis) teilte hier durch null -> HTTP 500 in der Kasse
$sum_gross = (float)$this->shoppingcart_data['price_sum_gross'];
foreach ($this->shoppingcart_data['tax_values'] as $key => $value) {
$this->shoppingcart_data['tax_values'][$key]['gift']['percent'] = $percent = round(($value['gross'] / $this->shoppingcart_data['price_sum_gross'] * 100), 2);
$this->shoppingcart_data['tax_values'][$key]['gift']['percent'] = $percent = $sum_gross > 0 ? round(($value['gross'] / $sum_gross * 100), 2) : 0;
$this->shoppingcart_data['tax_values'][$key]['gift']['gross'] = $new_gross = $this->shoppingcart_data['price_sum_gross'] / 100 * $percent;
$this->shoppingcart_data['tax_values'][$key]['gift']['net'] = $new_net = $new_gross / (100 + $key) * 100;
$this->shoppingcart_data['tax_values'][$key]['gift']['vat'] = $new_gross - $new_net;
+22 -7
View File
@@ -66,8 +66,8 @@ class website_shoppingcart {
}
// Post-Redirect-Get fuer die neue Ansicht: nach Mengen-/Anmerkungsaenderung per GET neu
// laden, sonst fragt ein Reload "Formular erneut senden" und schickt die Mengen doppelt.
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['cart_goto']) && isset($_GET['ansicht']) && $_GET['ansicht'] === 'neu') {
header('Location: /Warenkorb/?ansicht=neu');
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['cart_goto']) && !$this->alte_ansicht()) {
header('Location: /Warenkorb/');
exit;
}
@@ -84,15 +84,30 @@ class website_shoppingcart {
// Angezeigt, wenn der Anbieter Express kann und seine Zahlart aktiv ist.
$this->layout_object->assign('express_providers', $this->express_providers());
// 18.09.2026 -- Entwurf der neuen Warenkorb-Ansicht zum Anschauen: /Warenkorb/?ansicht=neu
if (isset($_GET['ansicht']) && $_GET['ansicht'] === 'neu') {
$this->layout_object->assign('site_type', 'full_width'); // ohne Navigation, mehr Breite (Tom, 18.09.)
return $this->layout_object->_fetch('content_shoppingcart_neu.tpl');
// 27.09.2026 -- die neue Ansicht (content_shoppingcart_neu.tpl) ist Standard.
// Rueckfall auf das alte Template: /Warenkorb/?ansicht=alt (siehe alte_ansicht()).
if ($this->alte_ansicht()) {
return $this->layout_object->_fetch('content_shoppingcart.tpl');
}
return $this->layout_object->_fetch('content_shoppingcart.tpl');
$this->layout_object->assign('site_type', 'full_width'); // ohne Navigation, mehr Breite (Tom, 18.09.)
return $this->layout_object->_fetch('content_shoppingcart_neu.tpl');
} // end show_shoppingcart
/**
* Rueckfall auf die alte Warenkorb-/Kassenansicht (27.09.2026, Go-Live der neuen Ansicht):
* ?ansicht=alt schaltet fuer die Sitzung auf die alten Templates, ?ansicht=neu hebt das auf.
* Haelt ueber die Formular-POSTs hinweg, weil die alten Templates keinen Parameter mitschicken.
* Dieselbe Weiche steht in website_cashdesk.php.
*/
private function alte_ansicht() {
if (isset($_GET['ansicht'])) {
$_SESSION['easyshop']['ansicht_alt'] = ($_GET['ansicht'] === 'alt') ? 1 : 0;
}
return !empty($_SESSION['easyshop']['ansicht_alt']);
}
/** @return array<int,array{module:string,label:string}> */
private function express_providers() {
$out = array();
@@ -1,21 +1,59 @@
<!-- content_cash_desk/completed.tpl -->
<div class="full_box">
<div class="title_wrapper">
<div class="title"><h2>Bestellung erfolgreich &uuml;bermittelt</h2></div>
<div class="clear"></div>
{* =====================================================================================
content_cash_desk/completed.tpl (theme2) -- Erfolgsseite "Bestellung uebermittelt".
Seit 27.09.2026 im Stil der neuen Kasse (Schrittleiste, Karte). Ziel des Redirects
/Kasse/?success=1&order=<nr> aus website_cashdesk.php (Vorkasse/Rechnung direkt,
PayPal v2 nach dem Capture). Der Text kommt aus dem Backend
(Konfiguration cash_desk_order_completed, Platzhalter [#order_number]).
===================================================================================== *}
{$ok_nr = (isset($order_number) && $order_number) ? $order_number : ''}
<div class="ok">
<div class="ok-steps">
<span class="ok-step ok-step-done">1&nbsp;Warenkorb</span>
<span class="ok-step ok-step-done">2&nbsp;Kasse</span>
<span class="ok-step ok-step-now">3&nbsp;Fertig</span>
</div>
<div class="box_content">
<div class="completed_box">
{$system_configuration.cash_desk_order_completed|replace:"[#order_number]":$order_number}
<div class="ok-card">
<div class="ok-icon" aria-hidden="true">&#10003;</div>
<h1 class="ok-title">Vielen Dank f&uuml;r Ihre Bestellung</h1>
{if $ok_nr}
<div class="ok-nr">Bestellnummer <strong>{$ok_nr|escape}</strong></div>
{/if}
<div class="ok-text completed_box">
{$system_configuration.cash_desk_order_completed|replace:"[#order_number]":$ok_nr}
</div>
<br><br>
{if $system_configuration.trusted_shop_buyer_protection == 1}
<div class="protection_box">
{include file='content_cash_desk/trusted_shop_buyer_protection.tpl'}
</div>
{/if}
<div class="ok-actions">
<a href="/" class="ok-btn ok-btn-primary">Weiter einkaufen</a>
</div>
</div>
</div>
{literal}
<style>
.ok { font-family: Arial, Helvetica, sans-serif; color: #222; font-size: 14px; line-height: 1.45; padding-bottom: 150px; max-width: 720px; }
.ok *, .ok *:before, .ok *:after { box-sizing: border-box; }
.ok-steps { display: flex; gap: 6px; margin-bottom: 14px; font-size: 12px; }
.ok-step { padding: 4px 10px; border-radius: 12px; background: #eee; color: #777; }
.ok-step-done { background: #e8f3e0; color: #3a6b1f; }
.ok-step-now { background: #FF6700; color: #fff; font-weight: 700; }
.ok-card { border: 1px solid #e3e3e3; border-radius: 8px; padding: 28px 24px; background: #fff; text-align: center; }
.ok-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; background: #e8f3e0; color: #3a6b1f; font-size: 30px; line-height: 56px; font-weight: 700; }
.ok-title { font-size: 24px; font-weight: 700; margin: 0 0 6px; }
.ok-nr { font-size: 16px; color: #555; margin-bottom: 18px; }
.ok-nr strong { color: #222; }
.ok-text { text-align: left; border-top: 1px solid #eee; padding-top: 16px; }
.ok-text p { margin: 0 0 10px; }
.ok-actions { margin-top: 20px; }
.ok-btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 26px; border-radius: 6px; font-size: 15px; font-weight: 700; text-decoration: none; border: 1px solid transparent; }
.ok-btn-primary { background: #FF6700; color: #fff; }
.ok-btn-primary:hover { background: #e45a00; color: #fff; }
</style>
{/literal}
@@ -0,0 +1,81 @@
{* =====================================================================================
content_cash_desk/payment_result.tpl (theme2) -- Rueckmeldung der Zahlungsanbieter
(core/payments): Weiterleitung zum Anbieter, Abbruch, ausstehend, Fehler.
Seit 27.09.2026 im Stil der neuen Kasse; ueberlagert die Fassung in easyshop_advanced.
Variablen wie dort: call, provider_label, payment_link, message, order_number.
===================================================================================== *}
{$pr_label = (isset($provider_label) && $provider_label) ? $provider_label : 'Zahlung'}
<div class="ok">
<div class="ok-steps">
<span class="ok-step ok-step-done">1&nbsp;Warenkorb</span>
<span class="ok-step ok-step-now">2&nbsp;Kasse</span>
<span class="ok-step">3&nbsp;Fertig</span>
</div>
<div class="ok-card cashdesk_payment_info">
{if $call == 'payment_open'}
<div class="ok-icon ok-icon-wait" aria-hidden="true">&rarr;</div>
<h1 class="ok-title">Weiter zu {$pr_label|escape}</h1>
<p>Vielen Dank f&uuml;r Ihre Bestellung. Sie werden jetzt zur Bezahlung weitergeleitet.<br />
Falls das nicht automatisch geschieht, klicken Sie bitte auf den Knopf.</p>
<meta http-equiv="refresh" content="0;url={$payment_link|escape}">
<div class="ok-actions">
<a href="{$payment_link|escape}" class="ok-btn ok-btn-primary">Weiter zu {$pr_label|escape}</a>
</div>
{elseif $call == 'payment_cancelled'}
<div class="ok-icon ok-icon-warn" aria-hidden="true">&times;</div>
<h1 class="ok-title">Bezahlung abgebrochen</h1>
<p>Ihr Warenkorb ist unver&auml;ndert. Sie k&ouml;nnen die Bestellung jederzeit
mit einer anderen Zahlart abschlie&szlig;en.</p>
<div class="ok-actions">
<a href="/Kasse/" class="ok-btn ok-btn-primary">Zur&uuml;ck zur Kasse</a>
<a href="/Warenkorb/" class="ok-btn ok-btn-ghost">Zum Warenkorb</a>
</div>
{elseif $call == 'payment_pending'}
<div class="ok-icon ok-icon-wait" aria-hidden="true">&hellip;</div>
<h1 class="ok-title">Zahlung wird gepr&uuml;ft</h1>
<p>{$message}</p>
{if $order_number}<div class="ok-nr">Ihre Bestellnummer: <strong>{$order_number|escape}</strong></div>{/if}
<div class="ok-actions">
<a href="/" class="ok-btn ok-btn-ghost">Weiter einkaufen</a>
</div>
{else}
<div class="ok-icon ok-icon-warn" aria-hidden="true">!</div>
<h1 class="ok-title">Das hat leider nicht geklappt</h1>
<p>{$message}</p>
{if $order_number}<div class="ok-nr">Bestellnummer: <strong>{$order_number|escape}</strong></div>{/if}
<div class="ok-actions">
<a href="/Kasse/" class="ok-btn ok-btn-primary">Zur&uuml;ck zur Kasse</a>
<a href="/Warenkorb/" class="ok-btn ok-btn-ghost">Zum Warenkorb</a>
</div>
{/if}
</div>
</div>
{literal}
<style>
.ok { font-family: Arial, Helvetica, sans-serif; color: #222; font-size: 14px; line-height: 1.45; padding-bottom: 150px; max-width: 720px; }
.ok *, .ok *:before, .ok *:after { box-sizing: border-box; }
.ok-steps { display: flex; gap: 6px; margin-bottom: 14px; font-size: 12px; }
.ok-step { padding: 4px 10px; border-radius: 12px; background: #eee; color: #777; }
.ok-step-done { background: #e8f3e0; color: #3a6b1f; }
.ok-step-now { background: #FF6700; color: #fff; font-weight: 700; }
.ok-card { border: 1px solid #e3e3e3; border-radius: 8px; padding: 28px 24px; background: #fff; text-align: center; }
.ok-card p { margin: 0 0 10px; }
.ok-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; background: #e8f3e0; color: #3a6b1f; font-size: 30px; line-height: 56px; font-weight: 700; }
.ok-icon-wait { background: #fff3e8; color: #a44a00; }
.ok-icon-warn { background: #fdecec; color: #8a1c1c; }
.ok-title { font-size: 24px; font-weight: 700; margin: 0 0 10px; }
.ok-nr { font-size: 16px; color: #555; margin: 8px 0 14px; }
.ok-nr strong { color: #222; }
.ok-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ok-btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 26px; border-radius: 6px; font-size: 15px; font-weight: 700; text-decoration: none; border: 1px solid transparent; }
.ok-btn-primary { background: #FF6700; color: #fff; }
.ok-btn-primary:hover { background: #e45a00; color: #fff; }
.ok-btn-ghost { background: #fff; color: #555; border-color: #cfcfcf; font-weight: 400; }
.ok-btn-ghost:hover { border-color: #999; color: #222; }
</style>
{/literal}
@@ -1,7 +1,6 @@
{* =====================================================================================
Kasse NEU (theme2) -- Entwurf 18.09.2026, liegt neben content_cash_desk.tpl.
Ansehen: /Kasse/?guest_order=1&ansicht=neu (Gast) bzw. /Kasse/?ansicht=neu (eingeloggt).
Weiche in website_cashdesk.php.
Kasse NEU (theme2) -- seit 27.09.2026 die Standardansicht von /Kasse/ (Gast: ?guest_order=1).
Rueckfall auf content_cash_desk.tpl: /Kasse/?ansicht=alt (Weiche in website_cashdesk.php).
Nur Darstellung ist neu. Alle Feldnamen, IDs und Klassen, an denen Modul und
content_cash_desk.js haengen, sind unveraendert: order_form, cashdesk_action,
@@ -19,14 +18,14 @@
{$ck_guest = (isset($guest_order) && $guest_order == 1)}
{$ck_express = (isset($express_active) && $express_active)}
{$ck_merchant = (isset($customer) && $customer->group_id == 101)}
{if $ck_guest}{$ck_url = "/Kasse/?guest_order=1&ansicht=neu"}{else}{$ck_url = "/Kasse/?ansicht=neu"}{/if}
{if $ck_guest}{$ck_url = "/Kasse/?guest_order=1"}{else}{$ck_url = "/Kasse/"}{/if}
<div class="ck">
<div class="ck-steps">
<a href="/Warenkorb/?ansicht=neu" class="ck-step ck-step-done">1&nbsp;Warenkorb</a>
<a href="/Warenkorb/" class="ck-step ck-step-done">1&nbsp;Warenkorb</a>
<span class="ck-step ck-step-now">2&nbsp;Kasse</span>
<span class="ck-step">3&nbsp;Fertig</span>
<a href="/Warenkorb/?ansicht=neu" class="ck-back">&larr; Zur&uuml;ck zum Warenkorb</a>
<a href="/Warenkorb/" class="ck-back">&larr; Zur&uuml;ck zum Warenkorb</a>
</div>
<h1 class="ck-title">Kasse{if $ck_guest} <span class="ck-muted">als Gast</span>{/if}</h1>
@@ -424,7 +423,8 @@
.ck-grid { display: flex; gap: 20px; align-items: flex-start; }
.ck-main { flex: 1 1 auto; min-width: 0; }
.ck-side { flex: 0 0 280px; position: sticky; top: 16px; }
/* top = Hoehe des klebenden Theme-Kopfes (.firststicky, 89px) + Luft, sonst schiebt sich der Kasten unters Logo (Tom, 18.09.) */
.ck-side { flex: 0 0 280px; position: sticky; top: 105px; }
.ck-sec { border: 1px solid #e3e3e3; border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; background: #fff; }
.ck-h { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; margin: 0 0 12px; }
@@ -1,6 +1,6 @@
{* =====================================================================================
Warenkorb NEU (theme2) -- Entwurf 18.09.2026, liegt neben content_shoppingcart.tpl.
Aufruf zum Anschauen: /Warenkorb/?ansicht=neu (Weiche in website_shoppingcart.php).
Warenkorb NEU (theme2) -- seit 27.09.2026 die Standardansicht von /Warenkorb/.
Rueckfall auf content_shoppingcart.tpl: /Warenkorb/?ansicht=alt (Weiche in website_shoppingcart.php).
Kein Tabellen-Markup mehr: jede Position ist eine Zeile (Bild, Name + Art.-Nr., Menge
mit Stepper, Preis, Entfernen), rechts ein Kasten mit Zwischensumme, MwSt, Gesamt und
@@ -22,7 +22,7 @@
<h1 class="wk-title">Warenkorb{if $shoppingcart.items} <span class="wk-count">{$shoppingcart.items|@count} {if $shoppingcart.items|@count == 1}Artikel{else}Artikel{/if}</span>{/if}</h1>
{if $shoppingcart.items}
<form method="post" action="/Warenkorb/?ansicht=neu" id="cart_form" class="wk-grid">
<form method="post" action="/Warenkorb/" id="cart_form" class="wk-grid">
<input type="hidden" name="cart_goto" id="cart_goto" value="" />
<div class="wk-list">
@@ -130,7 +130,8 @@
.wk { container-type: inline-size; }
.wk-grid { display: flex; gap: 20px; align-items: flex-start; }
.wk-list { flex: 1 1 auto; min-width: 0; }
.wk-side { flex: 0 0 260px; position: sticky; top: 16px; }
/* top = Hoehe des klebenden Theme-Kopfes (.firststicky, 89px) + Luft, sonst schiebt sich der Kasten unters Logo (Tom, 18.09.) */
.wk-side { flex: 0 0 260px; position: sticky; top: 105px; }
.wk-box { background: #fafafa; border: 1px solid #e3e3e3; border-radius: 8px; padding: 16px; }
/* Gewaehrleistungs-Label ueber dem Kasten: volle Breite der Spalte, Hoehe folgt dem Seitenverhaeltnis
(Tom, 18.09.), Klick oeffnet das Label gross in neuem Tab */