eManager Posted January 3, 2014 Share Posted January 3, 2014 We use the one-page checkout with three different payment modules. We would like to have one of them set as the default when the page loads so the credit card, exp, and [spam-filter] filed are displayed without needing to click that option. Any advice? Link to comment Share on other sites More sharing options...
eManager Posted January 4, 2014 Author Share Posted January 4, 2014 Got it figured out. Link to comment Share on other sites More sharing options...
vekia Posted January 4, 2014 Share Posted January 4, 2014 hello Got it figured out. is not enough to "mark as solved" can you please share solution? it will be helpfull for other merchants here. thanks in advance 1 Link to comment Share on other sites More sharing options...
PascalVG Posted January 4, 2014 Share Posted January 4, 2014 (edited) Probably in Shipping->Shipping, where you can select the default carrier. eManager, can you confirm this? Thanks! pascal EDIT: Oops, sorry, payment method was asked for, not carrier... Edited October 12, 2014 by PascalVG (see edit history) Link to comment Share on other sites More sharing options...
libertec Posted January 18, 2014 Share Posted January 18, 2014 We're also looking for this functionality eManager, can you share your solution? Thanks! Link to comment Share on other sites More sharing options...
sabio Posted October 12, 2014 Share Posted October 12, 2014 Also looking at this, in most platform this is an option, indeed a very important one, as the transaction fees may very. Link to comment Share on other sites More sharing options...
PascalVG Posted October 12, 2014 Share Posted October 12, 2014 (edited) EDIT: My Mistake, default carrier,not default payment method... Hi Sabio, In PS 1.6, go to Shipping->Preferences, scroll down and there you have a field default carrier in PS 1.5, go to Shipping->Shipping, scroll down and there you have a field default carrier. Hope this helps, pascal Edited October 12, 2014 by PascalVG My mistake: Default carrier, not default payment method... (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted October 13, 2014 Share Posted October 13, 2014 Also looking at this, in most platform this is an option, indeed a very important one, as the transaction fees may very. What payment module are you using? Does it require that you click the payment method first, and then the credit card form is presented on a separate page? Link to comment Share on other sites More sharing options...
alexsinyakov Posted April 3, 2016 Share Posted April 3, 2016 (edited) so any solution? how to show default payment methods (after first page load) without click on any carrier? I'm using one-page checkout and PrestaShop 1.5.6.2 Thanks in advance, Alex Edited April 3, 2016 by alexsinyakov (see edit history) Link to comment Share on other sites More sharing options...
dobesv Posted March 28, 2017 Share Posted March 28, 2017 What is the solution for this? I'm having the same problem - I only have one payment method and I want it to be selected automatically. Link to comment Share on other sites More sharing options...
Elchin Posted March 29, 2017 Share Posted March 29, 2017 Same here, I need that solution as well. Link to comment Share on other sites More sharing options...
ShRon Posted April 11, 2017 Share Posted April 11, 2017 Same here Link to comment Share on other sites More sharing options...
serafimsorovsky Posted April 21, 2017 Share Posted April 21, 2017 The correct way is to send select_payment_option to order controller. The easy way: In templates/checkout/_partials/steps/checkout-step.tpl add {if "payment-option-3" == $option.id} checked {/if} instead of {if $selected_payment_option == $option.id} checked {/if} Link to comment Share on other sites More sharing options...
stweet Posted November 6, 2017 Share Posted November 6, 2017 On 21/4/2017 at 11:48 AM, serafimsorovsky said: The correct way is to send select_payment_option to order controller. The easy way: In templates/checkout/_partials/steps/checkout-step.tpl add {if "payment-option-3" == $option.id} checked {/if} instead of {if $selected_payment_option == $option.id} checked {/if} This work but it dosen't show the payment decription "id="payment-option-1-additional-information"" Is there a way to show this also by default ? Link to comment Share on other sites More sharing options...
netfuchs Posted December 12, 2017 Share Posted December 12, 2017 My solution for version 1.7: in templates/checkout/_partials/steps/payment.tpl change: <input class="ps-shown-by-js {if $option.binary} binary {/if}" id="{$option.id}" data-module-name="{$option.module_name}" name="payment-option" type="radio" required {if $selected_payment_option == $option.id || $is_free} checked {/if} > to: <input class="ps-shown-by-js {if $option.binary} binary {/if}" id="{$option.id}" data-module-name="{$option.module_name}" name="payment-option" type="radio" required checked > change: {if $option.additionalInformation} <div id="{$option.id}-additional-information" class="js-additional-information definition-list additional-information{if $option.id != $selected_payment_option} ps-hidden {/if}" > {$option.additionalInformation nofilter} </div> {/if} to: <div> {$option.additionalInformation nofilter} </div> Link to comment Share on other sites More sharing options...
gklsmykker Posted December 30, 2017 Share Posted December 30, 2017 Sounds very great. I wish to do the same thing. But I'm running on Prestashop 1.6.1.11 and the structure is different. I'm not smart enough to figure out how to send the select_payment_option to order controller in this structure. Can anyone help, please? Link to comment Share on other sites More sharing options...
Solaris Posted January 24, 2018 Share Posted January 24, 2018 The above solution sets the radio button for the payment option to "selcted" regardless of the number of available payment options. I was not very keen on forcing this, so I used an if statement to check wether there is only one payment option available: Replace line 21: {elseif $selected_payment_option == $option.id} checked with: {if $module_options|@count eq 1} checked {elseif $selected_payment_option == $option.id} checked {/if} Link to comment Share on other sites More sharing options...
djaychela Posted August 31, 2018 Share Posted August 31, 2018 Not having any luck with either of those solutions - netfuchs' solution doesn't appear to work on my shop, and I can't even find the code that Solaris is referring to (not sure what file it's in). Anyone else? This seems like an obvious option to be available in the standard backend? Link to comment Share on other sites More sharing options...
ableier Posted September 11, 2018 Share Posted September 11, 2018 Neither option works for me either. On almost all of my stores I only offer one payment option, and it seems a bit confusing and redundant to have to choose the only option available. I'm not a developer, but it seems this should be a simple fix, or as to djachela's point, a standard option. Anyone have a solution for 1.7.4.2? Link to comment Share on other sites More sharing options...
bellini13 Posted September 11, 2018 Share Posted September 11, 2018 8 hours ago, ableier said: Neither option works for me either. On almost all of my stores I only offer one payment option, and it seems a bit confusing and redundant to have to choose the only option available. I'm not a developer, but it seems this should be a simple fix, or as to djachela's point, a standard option. Anyone have a solution for 1.7.4.2? Solutions have already been provided that work with PS v1.7.4.2 Perhaps you are using a custom theme or perhaps the payment module you are using is somehow interfering. Also possible that you are not applying the solution correctly. Link to comment Share on other sites More sharing options...
djaychela Posted September 11, 2018 Share Posted September 11, 2018 2 minutes ago, bellini13 said: Solutions have already been provided that work with PS v1.7.4.2 Could you link to them? Nothing I've seen works for me. Quote Perhaps you are using a custom theme or perhaps the payment module you are using is somehow interfering. Also possible that you are not applying the solution correctly. I'm using the standard theme. Payment module could well be interfering, but if that's possible then I'd suggest that this is something which should be a feature that can't be interfered with? Seems bizarre if a module can trump settings from elsewhere. Totally possible I'm not applying it correctly, but the two I've looked at in this thread I've covered, and I'm near certain I didn't screw up applying netfuchs' one (I've tried it twice, from scratch, just in case). Link to comment Share on other sites More sharing options...
bellini13 Posted September 11, 2018 Share Posted September 11, 2018 The solutions are in this thread. As for a feature in PS, a forum post will do nothing. Prestashop developers do not read the forums. You should create a feature request using Prestashops system, and then keep your fingers crossed that they will add the feature. Link to comment Share on other sites More sharing options...
djaychela Posted September 11, 2018 Share Posted September 11, 2018 2 minutes ago, bellini13 said: The solutions are in this thread. ... but they don't work. Link to comment Share on other sites More sharing options...
bellini13 Posted September 11, 2018 Share Posted September 11, 2018 well they do work. perhaps you should provide the exact changes you have made, and to what files you have made them, and maybe someone will correct what you are doing wrong Link to comment Share on other sites More sharing options...
arasheb Posted December 23, 2018 Share Posted December 23, 2018 (edited) Just add this code in some where in your javascript code if($('label[for=payment-option-1]').length!=0) $('label[for=payment-option-1]').trigger('click'); You can change 1 to any payment you want choose by default Edited December 23, 2018 by arasheb (see edit history) Link to comment Share on other sites More sharing options...
Darius1990 Posted January 29, 2019 Share Posted January 29, 2019 On 12/23/2018 at 1:52 PM, arasheb said: Just add this code in some where in your javascript code if($('label[for=payment-option-1]').length!=0) $('label[for=payment-option-1]').trigger('click'); You can change 1 to any payment you want choose by default for me right now showing all options. but not particularly option one. Link to comment Share on other sites More sharing options...
Darius1990 Posted January 29, 2019 Share Posted January 29, 2019 (edited) I found solution! case: if you want selected default payment option and another option dont displayed additional info. payment.tpl <span class="custom-radio float-xs-left"> <input class="ps-shown-by-js {if $option.binary} binary {/if}" id="{$option.id}" data-module-name="{$option.module_name}" name="payment-option" type="radio" required {if 'payment-option-1' == $option.id || $is_free} checked {/if} <--update this line > <span></span> </span> and refactoring this line: (add extra if statement) extra TIP: if you want to move payment row ordet methods use paymentOptions hook in display->position and select unpositional hooks {if $option.additionalInformation && $option.id == 'payment-option-1' } <div> {$option.additionalInformation nofilter} </div> {else} <div id="{$option.id}-additional-information" class="js-additional-information definition-list additional-information{if $option.id != $selected_payment_option} ps-hidden {/if}" > {$option.additionalInformation nofilter} </div> {/if} Edited January 29, 2019 by Darius1990 (see edit history) Link to comment Share on other sites More sharing options...
bili_dada Posted June 25, 2019 Share Posted June 25, 2019 On 12/12/2017 at 2:18 PM, netfuchs said: My solution for version 1.7: in templates/checkout/_partials/steps/payment.tpl change: <input class="ps-shown-by-js {if $option.binary} binary {/if}" id="{$option.id}" data-module-name="{$option.module_name}" name="payment-option" type="radio" required {if $selected_payment_option == $option.id || $is_free} checked {/if} > to: <input class="ps-shown-by-js {if $option.binary} binary {/if}" id="{$option.id}" data-module-name="{$option.module_name}" name="payment-option" type="radio" required checked > change: {if $option.additionalInformation} <div id="{$option.id}-additional-information" class="js-additional-information definition-list additional-information{if $option.id != $selected_payment_option} ps-hidden {/if}" > {$option.additionalInformation nofilter} </div> {/if} to: <div> {$option.additionalInformation nofilter} </div> I do this steps and also remove that article section that is for prevention user from finaliazing order without selecting payment method. and every thing is okey there. but my card ajax opration does not work any more and I am getting this error: [PrestaShopDatabaseException] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DigiShi Carrier');","1399":"MBG.addCheckoutOption(2,'DigiShi Carrier');","1400":' at line 1 how can I resolve this error? Link to comment Share on other sites More sharing options...
nikos83 Posted March 31, 2021 Share Posted March 31, 2021 On 1/24/2018 at 1:14 PM, Solaris said: The above solution sets the radio button for the payment option to "selcted" regardless of the number of available payment options. I was not very keen on forcing this, so I used an if statement to check wether there is only one payment option available: Replace line 21: {elseif $selected_payment_option == $option.id} checked with: {if $module_options|@count eq 1} checked {elseif $selected_payment_option == $option.id} checked {/if} This worked - selected option but then on the bottom of the cart button is inactive due to you need to select option. So need to click again to get js reloaded Link to comment Share on other sites More sharing options...
hamsta Posted April 30, 2021 Share Posted April 30, 2021 (edited) See https://github.com/PrestaShop/PrestaShop/pull/21654/files/58878162576eb30dc4a72e8075359a1bb42fd7bd Presta Developers already fixed this for Milestone 1.7.8 replace {if $selected_payment_option == $option.id || $is_free} checked {/if} with {if ($selected_payment_option == $option.id || $is_free) || ($payment_options|@count === 1 && $module_options|@count === 1)} checked {/if} in /themes/YOURTHEME(_CHILD)/templates/checkout/_partials/steps/payment.tpl that´s it 😉 --- But they missed the additionalInformation to open too. 😒 So you might use this code instead: {if ($selected_payment_option == $option.id || (isset($is_free) && $is_free) ) || ($payment_options|@count === 1 && $module_options|@count === 1)} checked {$selected_payment_option = $option.id} {/if} and add this else condition in the class : {if $option.additionalInformation} <div id="{$option.id}-additional-information" class="js-additional-information definition-list additional-information {if $option.id != $selected_payment_option} ps-hidden {else} ps-shown-by-js {/if}" > {$option.additionalInformation nofilter} </div> {/if} Works fine for me in PS 1.7.7.2 😊 cheers Edited April 30, 2021 by hamsta (see edit history) Link to comment Share on other sites More sharing options...
Adnan Nahri Posted May 11, 2022 Share Posted May 11, 2022 Hello, I hope y'all doing good. I have tried some of the provided solutions and was able to actually make my first payment method the default payment method. However, I can't see the other payment method, the radio buttons aren't showing at all. So basically visitors can just click submit and they will be taken to Payment method No1, I would like both the methods to be available in radio buttons... which seems to be "hidden" using JS for some reason. I'm running Prestashop 1.7.4.2 Link to comment Share on other sites More sharing options...
Adnan Nahri Posted May 11, 2022 Share Posted May 11, 2022 On 1/29/2019 at 10:37 AM, Darius1990 said: I found solution! case: if you want selected default payment option and another option dont displayed additional info. payment.tpl <span class="custom-radio float-xs-left"> <input class="ps-shown-by-js {if $option.binary} binary {/if}" id="{$option.id}" data-module-name="{$option.module_name}" name="payment-option" type="radio" required {if 'payment-option-1' == $option.id || $is_free} checked {/if} <--update this line > <span></span> </span> and refactoring this line: (add extra if statement) extra TIP: if you want to move payment row ordet methods use paymentOptions hook in display->position and select unpositional hooks {if $option.additionalInformation && $option.id == 'payment-option-1' } <div> {$option.additionalInformation nofilter} </div> {else} <div id="{$option.id}-additional-information" class="js-additional-information definition-list additional-information{if $option.id != $selected_payment_option} ps-hidden {/if}" > {$option.additionalInformation nofilter} </div> {/if} This is what I have used, step one, in order to make Payment option 1 the default payment method, as it was gone from checkout once I have installed a new payment module in the backoffice. Link to comment Share on other sites More sharing options...
Andrejkov Posted April 4, 2023 Share Posted April 4, 2023 Any new solution? We use module Prestashop Checkout, and this module set default payment to PayPal. Changes in Payment.tpl doesnt work for this module. Regards. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now