Did you also get to the table error?
Printable View
Is there any way to change the payment confirmation page layout from tabs to accordion without radio buttons?
Hi,
Yes it is possible to change the layout of the stripe payment options from tabs to accordion (without radio buttons). The stripe documentation details the various layout options available.
find the following code in checkout.js
then change it to the following:Code:const paymentElementOptions = {
layout: "tabs",
};
The defaultCollapsed option can be set to true or false depending on what look you prefer. It is also possible to change the order of the payment methods (e.g. to show Apple Pay first).Code:const paymentElementOptions = {
layout: {
type: 'accordion',
defaultCollapsed: true,
radios: false,
spacedAccordionItems: true
}
}
Richard
This is not a option as you have put it - as there is only two options on showing/listing of payment methods with stripe:
"Manage payment methods from the Dashboard" or "Manually list payment methods" with only the later having the ability of "changing the order of payment methods" to do this you would have to harded code each method you wish to display and the down side of this is that errors can end up being displayed to your customers if stripe would not of displayed this method if the setting was of "Manage payment methods from the Dashboard" so I would say try your best to use the default setting of "Manage payment methods from the Dashboard" as Stripe uses many factors to decide if a method should or should not be displayed which would be too large to code these within a if statement and at lest one factor is fraud detection.
This is the best option on this point:
https://docs.stripe.com/payments/pay...ration-options
Use dynamic payment methodshttps://b.stripecdn.com/docs-statics...10ca4963de.svg
[COLOR=var(--sail-color-text)]Stripe dynamically displays the most relevant payment methods to your customers based on the payment method preferences you set in the Dashboard and eligibility factors such as transaction amount, currency, and payment flow. To enable and manage your payment method preferences, go to the Dashboard. Stripe enables certain payment methods for you by default and might enable additional payment methods after notifying you.[/COLOR]
[COLOR=var(--sail-color-text)]Unless you have to list payment methods manually, we recommend using dynamic payment methods. Dynamic payment methods automatically determines whether to display payment methods according to set rules.[/COLOR]
[COLOR=var(--sail-color-text)]See Dynamic payment methods to learn more.[/COLOR]
Manually list payment methodshttps://b.stripecdn.com/docs-statics...10ca4963de.svg
[COLOR=var(--sail-color-text)]Listing payment methods manually requires some coding. Every payment method you want your PaymentIntent to accept must be added to payment_method_types. Unless your integration requires that you list payment methods manually, we recommend that you manage payment methods from the Dashboard. Stripe handles the return of eligible payment methods based on factors such as the transaction’s amount, currency, and payment flow.[/COLOR]
Hi,
Apologies for not being clearer - I believe it is possible to change the sort order of the stripe payment methods by using the paymentMethodOrder array.
Any payment methods listed in the paymentMethodOrder (such as Apple Pay or Google Pay) will be displayed first – other methods turned on in the dashboard will then be automatically added lower down the list.
I have not had a chance to test this yet, but I can’t see any reason why it wouldn’t work.
Full details on this feature are available here
Stripe will dynamically show payment methods that are available to your customer (e.g. Apple Pay will only be displayed if the customer is signed up).
Richard
Hi,
I have been testing the latest stripe module for Zen Cart 2.0.1. Unfortunately, there appears to be a few minor issues.
1)After uploading the header_php.php file in the checkout_payment folder a PHP warning is logged (--> PHP Warning: Undefined variable $gv_balance in /includes/templates/template_default/templates/tpl_checkout_payment_default.php on line 206.).
This seems to be because the 1.5.8 file has been included with the mod instead of the 2.0.1 file.
2)When accessing the checkout_confirmation page the following PHP warnings are logged:
3)If an alternative payment method is selected (such as check/money order) the following PHP warning is logged:Code:[11-Jul-2024 17:53:04 Europe/London] Request URI: /index.php?main_page=checkout_confirmation, Language id 1
#0 /includes/modules/payment/stripepay/create.php(69): zen_debug_error_handler()
#1 /includes/modules/payment/stripe.php(165): require_once('/home/virtual/v...')
#2 /includes/classes/payment.php(248): stripe->pre_confirmation_check()
#3 /includes/modules/pages/checkout_confirmation/header_php.php(92): payment->pre_confirmation_check()
#4 /index.php(35): require('/home/virtual/v...')
--> PHP Warning: Undefined array key "order_add_comment" in /includes/modules/payment/stripepay/create.php on line 69.
[11-Jul-2024 17:53:04 Europe/London] Request URI: /index.php?main_page=checkout_confirmation, Language id 1
#0 [internal function]: zen_debug_error_handler()
#1 /includes/templates/responsive_classic/common/html_header.php(20): header()
#2 /index.php(42): require('/home/virtual/v...')
--> PHP Warning: Cannot modify header information - headers already sent by (output started at /includes/modules/payment/stripepay/create.php:76) in /includes/templates/responsive_classic/common/html_header.php on line 20.
4) When using payment methods other than stripe there is a problem with the order total display at checkout. Image 1 shows how the totals should display normally. Image 2 shows the orders totals do not appear.Code:[11-Jul-2024 17:58:22 Europe/London] Request URI: /index.php?main_page=checkout_confirmation, Language id 1
#0 /includes/modules/pages/checkout_confirmation/jscript_stripe.php(1): zen_debug_error_handler()
#1 /includes/templates/responsive_classic/common/html_header.php(205): require('/home/virtual/v...')
#2 /index.php(42): require('/home/virtual/v...')
--> PHP Warning: Undefined variable $stripe_select in /includes/modules/pages/checkout_confirmation/jscript_stripe.php on line 1.
I believe issue 4 has been caused by the core file edit to tpl_checkout_confirmation. The edit comments out the following code:
I would strongly recommend that core file edits are avoided whenever possible. This will reduce the chance of compatibility issues with other mods.Code:/*
if (MODULE_ORDER_TOTAL_INSTALLED) {
$order_totals = $order_total_modules->process();
?>
<?php
}
*/
Most of the PHP warnings may not cause any problems but on a busy site a large number of logs would be produced.
It would be much appreciated if anyone could help resolve any of these issues.
Many thanks
Richard
Attachment 20697Attachment 20698
Looking at (1)
1)After uploading the header_php.php file in the checkout_payment folder a PHP warning is logged (--> PHP Warning: Undefined variable $gv_balance in /includes/templates/template_default/templates/tpl_checkout_payment_default.php on line 206.).
Isn't $gv_balance set on includes/modules/pages/checkout_payment/header_php.php line 123 ?
Hi swguy
Thank you for your reply. Yes, the $gv_balance is set on line 123 in version 2.0.1. The issue seems to have been caused by the incorrect file being included with the stripe module.
I have uploaded the files from the stripe mod and noticed that there is an override/edit for includes/modules/pages/checkout_payment/header_php.php
The stripe mod has three sets of files that can be uploaded (depending on the zen cart version). It appears that the 2.0.1 header_php file has been mistakenly copied from the 1.5.8 version.
Issue 1 should be easy to fix – hopefully on the next update the correct file can be included. The other issues may be more complicated to fix.
Many thanks
Richard
Update:
Issue 2
I have noticed that the first warning from issue 2 (undefined array key) has been previously fixed by gozzandes. See post #306 for details
Carlwhat has previously mentioned that line 69 of create.php could be removed – I believe this is correct, however line 179 of stripe.php would need to be changed to:
$order_comment = (isset($_SESSION['order_add_comment']))."\n Stripe ID:";
This will prevent the undefined array key warning from showing.
Issue 3
It appears issue 3 can be fixed by changing line 1 of includes/modules/pages/checkout_confirmation/jscript_stripe.php to
<?php if (isset($stripe_select) && MODULE_PAYMENT_STRIPE_STATUS === 'True' && $stripe_select == 'True' ) {?>
Issue 4
I believe issue 4 can be fixed by editing the tpl_checkout_confirmation.php file supplied with the stripe module:
change lines 157 – 166 to the following:
<?php if (MODULE_ORDER_TOTAL_INSTALLED && $_SESSION['payment'] != 'stripe') {
$order_totals = $order_total_modules->process();
}
?>
Other issues
Web developer console shows error at checkout – failed to load checkout_confirmation.css
Solution: remove line 2 from includes/modules/pages/checkout_confirmation/jscript_stripe.php
------------
Web developer console shows that some files from stripe seem to have loaded twice. This causes a hcaptcha authentication error to appear in the console.
------------
I have looked into the ‘cannot modify header information’ warning and have not found a solution yet. The cause appears to be <script> tags used at the end of the create.php file. The script code is as follows:
Does anyone know if it would be possible to move the script elsewhere to prevent headers being modified?Code:<script>
'use strict';
var clientS = JSON.parse('<?php echo $clientS_json; ?>');
var PublishableKey = JSON.parse('<?php echo $jason_publishable_key; ?>');
var confirmationURL = JSON.parse('<?php echo $confirmationURL; ?>');
var PaymentSuccess = JSON.parse('<?php echo $jason_PaymentSuccess; ?>');
</script>
Any help fixing this issue would be much appreciated.
Many thanks
Richard
Note: the edits I have made apply to version 2.0.1. The edits may be different for other versions.