feat(warenkorb): Entwurf neue Ansicht content_shoppingcart_neu.tpl (Zeilen statt Tabelle, Stepper, Summenkasten), Weiche ?ansicht=neu; Alt-Text am Thumbnail entfernt
This commit is contained in:
@@ -78,6 +78,10 @@ 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') {
|
||||
return $this->layout_object->_fetch('content_shoppingcart_neu.tpl');
|
||||
}
|
||||
return $this->layout_object->_fetch('content_shoppingcart.tpl');
|
||||
} // end show_shoppingcart
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<tr class="cart_row">
|
||||
<td class="alcenter">{$smarty.foreach.items_loop.iteration}</td>
|
||||
<td class="alcenter">
|
||||
<a href="{$serverProtocol}://{$servername}{$itemSuri}"><img src="{$SHOP_DIR}images/article/thumb_{if $item->default_image_file_name}{$item->default_image_file_name}{else}default_image.png{/if}" alt="{$item->name|escape}" /></a>
|
||||
<a href="{$serverProtocol}://{$servername}{$itemSuri}"><img src="{$SHOP_DIR}images/article/thumb_{if $item->default_image_file_name}{$item->default_image_file_name}{else}default_image.png{/if}" alt="" /></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{$serverProtocol}://{$servername}{$itemSuri}"><strong>{$item->name}</strong></a><br />
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
{* =====================================================================================
|
||||
Warenkorb NEU (theme2) -- Entwurf 18.09.2026, liegt neben content_shoppingcart.tpl.
|
||||
Aufruf zum Anschauen: /Warenkorb/?ansicht=neu (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
|
||||
den Buttons. Auf schmalen Bildschirmen stapelt sich alles. Anmerkung ist aufklappbar.
|
||||
|
||||
Vertrag mit dem Modul unveraendert: update_item[<cart_item_id>], customer_info,
|
||||
cart_goto ('' | 'kasse' | 'express:<modul>'). CSS ist auf .wk begrenzt und liegt hier
|
||||
im Template, damit das Theme-CSS nicht angefasst werden muss.
|
||||
===================================================================================== *}
|
||||
<div class="wk">
|
||||
<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">
|
||||
<input type="hidden" name="cart_goto" id="cart_goto" value="" />
|
||||
|
||||
<div class="wk-list">
|
||||
{foreach from=$shoppingcart.items item=item name=items_loop}
|
||||
{if $item->short_uri}
|
||||
{assign var=itemSuri value="/`$item->short_uri`.html"}
|
||||
{else}
|
||||
{assign var=itemSuri value="/index.php?item_id=`$item->id`"}
|
||||
{/if}
|
||||
<div class="wk-row item_container" buy_quantity="{$item->buy_quantity}" min_quantity="{$item->min_quantity}">
|
||||
<a class="wk-img" href="{$itemSuri}">
|
||||
<img src="{$SHOP_DIR}images/article/thumb_{if $item->default_image_file_name}{$item->default_image_file_name}{else}default_image.png{/if}" alt="" />
|
||||
</a>
|
||||
<div class="wk-info">
|
||||
<a class="wk-name" href="{$itemSuri}">{$item->name}</a>
|
||||
{if $item->variant_1 || $item->variant_2}
|
||||
<div class="wk-variant">{$item->variant_1} {$item->variant_2}</div>
|
||||
{/if}
|
||||
<div class="wk-nr">
|
||||
{if ($item->variant_1 || $item->variant_2) && $item->item_number}
|
||||
Art.-Nr. {$item->item_number}
|
||||
{elseif $item->attribute_7 && $item->number != $item->attribute_7}
|
||||
Art.-Nr. {$item->attribute_7} <span class="wk-nr-old">({$template_text.item_details.old_item_number_title} {$item->number})</span>
|
||||
{else}
|
||||
Art.-Nr. {$item->number}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="wk-unit">{$item->calculatedPrices.shownPrice|number_format:"2":",":"."} € / Stück</div>
|
||||
<div class="message_min_quantity wk-msg">Mindestabnahme: {$item->min_quantity} Stück.</div>
|
||||
<div class="message_wrong_quantity wk-msg">Nur in {$item->buy_quantity}er Schritten bestellbar.</div>
|
||||
</div>
|
||||
<div class="wk-qty">
|
||||
<button type="button" class="wk-step" data-step="-1" aria-label="Menge verringern">−</button>
|
||||
<input type="text" name="update_item[{$item->shopping_cart_item_id}]" class="input_quantity" value="{$item->quantity}" inputmode="numeric" aria-label="Anzahl" />
|
||||
<button type="button" class="wk-step" data-step="1" aria-label="Menge erhöhen">+</button>
|
||||
</div>
|
||||
<div class="wk-sum">{($item->calculatedPrices.shownPrice * $item->quantity)|number_format:"2":",":"."} €</div>
|
||||
<a href="#" class="item_delete wk-del" title="Artikel entfernen" aria-label="Artikel entfernen">×</a>
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
{if $system_configuration.shoppingcart_ordertext == 1}
|
||||
<details class="wk-note"{if isset($customer_info) && $customer_info} open{/if}>
|
||||
<summary>Anmerkung zur Bestellung <span class="wk-muted">(optional)</span></summary>
|
||||
<p class="wk-muted">Zum Beispiel Gerätetyp, Farbe oder ein Hinweis für den Versand. In der Kasse noch änderbar.</p>
|
||||
<textarea id="customer_info" name="customer_info" rows="3">{if isset($customer_info)}{$customer_info|escape}{/if}</textarea>
|
||||
</details>
|
||||
{/if}
|
||||
|
||||
<div class="wk-continue"><a href="/">← Weiter einkaufen</a></div>
|
||||
</div>
|
||||
|
||||
<aside class="wk-box">
|
||||
<div class="wk-line"><span>Zwischensumme</span><span>{$shoppingcart.shown_price_sum|number_format:"2":",":"."} €</span></div>
|
||||
{foreach $shoppingcart.tax_values as $taxRate => $taxData}
|
||||
<div class="wk-line wk-muted"><span>{if $shoppingcartVATUsage}inkl. MwSt.{else}zzgl. MwSt.{/if} {$taxRate} %</span><span>{$taxData['vat']|number_format:"2":",":"."} €</span></div>
|
||||
{/foreach}
|
||||
<div class="wk-line wk-muted"><span>Versand</span><span>wird in der Kasse berechnet</span></div>
|
||||
<div class="wk-line wk-total"><span>Gesamt</span><span>{$shoppingcart.price_sum_gross|number_format:"2":",":"."} €</span></div>
|
||||
<div class="wk-taxtext wk-muted">{$shoppingcart.price_tax_text|replace:'[tax]%':''}</div>
|
||||
|
||||
<button type="button" id="cashdesk_button" class="wk-btn wk-btn-primary">Zur Kasse</button>
|
||||
{if isset($express_providers) && $express_providers}
|
||||
{foreach from=$express_providers item=xp}
|
||||
{if $xp.module == 'paypal_v2'}
|
||||
<a href="/Kasse/?payment_express_start={$xp.module}" class="wk-btn wk-btn-paypal express_start" data-module="{$xp.module}" title="Direkt mit PayPal bezahlen – Adresse kommt von PayPal, Sie prüfen die Bestellung danach in der Kasse">
|
||||
<img src="https://www.paypalobjects.com/webstatic/de_DE/i/de-pp-logo-100px.png" alt="PayPal"><span>Direkt bezahlen</span>
|
||||
</a>
|
||||
{else}
|
||||
<a href="/Kasse/?payment_express_start={$xp.module}" class="wk-btn wk-btn-paypal express_start" data-module="{$xp.module}">Direkt mit {$xp.label|escape} bezahlen</a>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
<button type="button" id="update_cart" class="wk-btn wk-btn-ghost">Mengen aktualisieren</button>
|
||||
<div class="wk-trust wk-muted">Sichere Zahlung · Versand aus Deutschland</div>
|
||||
</aside>
|
||||
</form>
|
||||
{else}
|
||||
<div class="wk-empty">
|
||||
<p>Ihr Warenkorb ist leer.</p>
|
||||
<a href="/" class="wk-btn wk-btn-primary wk-btn-inline">Weiter einkaufen</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $system_configuration.shoppingcart_quickbuy == 1}
|
||||
<div class="wk-quick">
|
||||
<div class="wk-quick-title">Schnell hinzufügen</div>
|
||||
<input type="text" id="shoppingcart_search_item" name="search_item" autocomplete="off" placeholder="Artikelnummer oder Bezeichnung …" />
|
||||
<div id="shoppingcart_search_result" style="position:relative;z-index:999999;"></div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{literal}
|
||||
<style>
|
||||
.wk { font-family: Arial, Helvetica, sans-serif; color: #222; font-size: 14px; line-height: 1.45; }
|
||||
.wk *, .wk *:before, .wk *:after { box-sizing: border-box; }
|
||||
.wk-title { font-size: 24px; font-weight: 700; margin: 4px 0 18px; }
|
||||
.wk-count { font-size: 14px; font-weight: 400; color: #777; margin-left: 8px; }
|
||||
.wk-muted { color: #777; font-weight: 400; }
|
||||
|
||||
.wk-grid { display: flex; gap: 28px; align-items: flex-start; }
|
||||
.wk-list { flex: 1 1 auto; min-width: 0; }
|
||||
.wk-box { flex: 0 0 300px; position: sticky; top: 16px; background: #fafafa; border: 1px solid #e3e3e3; border-radius: 8px; padding: 18px; }
|
||||
|
||||
.wk-row { display: grid; grid-template-columns: 84px 1fr auto auto 28px; gap: 14px; align-items: center;
|
||||
padding: 14px 0; border-bottom: 1px solid #e6e6e6; }
|
||||
.wk-img img { width: 84px; height: 84px; object-fit: contain; background: #fff; border: 1px solid #eee; border-radius: 6px; display: block; }
|
||||
.wk-name { font-weight: 700; color: #222; text-decoration: none; }
|
||||
.wk-name:hover { color: #FF6700; }
|
||||
.wk-variant, .wk-nr, .wk-unit { color: #666; font-size: 13px; margin-top: 2px; }
|
||||
.wk-nr-old { color: #999; }
|
||||
.wk-msg { display: none; margin-top: 6px; padding: 5px 8px; background: #fff3e8; border: 1px solid #ffc89b; color: #a44a00; font-size: 12px; border-radius: 4px; }
|
||||
|
||||
.wk-qty { display: inline-flex; border: 1px solid #cfcfcf; border-radius: 6px; overflow: hidden; background: #fff; }
|
||||
.wk-qty .wk-step { width: 32px; height: 34px; border: 0; background: #f4f4f4; color: #333; font-size: 18px; cursor: pointer; }
|
||||
.wk-qty .wk-step:hover { background: #e9e9e9; }
|
||||
.wk-qty .input_quantity { width: 46px; height: 34px; border: 0; border-left: 1px solid #e3e3e3; border-right: 1px solid #e3e3e3; text-align: center; font-size: 14px; }
|
||||
.wk-sum { font-weight: 700; min-width: 80px; text-align: right; white-space: nowrap; }
|
||||
.wk-del { color: #999; text-decoration: none; font-size: 22px; line-height: 1; text-align: center; }
|
||||
.wk-del:hover { color: #d00; }
|
||||
|
||||
.wk-note { margin: 16px 0 0; padding: 12px 14px; border: 1px dashed #d5d5d5; border-radius: 6px; }
|
||||
.wk-note summary { cursor: pointer; font-weight: 700; }
|
||||
.wk-note p { margin: 8px 0 6px; font-size: 13px; }
|
||||
.wk-note textarea { width: 100%; border: 1px solid #cfcfcf; border-radius: 6px; padding: 8px; font: inherit; }
|
||||
.wk-continue { margin-top: 18px; }
|
||||
.wk-continue a { color: #555; text-decoration: none; }
|
||||
.wk-continue a:hover { color: #FF6700; }
|
||||
|
||||
.wk-line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
|
||||
.wk-total { border-top: 1px solid #ddd; margin-top: 8px; padding-top: 12px; font-size: 18px; font-weight: 700; }
|
||||
.wk-taxtext { font-size: 12px; margin: -2px 0 14px; }
|
||||
|
||||
.wk-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 44px;
|
||||
margin-top: 10px; border-radius: 6px; font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none; border: 1px solid transparent; }
|
||||
.wk-btn-inline { display: inline-flex; width: auto; padding: 0 22px; }
|
||||
.wk-btn-primary { background: #FF6700; color: #fff; }
|
||||
.wk-btn-primary:hover { background: #e45a00; color: #fff; }
|
||||
.wk-btn-paypal { background: #ffc439; color: #003087; }
|
||||
.wk-btn-paypal:hover { background: #f2ba36; color: #003087; }
|
||||
.wk-btn-paypal img { height: 20px; width: auto; }
|
||||
.wk-btn-ghost { background: #fff; color: #555; border-color: #cfcfcf; font-weight: 400; height: 38px; font-size: 13px; }
|
||||
.wk-btn-ghost:hover { border-color: #999; }
|
||||
.wk-trust { text-align: center; font-size: 12px; margin-top: 12px; }
|
||||
|
||||
.wk-empty { padding: 30px 0; }
|
||||
.wk-empty p { font-size: 16px; margin-bottom: 14px; }
|
||||
|
||||
.wk-quick { margin-top: 36px; padding-top: 18px; border-top: 1px solid #e6e6e6; }
|
||||
.wk-quick-title { font-weight: 700; margin-bottom: 6px; }
|
||||
.wk-quick input { width: 100%; max-width: 480px; height: 38px; border: 1px solid #cfcfcf; border-radius: 6px; padding: 0 10px; font: inherit; }
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.wk-grid { display: block; }
|
||||
.wk-box { position: static; margin-top: 20px; }
|
||||
.wk-row { grid-template-columns: 64px 1fr 28px; grid-template-areas: "img info del" "img qty sum"; }
|
||||
.wk-img { grid-area: img; } .wk-info { grid-area: info; } .wk-del { grid-area: del; }
|
||||
.wk-qty { grid-area: qty; justify-self: start; } .wk-sum { grid-area: sum; }
|
||||
.wk-img img { width: 64px; height: 64px; }
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
function mengenOk() {
|
||||
var ok = true;
|
||||
$('.item_container').each(function() {
|
||||
var buy_quantity = parseInt($(this).attr('buy_quantity'));
|
||||
var min_quantity = parseInt($(this).attr('min_quantity'));
|
||||
var quantity = parseInt($('.input_quantity', this).val());
|
||||
$('.wk-msg', this).hide();
|
||||
if (isNaN(quantity) || quantity == 0) { return; }
|
||||
if (min_quantity > 1 && quantity < min_quantity) { $('.message_min_quantity', this).show(); ok = false; }
|
||||
else if (buy_quantity > 1 && (quantity % buy_quantity) != 0) { $('.message_wrong_quantity', this).show(); ok = false; }
|
||||
});
|
||||
return ok;
|
||||
}
|
||||
function absenden(ziel) {
|
||||
if (!mengenOk()) { return; }
|
||||
$('#cart_goto').val(ziel);
|
||||
$('#cart_form').submit();
|
||||
}
|
||||
$('#update_cart').click(function(e) { e.preventDefault(); absenden(''); });
|
||||
$('#cashdesk_button').click(function(e) { e.preventDefault(); absenden('kasse'); });
|
||||
$('.express_start').click(function(e) { e.preventDefault(); absenden('express:' + $(this).data('module')); });
|
||||
$('.item_delete').click(function(e) { e.preventDefault(); $('.input_quantity', $(this).closest('.wk-row')).val(0); absenden(''); });
|
||||
|
||||
// Stepper: Menge in Staffelschritten aendern und sofort speichern
|
||||
$('.wk-step').click(function(e) {
|
||||
e.preventDefault();
|
||||
var row = $(this).closest('.wk-row');
|
||||
var input = $('.input_quantity', row);
|
||||
var step = parseInt($(this).data('step'));
|
||||
var buy = parseInt(row.attr('buy_quantity')) || 1; if (buy < 1) { buy = 1; }
|
||||
var min = parseInt(row.attr('min_quantity')) || 1; if (min < 1) { min = 1; }
|
||||
var q = parseInt(input.val()) || 0;
|
||||
q = q + step * buy;
|
||||
if (q < min) { q = (step < 0) ? 0 : min; } // unter Mindestmenge = entfernen
|
||||
input.val(q);
|
||||
absenden('');
|
||||
});
|
||||
// Enter im Mengenfeld = aktualisieren, nicht das Formular blind abschicken
|
||||
$('.input_quantity').keydown(function(e) { if (e.keyCode == 13) { e.preventDefault(); absenden(''); } });
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
Reference in New Issue
Block a user