From 91d90b6714e55445cca1c6bfdf548e73edd975bf Mon Sep 17 00:00:00 2001 From: Thomas Bartelt Date: Sun, 27 Sep 2026 22:43:55 +0200 Subject: [PATCH] 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 --- core/payments/install_mollie.sql | 10 +-- modules/website_dyncontent.php | 46 ++++++++++++++ .../templates/content_box_zahlarten.tpl | 62 +++++++++++++++++++ 3 files changed, 113 insertions(+), 5 deletions(-) create mode 100644 web/intelectra_shop/themes/theme2/templates/content_box_zahlarten.tpl diff --git a/core/payments/install_mollie.sql b/core/payments/install_mollie.sql index 4f3f00e..53a0921 100644 --- a/core/payments/install_mollie.sql +++ b/core/payments/install_mollie.sql @@ -13,23 +13,23 @@ -- (active_/add_/account_type_/free_payment_). Neue Keys = neue Spalten. -- Aufschlaege sind bei Karten/Klarna/Wallets ohnehin nicht zulaessig -> add=0, aktiv=1. 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 `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 `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 `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 `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 `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 `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 `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 `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 `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; diff --git a/modules/website_dyncontent.php b/modules/website_dyncontent.php index 0a478bd..2c68bc9 100644 --- a/modules/website_dyncontent.php +++ b/modules/website_dyncontent.php @@ -392,6 +392,12 @@ class website_dyncontent { $var_data = array(); $var_data['[#HIDDEN_TEXT_START]'] = ''; $var_data['[#HIDDEN_TEXT_END]'] = ' mehr>><<weniger'; + // 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); @@ -401,6 +407,46 @@ class website_dyncontent { 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_, + * 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) { $config = array(); eval($block->configuration); diff --git a/web/intelectra_shop/themes/theme2/templates/content_box_zahlarten.tpl b/web/intelectra_shop/themes/theme2/templates/content_box_zahlarten.tpl new file mode 100644 index 0000000..55ad409 --- /dev/null +++ b/web/intelectra_shop/themes/theme2/templates/content_box_zahlarten.tpl @@ -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) + ===================================================================================== *} +
+ {if $zahlarten} + {foreach from=$zahlarten item=pm} +
+ +
+
{$pm->name|escape} + {if $pm->module == 'mollie' && $pm->argument == 'applepay'}(auf Apple-Geräten){/if} + {if $pm->module == 'mollie' && $pm->argument == 'creditcard'}Visa, Mastercard, American Express{/if} +
+ {if $pm->order_text}
{$pm->order_text}
{/if} + {if isset($pm->paymentAddShown) && $pm->paymentAddShown != 0} +
+ {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":",":"."} €{/if} + {if $pm->freePayment > 0} (entfällt ab {$pm->freePayment|number_format:"2":",":"."} € Warenwert){/if} +
+ {/if} +
+
+ {/foreach} + {else} +

Derzeit sind keine Zahlarten hinterlegt.

+ {/if} +
+{literal} + +{/literal}