osCommerceCoders.com

Affordable end to end oscommerce solutions with
Search Engine Optimization

Email : osCommerceCoders@gmail.com
Call : +1 818-574-3596 (USA) / +44 (020) 8123-6463 (UK)

pre-select payment module in oscommerce as default

Posted by admin On February - 5 - 2014

If you use more than one payment module, you can have one of them pre-selected for use when the customer goes through checkout.  This may be advantageous in ‘steering’ customers to use the payment method that you would prefer they use.  And, if your buyers typically use this method of payment the most anyway, they’ll never have to select it again.

Firstly, login to the Admin side of your website and look at your Payment Modules.  Select the one you would like to use as the default method and set the sort order of it to zero.  Set the other payment modules in use to higher values.

Now…go to catalog>checkout_payment.php

Find this piece of code:

<?php
        if (sizeof($selection) > 1) {
          echo tep_draw_radio_field('payment', $selection[$i]['id']);
        } else {
          echo tep_draw_hidden_field('payment', $selection[$i]['id']);
        }
?>

Replace it with this:

<?php
          if (sizeof($selection) > 1) {
          if ($i == 0) { 
                $checked = true;          
                } else {  
           $checked = false;      
           }     
                echo tep_draw_radio_field('payment', $selection[$i]['id'], $checked);
           } else { 
                echo tep_draw_hidden_field('payment', $selection[$i]['id']);
           }
?>

 

Sponsors