Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Virtuemart Template - PureMart (SKU# FLEX-00010)

TOPIC: Need single payment option checked by default

Need single payment option checked by default 10 years 9 months ago #5208

Customers are having trouble checking out of our store because they miss selecting the radio button by our only method of payment. See screenshots to view what I mean. I noticed if a customer logs in first, this radio button is checked already. But if they try to checkout as a guest it is not checked.

View this at www.ibtanked.com/

Is there some code I can add to Puremart override files that will cause the single payment method option to be already checked when the page loads? There was a solution offered in the Virtuemart forum to add in the cart/select_payment.php file but it didn't work no matter where in the php file I placed it - it was reported to work for another person:

<?php
$document = JFactory::getDocument();
$document->addScriptDeclaration("
jQuery(document).ready(function($) {
$('input:radio:#payment_id_5').attr('checked',true);
});
");
?>

Thanks for your support,
Richard
Attachments:
The topic has been locked.

Need single payment option checked by default 10 years 9 months ago #5215

looks like that code should work - where did you try it? I don't see it any where

you could add it to templates/outsourcing-fts/html/com_virtuemart/cart/select_payment.php but just as js

e.g. somewhere after the closing </form>
 
<s cript type="text/javas cript">
jQuery(document).ready(function(jQuery) {
jQuery('input:radio:#payment_id_5').attr('checked',true);
});
</s cript>
 
 

had to gap the s cript as forum won't allow
The topic has been locked.

Need single payment option checked by default 10 years 9 months ago #5222

John,

I originally tried the first code from Virtuemart forum in the file you suggested (templates/outsourcing-fts/html/com_virtuemart/cart/select_payment.php) at the beginning, middle, end with no effect. It wasn't there when you looked because I removed it since it wasn't working.

Now I just added the javascript code you suggested right after the closing </form> tag and it still doesn't work. I tried clearing Joomla cache, browser cache and all site cookies but the credit card radio button still remains unchecked unless I log in as a customer.

I left your code in select_payment.php so you can see if I messed it up somehow - I'm also attaching that php file. I did close all the "s cript" gaps. Maybe there's some other code overriding it somewhere?

I can give you Joomla Super Admin access if that will help.

Thanks for your support!
Richard
Attachments:
Last Edit: 10 years 9 months ago by Richard Sparks. Reason: attachment upload failed first time
The topic has been locked.

Need single payment option checked by default 10 years 9 months ago #5225

Hmm - really don't know why it doesn't work -

you can just set that radio to checked in the plugin (but remember to take out the hack if you ever add another payment method)

in administrator/components/com_virtuemart/plugins/vmpsplugin.php ~ line 756

look for
if ($selectedPlugin == $plugin->$pluginmethod_id) {
			$checked = 'checked="checked"';
		} else {
			$checked = '';
		}
 

and change this to
//if ($selectedPlugin == $plugin->$pluginmethod_id) {
			$checked = 'checked="checked"';
		//} else {
		//	$checked = '';
		//}
 

then it will always be checked

I assume in VM config you have the auto check single ship and payment methods thing checked?

Cheers
The topic has been locked.

Need single payment option checked by default 10 years 9 months ago #5228

John,

Thank you! That last option hacking the Virtuemart admin plugin seems to work. It didn't at first, not until I removed the javascript from select_payment.php and cleared the browser cache and cookies.

I do have auto select single payment and ship methods checked in the VM configuration, but that only seems to work for things like PayPal checkout, not for payment methods that require some sort of input such as credit card.

This solution is perfect! It still gives you the button for credit card input, but the option is pre-checked... As long as we only have one payment option available. So what would happen if I offer 2 payment methods. I'm assuming without this code neither option would be selected, or is there a way to select one of the options as default?

Thanks again!
Richard
The topic has been locked.

Need single payment option checked by default 10 years 9 months ago #5249

Yes, if you alter any JS always clear caches etc - browser love to cache JS

Yes - I think it is over-ridden in the CC plugins as you have to go in a normal setup to the payment page to enter your details - Paypal etc you just need the radio checked..

If you add another you will need to remove the hack

what ends as default?? probably the order of the plugin ids...

Cheers
The topic has been locked.
Time to create page: 0.169 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo