From 8b5ab3c9d824eb9a75b8b849bf203e7852f98165 Mon Sep 17 00:00:00 2001 From: GuilhermeLinkNacional Date: Wed, 20 Mar 2024 15:44:42 -0300 Subject: [PATCH] feat: Adding MultiPayments option to payment options #21 --- admin/class-wc-invoice-payment-admin.php | 48 ++++++++++++------------ public/js/wc-invoice-payment-public.js | 2 + 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/admin/class-wc-invoice-payment-admin.php b/admin/class-wc-invoice-payment-admin.php index cc87571..d8997d5 100755 --- a/admin/class-wc-invoice-payment-admin.php +++ b/admin/class-wc-invoice-payment-admin.php @@ -245,7 +245,7 @@ class="wcip-form-wrap" name="lkn_wcip_payment_global_template" id="lkn_wcip_payment_global_template" class="regular-text" - > + > @@ -428,13 +428,14 @@ class="regular-text" class="regular-text" > $gateway) { - if ($order->get_payment_method() === $gateway->id) { - echo ''; - } else { - echo ''; - } - } ?> + echo ''; + foreach ($enabled_gateways as $key => $gateway) { + if ($order->get_payment_method() === $gateway->id) { + echo ''; + } else { + echo ''; + } + } ?>
@@ -446,13 +447,13 @@ class="regular-text" class="regular-text" > $currency) { - if ($order->get_currency() === $code) { - echo ''; - } else { - echo ''; - } - } ?> + foreach ($currencies as $code => $currency) { + if ($order->get_currency() === $code) { + echo ''; + } else { + echo ''; + } + } ?>
@@ -852,6 +853,7 @@ class="regular-text" class="regular-text" > Multiple payment'; foreach ($enabled_gateways as $key => $gateway) { echo ''; } ?> @@ -866,13 +868,13 @@ class="regular-text" class="regular-text" > $currency) { - if ($active_currency === $code) { - echo ''; - } else { - echo ''; - } - } ?> + foreach ($currencies as $code => $currency) { + if ($active_currency === $code) { + echo ''; + } else { + echo ''; + } + } ?>
@@ -1300,4 +1302,4 @@ public function edit_invoice_form_submit_handle(): void { } } } -?> +?> \ No newline at end of file diff --git a/public/js/wc-invoice-payment-public.js b/public/js/wc-invoice-payment-public.js index a94a4b3..162a617 100755 --- a/public/js/wc-invoice-payment-public.js +++ b/public/js/wc-invoice-payment-public.js @@ -4,6 +4,8 @@ document.addEventListener('DOMContentLoaded', function () { if (defaultPaymethod) { defaultPaymethod = defaultPaymethod.value + if(defaultPaymethod == "multiplePayment") return '' + const inputPaymethod = document.getElementById('payment_method_' + defaultPaymethod) const listPaymethods = document.getElementsByClassName('wc_payment_method')