Author Topic: Select Payment Page (Auto Check Payment Method)  (Read 15765 times)

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10275
  • VirtueMart Version: 3+
Select Payment Page (Auto Check Payment Method)
« on: October 18, 2012, 20:03:09 pm »
I was having customers that would type in their credit card #, but were not checking the "radio" button for the payment method.
They were getting frustrated.
This code will auto check the FIRST payment method.

views/cart/tmpl/select_payment.php

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

change payment_id_11  to your payment id   

ALSO:
The "Terms of Service" checkbox is not validated on the billing page.
You can auto check that box for them.

THIS CODE works on the FIRST "checkbox" , so change it if you have other checkbox user fields.
views/user/edit_address_userfields.php

<?php
$document = JFactory::getDocument();
$document->addScriptDeclaration("
   jQuery(document).ready(function($) {
    $('input:checkbox:first-child').attr('checked',true);
   });
");
?>
I do NOT do development work for hire.

toad78

  • Jr. Member
  • **
  • Posts: 202
Re: Select Payment Page (Auto Check Payment Method)
« Reply #1 on: December 04, 2012, 19:04:47 pm »
Yes, I've seen (templatename/html/com_virtuemart/cart/select_payment.php) this and have tried to adapt the current code in this file:

Code: [Select]
<?php
     
if ($this->found_payment_method) {


    echo 
"<fieldset>";
foreach ($this->paymentplugins_payments as $paymentplugin_payments) {
    if (is_array($paymentplugin_payments)) {
foreach ($paymentplugin_payments as $paymentplugin_payment) {
    echo $paymentplugin_payment.'<br /><br />';
}
    }
}
    echo 
"</fieldset>";

    } else {
 echo "<h1>".$this->payment_not_found_text."</h1>";
    }


    
?>

With the code you provided only to be presented with no Payment method being displayed (meaning, a blank section).

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10275
  • VirtueMart Version: 3+
Re: Select Payment Page (Auto Check Payment Method)
« Reply #2 on: December 04, 2012, 22:45:28 pm »
Yes, I've seen (templatename/html/com_virtuemart/cart/select_payment.php) this and have tried to adapt the current code in this file:

Code: [Select]
<?php
     
if ($this->found_payment_method) {


    echo 
"<fieldset>";
foreach ($this->paymentplugins_payments as $paymentplugin_payments) {
    if (is_array($paymentplugin_payments)) {
foreach ($paymentplugin_payments as $paymentplugin_payment) {
    echo $paymentplugin_payment.'<br /><br />';
}
    }
}
    echo 
"</fieldset>";

    } else {
 echo "<h1>".$this->payment_not_found_text."</h1>";
    }


    
?>

With the code you provided only to be presented with no Payment method being displayed (meaning, a blank section).


what?

this code is to check the checkbox
I do NOT do development work for hire.

toad78

  • Jr. Member
  • **
  • Posts: 202
Re: Select Payment Page (Auto Check Payment Method)
« Reply #3 on: December 04, 2012, 23:31:55 pm »
I guess I'm not describing my situation correctly.

On the payment page (editpayment.html)  (where the user selects their payment method), considering this is the only payment method that is being used, I would like to have the radio button already selected. Using the code you provided does not give me the results I need.

Opening the views/cart/tmpl/select_payment.php page, I added the code you posted:

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

Only to receives the result of no Payment Method listed on the 'editpayment' page.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10275
  • VirtueMart Version: 3+
Re: Select Payment Page (Auto Check Payment Method)
« Reply #4 on: December 05, 2012, 13:50:04 pm »
I guess I'm not describing my situation correctly.

On the payment page (editpayment.html)  (where the user selects their payment method), considering this is the only payment method that is being used, I would like to have the radio button already selected. Using the code you provided does not give me the results I need.

Opening the views/cart/tmpl/select_payment.php page, I added the code you posted:

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

Only to receives the result of no Payment Method listed on the 'editpayment' page.

did you change this
payment_id_11

I do NOT do development work for hire.

toad78

  • Jr. Member
  • **
  • Posts: 202
Re: Select Payment Page (Auto Check Payment Method)
« Reply #5 on: December 06, 2012, 16:39:20 pm »
Yes.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10275
  • VirtueMart Version: 3+
Re: Select Payment Page (Auto Check Payment Method)
« Reply #6 on: December 06, 2012, 21:31:42 pm »
what version of vmart are you using

and what payment method is it?
I do NOT do development work for hire.

toad78

  • Jr. Member
  • **
  • Posts: 202
Re: Select Payment Page (Auto Check Payment Method)
« Reply #7 on: December 06, 2012, 21:33:49 pm »
VM 2.014 and Payment Method is Flat Rate Shipping.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10275
  • VirtueMart Version: 3+
Re: Select Payment Page (Auto Check Payment Method)
« Reply #8 on: December 06, 2012, 22:20:18 pm »
VM 2.014 and Payment Method is Flat Rate Shipping.

thats a shipping method???

this is for payment method

I do NOT do development work for hire.

toad78

  • Jr. Member
  • **
  • Posts: 202
Re: Select Payment Page (Auto Check Payment Method)
« Reply #9 on: December 06, 2012, 22:22:05 pm »
I'm sorry. I'm multitasking and I obviously mucked that one up.

The Payment method is Authorize.net.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10275
  • VirtueMart Version: 3+
Re: Select Payment Page (Auto Check Payment Method)
« Reply #10 on: December 06, 2012, 23:19:05 pm »
I'm sorry. I'm multitasking and I obviously mucked that one up.

The Payment method is Authorize.net.

does it show without the code?

I know 1 of the latest versions are having problems with payment methods showing
I do NOT do development work for hire.

toad78

  • Jr. Member
  • **
  • Posts: 202
Re: Select Payment Page (Auto Check Payment Method)
« Reply #11 on: December 07, 2012, 00:03:11 am »
Yes.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10275
  • VirtueMart Version: 3+
Re: Select Payment Page (Auto Check Payment Method)
« Reply #12 on: December 07, 2012, 13:24:25 pm »
Yes.

I have no idea what this could be.

I do NOT do development work for hire.

toad78

  • Jr. Member
  • **
  • Posts: 202
Re: Select Payment Page (Auto Check Payment Method)
« Reply #13 on: December 07, 2012, 15:04:10 pm »
This is what the source code displays after trying to apply your code in VM 2.0.14.

Code: [Select]
<fieldset><input type="radio" value="1" id="payment_id_1" name="virtuemart_paymentmethod_id">
<label for="payment_id_1"><span class="vmpayment"><span class="vmpayment_name">Credit Card</span></span></label>
<br><span class="vmpayment_cardinfo">Please enter your Credit Card information:
    <table width="100%" cellspacing="0" cellpadding="2" border="0">
    <tbody><tr valign="top">
        <td width="10%" nowrap="" align="right">
        <label for="creditcardtype">Credit Card Type: </label>
        </td>
        <td><select name="cc_type_1" id="cc_type_1">
<option value="Visa">Visa</option>
<option value="Mastercard">Mastercard</option>
<option value="AmericanExpress">American Express</option>
<option value="Discover">Discover</option>
</select>
</td>

toad78

  • Jr. Member
  • **
  • Posts: 202
Re: Select Payment Page (Auto Check Payment Method)
« Reply #14 on: December 07, 2012, 15:14:18 pm »
I've managed to finally get your code working (operator error).

Would this code be sufficient to use for checkboxes as well, considering this is nothing more than a jquery script?