From d043ef29a2677990abe3e671d3c464ca5db2df76 Mon Sep 17 00:00:00 2001 From: Mihael Date: Mon, 2 Jun 2025 17:05:24 +0200 Subject: [PATCH] switcher always visible, but postpaid option only if in postpaid customer group. Removed inline style --- b2bpayments.php | 7 ++++-- .../hook/breadcrumb_payment_switcher.tpl | 23 ++++++++----------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/b2bpayments.php b/b2bpayments.php index 15baa08..ca0005d 100644 --- a/b2bpayments.php +++ b/b2bpayments.php @@ -316,16 +316,19 @@ class B2BPayments extends PaymentModule implements PrestaShop\PrestaShop\Core\Mo { $customer = $this->context->customer; + $group_ids = Customer::getGroupsStatic((int)$customer->id); + $postpaid_group_id = (int)Configuration::get('B2BPAYMENTS_POSTPAID_GROUP'); $prepaid_group_id = (int)Configuration::get('B2BPAYMENTS_PREPAID_GROUP'); - if ($customer->isLogged() && $this->isCustomerInGroup($customer->id, $postpaid_group_id) && $this->isCustomerInGroup($customer->id, $prepaid_group_id)) { + if ($customer->isLogged() /*&& $this->isCustomerInGroup($customer->id, $postpaid_group_id)*/ && $this->isCustomerInGroup($customer->id, $prepaid_group_id)) { return array( 'show_switch' => true, 'postpaid_group_id' => $postpaid_group_id, 'prepaid_group_id' => $prepaid_group_id, 'current_group_is_postpaid' => $this->isDefaultCustomerGroup($customer->id, $postpaid_group_id), - 'switch_url' => $this->context->link->getModuleLink($this->name, 'switch', array(), true) + 'switch_url' => $this->context->link->getModuleLink($this->name, 'switch', array(), true), + 'customer_groups' => $group_ids ); } diff --git a/views/templates/hook/breadcrumb_payment_switcher.tpl b/views/templates/hook/breadcrumb_payment_switcher.tpl index 40dedac..1650f18 100644 --- a/views/templates/hook/breadcrumb_payment_switcher.tpl +++ b/views/templates/hook/breadcrumb_payment_switcher.tpl @@ -1,14 +1,7 @@ {if $show_switch} - -
+
- {* The select dropdown *} -
- +