From de1e386f62fac805173a12f7736bd3ddcdf4ddbe Mon Sep 17 00:00:00 2001 From: Murray Wood Date: Sat, 21 Mar 2026 12:03:05 +0800 Subject: [PATCH 1/2] Add handling for accept terms checkbox --- .../commerce_splitit/docs/changelog.txt | 7 ++ .../lexicon/en/default.inc.php | 2 + .../templates/frontend/gateways/splitit.twig | 100 ++++++++++++++---- 3 files changed, 88 insertions(+), 21 deletions(-) diff --git a/core/components/commerce_splitit/docs/changelog.txt b/core/components/commerce_splitit/docs/changelog.txt index 5fdcdec..e5c6b1b 100644 --- a/core/components/commerce_splitit/docs/changelog.txt +++ b/core/components/commerce_splitit/docs/changelog.txt @@ -1,3 +1,10 @@ +Splitit for Commerce 2.2.0-pl +--------------------------------- +Released on TBD + +- Automatically detect Commerce's AcceptTerms module and gate the Splitit widget until terms are accepted +- Show a notice message when Splitit is selected but terms have not been accepted yet + Splitit for Commerce 2.1.0-pl --------------------------------- Released on 25-01-2024 diff --git a/core/components/commerce_splitit/lexicon/en/default.inc.php b/core/components/commerce_splitit/lexicon/en/default.inc.php index 43d733c..d39c36e 100644 --- a/core/components/commerce_splitit/lexicon/en/default.inc.php +++ b/core/components/commerce_splitit/lexicon/en/default.inc.php @@ -16,6 +16,8 @@ $_lang['setting_commerce_splitit.locale'] = 'Splitit Locale'; $_lang['setting_commerce_splitit.locale_desc'] = 'Set a locale for Splitit to use. e.g. en-US or fr-FR. If no value is found, the core locale system setting will be used instead. Default is en-US. If you have more than one language, add this setting to each of your contexts with a different value in each.'; +$_lang['commerce_splitit.accept_terms_first'] = 'Please accept the terms and conditions before paying with Splitit.'; + // Transaction lexicons $_lang['commerce.payment_verified'] = 'Payment Verified'; $_lang['commerce.is_paid'] = 'Is Paid'; diff --git a/core/components/commerce_splitit/templates/frontend/gateways/splitit.twig b/core/components/commerce_splitit/templates/frontend/gateways/splitit.twig index 36f2721..fa049ef 100644 --- a/core/components/commerce_splitit/templates/frontend/gateways/splitit.twig +++ b/core/components/commerce_splitit/templates/frontend/gateways/splitit.twig @@ -2,7 +2,17 @@ #splitit-container .spt-btn { /*display: none;*/ } + #splitit-terms-notice { + display: none; + padding: 0.75rem 1rem; + margin-bottom: 0.75rem; + background: #fff8e1; + border: 1px solid #f0c040; + border-radius: 4px; + color: #555; + } +
From 27a0a0194ecab24e9f415a75cfcfa2c070d6205e Mon Sep 17 00:00:00 2001 From: Murray Wood Date: Sat, 21 Mar 2026 12:18:23 +0800 Subject: [PATCH 2/2] Add handling for if Splitit API authentication fails --- .../commerce_splitit/docs/changelog.txt | 1 + .../lexicon/en/default.inc.php | 1 + .../templates/frontend/gateways/splitit.twig | 31 +++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/core/components/commerce_splitit/docs/changelog.txt b/core/components/commerce_splitit/docs/changelog.txt index e5c6b1b..ff362f3 100644 --- a/core/components/commerce_splitit/docs/changelog.txt +++ b/core/components/commerce_splitit/docs/changelog.txt @@ -4,6 +4,7 @@ Released on TBD - Automatically detect Commerce's AcceptTerms module and gate the Splitit widget until terms are accepted - Show a notice message when Splitit is selected but terms have not been accepted yet +- Show a user-friendly error instead of a JS exception when Splitit API authentication fails Splitit for Commerce 2.1.0-pl --------------------------------- diff --git a/core/components/commerce_splitit/lexicon/en/default.inc.php b/core/components/commerce_splitit/lexicon/en/default.inc.php index d39c36e..148163b 100644 --- a/core/components/commerce_splitit/lexicon/en/default.inc.php +++ b/core/components/commerce_splitit/lexicon/en/default.inc.php @@ -17,6 +17,7 @@ $_lang['setting_commerce_splitit.locale_desc'] = 'Set a locale for Splitit to use. e.g. en-US or fr-FR. If no value is found, the core locale system setting will be used instead. Default is en-US. If you have more than one language, add this setting to each of your contexts with a different value in each.'; $_lang['commerce_splitit.accept_terms_first'] = 'Please accept the terms and conditions before paying with Splitit.'; +$_lang['commerce_splitit.gateway_error'] = 'The Splitit payment method is temporarily unavailable. Please choose a different payment method or try again later.'; // Transaction lexicons $_lang['commerce.payment_verified'] = 'Payment Verified'; diff --git a/core/components/commerce_splitit/templates/frontend/gateways/splitit.twig b/core/components/commerce_splitit/templates/frontend/gateways/splitit.twig index fa049ef..01d66b7 100644 --- a/core/components/commerce_splitit/templates/frontend/gateways/splitit.twig +++ b/core/components/commerce_splitit/templates/frontend/gateways/splitit.twig @@ -11,9 +11,21 @@ border-radius: 4px; color: #555; } + #splitit-error { + padding: 0.75rem 1rem; + margin-bottom: 0.75rem; + background: #fdecea; + border: 1px solid #f5c6cb; + border-radius: 4px; + color: #721c24; + }
+{% if ipn %}
+{% else %} +
{{ lex("commerce_splitit.gateway_error") }}
+{% endif %}