Author Topic: How to default AuthorizeNet as Default payment method?  (Read 5070 times)

mowlman

  • Jr. Member
  • **
  • Posts: 209
How to default AuthorizeNet as Default payment method?
« on: July 14, 2010, 18:43:33 pm »
I have 2 payment methods published: COD only for Admins, all others used AuthozideNet.

How can I have the CreditCard (Authorize.net) radio be checked by default?

Been looking in ps_payment_method.php and other places?


I'm somehow missing something,  must be time to eat.

Any help will be appreciated.

mowlman

  • Jr. Member
  • **
  • Posts: 209
Re: How to default AuthorizeNet as Default payment method?
« Reply #1 on: July 15, 2010, 18:30:46 pm »
I fixed myself:
This is when you have more than one payment method active, such as COD for store admins for testing purposes.

Within \administrator\components\com_virtuemart\classes\ps_payment_method.php

Look for // Start radio list around line 409.

I inserted an IF statement to check for AuthorizeNet


      // Start radio list
      while ($db->next_record()) {
         $has_result = true;
         echo "<input type=\"radio\" name=\"payment_method_id\" id=\"".$db->f("payment_method_name")."\" value=\"".$db->f("payment_method_id")."\" ";
         if( $selector == "' OR enable_processor='Y" ) {
            echo "onchange=\"javascript: changeCreditCardList();\" ";
         }
         if ((($db->f("payment_method_id") == $payment_method_id) || $db->num_rows() < 2) && !@$GLOBALS['payment_selected']) {
            echo "checked=\"checked\" />\n";
            $GLOBALS['payment_selected'] = true;
            echo " $payment_method_id ";
         }
         else

            // Added to force AuthorizeNet to be checked by default for the payment method
            if ($db->f("payment_method_name") == 'AuthorizeNet') {echo "checked=\"checked\" />\n";}


         echo ">\n";


NOTE: If you wish to have your second payment method radio button selected, you can replace the if statement with
echo "checked=\"checked\" />\n";

Hope this helps any others out there who which to automatically set a default payment method and you have more than one payment method active.

-mowlman

maxispin

  • Jr. Member
  • **
  • Posts: 174
Re: How to default AuthorizeNet as Default payment method?
« Reply #2 on: November 01, 2013, 07:08:46 am »
Thanks are never too late.

Thank you!

I wanted to have selected the first one, and and seems if < value is increased, the first one is selected


row 416 (1.1.19 version)

if ((($db->f("payment_method_id") == $payment_method_id) || $db->num_rows() < 2) && !@$GLOBALS['payment_selected']) {

===>

if ((($db->f("payment_method_id") == $payment_method_id) || $db->num_rows() < 3) && !@$GLOBALS['payment_selected']) {

VM 3.0.17.6 | VM 2.0.24c | VM 1.1.9