feat(cms): Platzhalter [#zahlarten] in Textboxen -- Liste der aktiven Zahlarten der Kundengruppe aus der Kassen-Logik (Seite Bezahlarten nicht mehr von Hand); Mollie-Aktivschalter in shipping_area auf gruppenspezifisch (2), sonst saehen Haendler Mollie

This commit is contained in:
Thomas Bartelt
2026-09-27 22:43:55 +02:00
parent 21977b8f41
commit 91d90b6714
3 changed files with 113 additions and 5 deletions
+5 -5
View File
@@ -13,23 +13,23 @@
-- (active_/add_/account_type_/free_payment_<key>). Neue Keys = neue Spalten. -- (active_/add_/account_type_/free_payment_<key>). Neue Keys = neue Spalten.
-- Aufschlaege sind bei Karten/Klarna/Wallets ohnehin nicht zulaessig -> add=0, aktiv=1. -- Aufschlaege sind bei Karten/Klarna/Wallets ohnehin nicht zulaessig -> add=0, aktiv=1.
ALTER TABLE `shipping_area` ALTER TABLE `shipping_area`
ADD COLUMN IF NOT EXISTS `active_mollie_klarna` TINYINT(2) NOT NULL DEFAULT 1, ADD COLUMN IF NOT EXISTS `active_mollie_klarna` TINYINT(2) NOT NULL DEFAULT 2,
ADD COLUMN IF NOT EXISTS `add_mollie_klarna` DECIMAL(9,2) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `add_mollie_klarna` DECIMAL(9,2) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `account_type_mollie_klarna` TINYINT(4) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `account_type_mollie_klarna` TINYINT(4) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `free_payment_mollie_klarna` DECIMAL(6,2) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `free_payment_mollie_klarna` DECIMAL(6,2) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `active_mollie_creditcard` TINYINT(2) NOT NULL DEFAULT 1, ADD COLUMN IF NOT EXISTS `active_mollie_creditcard` TINYINT(2) NOT NULL DEFAULT 2,
ADD COLUMN IF NOT EXISTS `add_mollie_creditcard` DECIMAL(9,2) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `add_mollie_creditcard` DECIMAL(9,2) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `account_type_mollie_creditcard` TINYINT(4) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `account_type_mollie_creditcard` TINYINT(4) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `free_payment_mollie_creditcard` DECIMAL(6,2) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `free_payment_mollie_creditcard` DECIMAL(6,2) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `active_mollie_applepay` TINYINT(2) NOT NULL DEFAULT 1, ADD COLUMN IF NOT EXISTS `active_mollie_applepay` TINYINT(2) NOT NULL DEFAULT 2,
ADD COLUMN IF NOT EXISTS `add_mollie_applepay` DECIMAL(9,2) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `add_mollie_applepay` DECIMAL(9,2) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `account_type_mollie_applepay` TINYINT(4) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `account_type_mollie_applepay` TINYINT(4) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `free_payment_mollie_applepay` DECIMAL(6,2) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `free_payment_mollie_applepay` DECIMAL(6,2) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `active_mollie_googlepay` TINYINT(2) NOT NULL DEFAULT 1, ADD COLUMN IF NOT EXISTS `active_mollie_googlepay` TINYINT(2) NOT NULL DEFAULT 2,
ADD COLUMN IF NOT EXISTS `add_mollie_googlepay` DECIMAL(9,2) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `add_mollie_googlepay` DECIMAL(9,2) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `account_type_mollie_googlepay` TINYINT(4) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `account_type_mollie_googlepay` TINYINT(4) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `free_payment_mollie_googlepay` DECIMAL(6,2) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `free_payment_mollie_googlepay` DECIMAL(6,2) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `active_mollie_paybybank` TINYINT(2) NOT NULL DEFAULT 1, ADD COLUMN IF NOT EXISTS `active_mollie_paybybank` TINYINT(2) NOT NULL DEFAULT 2,
ADD COLUMN IF NOT EXISTS `add_mollie_paybybank` DECIMAL(9,2) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `add_mollie_paybybank` DECIMAL(9,2) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `account_type_mollie_paybybank` TINYINT(4) NOT NULL DEFAULT 0, ADD COLUMN IF NOT EXISTS `account_type_mollie_paybybank` TINYINT(4) NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS `free_payment_mollie_paybybank` DECIMAL(6,2) NOT NULL DEFAULT 0; ADD COLUMN IF NOT EXISTS `free_payment_mollie_paybybank` DECIMAL(6,2) NOT NULL DEFAULT 0;
+46
View File
@@ -392,6 +392,12 @@ class website_dyncontent {
$var_data = array(); $var_data = array();
$var_data['[#HIDDEN_TEXT_START]'] = '<span class="text_box_hidden_text">'; $var_data['[#HIDDEN_TEXT_START]'] = '<span class="text_box_hidden_text">';
$var_data['[#HIDDEN_TEXT_END]'] = ' </span> <a class="text_box_link_show_text" href="#">mehr&gt;&gt;</a><a class="text_box_link_hide_text" href="#">&lt;&lt;weniger</a>'; $var_data['[#HIDDEN_TEXT_END]'] = ' </span> <a class="text_box_link_show_text" href="#">mehr&gt;&gt;</a><a class="text_box_link_hide_text" href="#">&lt;&lt;weniger</a>';
// 27.09.2026 -- [#zahlarten]: Liste der aktiven Zahlarten der Kundengruppe (Tom: die
// CMS-Seite "Bezahlarten" soll nicht mehr von Hand gepflegt werden, sondern dem
// Aktiv-Schalter im Backend folgen).
if (strpos($block->content, '[#zahlarten]') !== false) {
$var_data['[#zahlarten]'] = $this->zahlarten_liste();
}
$block->content = strtr($block->content, $var_data); $block->content = strtr($block->content, $var_data);
@@ -401,6 +407,46 @@ class website_dyncontent {
return $this->layout_object->_fetch('content_box_textbox.tpl'); return $this->layout_object->_fetch('content_box_textbox.tpl');
} }
/**
* Zahlarten, die der Besucher in der Kasse bekaeme -- dieselbe Quelle wie die Kasse
* (Payment_method::getMethodsForGroup: payment_methods.active, shipping_area.active_<key>,
* Kundengruppen-Freischaltung). Besucher (Gruppe 100) sehen die Gast-Zahlarten, weil sie
* als Gast bestellen; Haendler ihr B2B-Versandgebiet. Bankeinzug/Rechnung nur, wenn der
* angemeldete Kunde dafuer freigeschaltet ist (wie in content_cash_desk_neu.tpl).
*/
private function zahlarten_liste() {
try {
include_once './core/payment_method.class.php';
$group = (int)$this->base_object->customer_group->id;
if ($group <= 0 || $group == 100) {
$group = 103; // Gast
}
$area = ($group == 101) ? 30 : 1; // Deutschland-B2B / Deutschland-B2C
$pm_object = new Payment_method($this->base_object);
$all = $pm_object->getMethodsForGroup($group, -1, $area);
$customer = $this->base_object->customer;
$list = array();
foreach ((array)$all as $pm) {
if (!isset($pm->activeType) || $pm->activeType <= 0) {
continue;
}
if ($pm->helperjoinkey == 'be' && empty($customer->direct_debit_active)) {
continue;
}
if ($pm->helperjoinkey == 'r' && empty($customer->rechnung_active)) {
continue;
}
$list[] = $pm;
}
$this->layout_object->assign('zahlarten', $list);
$this->layout_object->assign('zahlarten_gruppe', $group);
return $this->layout_object->_fetch('content_box_zahlarten.tpl');
} catch (Throwable $e) {
error_log('zahlarten_liste: '.$e->getMessage());
return '';
}
}
private function banner($structure_id, $block) { private function banner($structure_id, $block) {
$config = array(); $config = array();
eval($block->configuration); eval($block->configuration);
@@ -0,0 +1,62 @@
{* =====================================================================================
content_box_zahlarten.tpl -- Liste der aktiven Zahlarten fuer die Kundengruppe des
Besuchers. Wird ueber den Platzhalter [#zahlarten] in einer CMS-Textbox eingefuegt
(website_dyncontent.php::zahlarten_liste, 27.09.2026). Quelle: payment_methods +
customer_group_payment_method_configuration + shipping_area (dieselbe Logik wie die
Kasse) -- was im Backend aktiv ist, steht hier; nichts mehr von Hand pflegen.
Variablen: zahlarten (Liste), zahlarten_gruppe (Gruppen-id), zahlarten_mwst (show_tax)
===================================================================================== *}
<div class="zl">
{if $zahlarten}
{foreach from=$zahlarten item=pm}
<div class="zl-row zl-{$pm->module|default:'std'}{if $pm->module == 'mollie'} zl-{$pm->argument|escape}{/if}">
<div class="zl-logo">
{if $pm->module == 'mollie' && $pm->argument}
<img src="https://www.mollie.com/external/icons/payment-methods/{$pm->argument|escape:'url'}.svg" alt="{$pm->name|escape}" />
{elseif $pm->module == 'paypal_v2' || $pm->module == 'paypal'}
<img src="https://www.paypalobjects.com/webstatic/de_DE/i/de-pp-logo-100px.png" alt="PayPal" />
{elseif $pm->module == 'prepayment'}
<span class="zl-icon">&#8644;</span>
{elseif $pm->module == 'collect_on_delivery'}
<span class="zl-icon">&#128230;</span>
{elseif $pm->module == 'direct_debit'}
<span class="zl-icon">&#8645;</span>
{else}
<span class="zl-icon">&#8226;</span>
{/if}
</div>
<div class="zl-body">
<div class="zl-name">{$pm->name|escape}
{if $pm->module == 'mollie' && $pm->argument == 'applepay'}<span class="zl-muted">(auf Apple-Ger&auml;ten)</span>{/if}
{if $pm->module == 'mollie' && $pm->argument == 'creditcard'}<span class="zl-muted">Visa, Mastercard, American Express</span>{/if}
</div>
{if $pm->order_text}<div class="zl-text">{$pm->order_text}</div>{/if}
{if isset($pm->paymentAddShown) && $pm->paymentAddShown != 0}
<div class="zl-fee">
{if $pm->accountType == '1' || $pm->accountType == '3'}Abzug{else}Aufschlag{/if}:
{if $pm->accountType == '2' || $pm->accountType == '3'}{$pm->rawAdd|number_format:"2":",":"."} %{else}{$pm->paymentAddShown|abs|number_format:"2":",":"."} &euro;{/if}
{if $pm->freePayment > 0} (entf&auml;llt ab {$pm->freePayment|number_format:"2":",":"."} &euro; Warenwert){/if}
</div>
{/if}
</div>
</div>
{/foreach}
{else}
<p>Derzeit sind keine Zahlarten hinterlegt.</p>
{/if}
</div>
{literal}
<style>
.zl { margin: 10px 0 18px; }
.zl *, .zl *:before, .zl *:after { box-sizing: border-box; }
.zl-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; margin-bottom: 8px; background: #fff; border: 1px solid #e3e3e3; border-radius: 8px; }
.zl-logo { flex: 0 0 56px; display: flex; align-items: center; justify-content: center; height: 32px; }
.zl-logo img { max-width: 56px; max-height: 32px; width: auto; height: auto; }
.zl-icon { font-size: 22px; color: #FF6700; line-height: 32px; }
.zl-body { flex: 1 1 auto; min-width: 0; }
.zl-name { font-weight: 700; font-size: 15px; }
.zl-muted { font-weight: 400; color: #777; font-size: 13px; margin-left: 6px; }
.zl-text { color: #444; font-size: 13px; margin-top: 3px; }
.zl-fee { color: #a44a00; font-size: 12px; margin-top: 4px; }
</style>
{/literal}