Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Making one of 3 payment method as checked or default


juniorprg

Recommended Posts

I have been looking around in forums i have seen people asking same question but no answers tho.

 

I have 3 payment methods and want to make one as the default method...is this possible

 

I know if there is only 1 payment method, then its assumed to be the default one

 

any help guys?

l8ter

Link to comment
Share on other sites

you have to modify your payment.php class and checkout_payment.php Based upon which module you want to default to you could setup a flag to signal the selection of the radio button. Similar to the way the checkout_shipping.php is.

 

For example in checkout_shipping.php find this:

echo tep_draw_radio_field('payment', $selection[$i]['id']);

 

replace it with

if( $i == 0 )
   $checked = true;
 else
   $checked = false;

  echo tep_draw_radio_field('payment', $selection[$i]['id'], $checked);

 

Of course you need to determine a way to select the default payment from someplace else. Like from the customer's account options page or the payment module options.

 

and backup your files before modifying.

Link to comment
Share on other sites

is there a way without going thru too much fuzz just make the COD payment checked by default for all customers, so that if that mod is actively it will be show as checked...

 

so im think if i can make this do able in catalog\includes\modules\payment\cod.php

 

any ideas how to make this happen

l8ter

Link to comment
Share on other sites

no osccoder, right now this isnt possible. only if 1 payment is active then by default that payment method is selected

One way to do this without editting much, if I remember correctly, is to just change the sort value on those payment modules in the admin console... I *believe* that whichever module is listed first is always the default, although I don't have my code readily available to double-check that, but enigma's post leads me to think that's right, since it checks if $i == 0, and sets $checked = true, else $checked = false... So if you set the COD module to sort 0 and changed the others to sort below that, COD should always be selected by default...

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

this worked!!

 

i made the code changes like at checkout_payments.php

 

like this by replacing echo tep_draw_radio_field('payment', $selection[$i]['id']); to the following:

 

if( $i == 0 )

$checked = true;

else

$checked = false;

 

echo tep_draw_radio_field('payment', $selection[$i]['id'], $checked);

 

and then which ever payment is the lowest in sort order, it was selected by default...

 

thanks guys

l8ter

Link to comment
Share on other sites

this worked!!

 

i made the code changes like at checkout_payments.php

 

like this by replacing echo tep_draw_radio_field('payment', $selection[$i]['id']); to the following:

 

if( $i == 0 )

$checked = true;

else

$checked = false;

 

echo tep_draw_radio_field('payment', $selection[$i]['id'], $checked);

 

and then which ever payment is the lowest in sort order, it was selected by default...

 

thanks guys

l8ter

Link to comment
Share on other sites

Oh enigma1

So this is not possible from the admin of oscommerce?

 

If you want to go further with this, would be better to modify the account.php or one of the customer account pages in the catalog and have him select the default payment/shipping modules, if he wants of course. That would require couple of extra columns for the customers table to signify the shipping/payment modules

Link to comment
Share on other sites

If you want to go further with this, would be better to modify the account.php or one of the customer account pages in the catalog and have him select the default payment/shipping modules, if he wants of course. That would require couple of extra columns for the customers table to signify the shipping/payment modules

And if you want to expand on that idea as well, if they selected a credit card module as their default, you could give them the option of saving their credit card details, and then you could truly have a nearly one-click checkout, once they confirmed their shipping address... Just make sure you store that number in the database in encrypted format, in case the db is ever compromised...

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

  • 2 weeks later...

Check out Default Selected Shipping Method

Desc: "Choose the shipping method default selected in the checkout_shipping.php page in the shop; not necessarily the cheapest."

http://www.oscommerce.com/community/contributions,4396

Link to comment
Share on other sites

Check out Default Selected Shipping Method

Desc: "Choose the shipping method default selected in the checkout_shipping.php page in the shop; not necessarily the cheapest."

http://www.oscommerce.com/community/contributions,4396

Link to comment
Share on other sites

  • 1 year later...
Check out Default Selected Shipping Method

Desc: "Choose the shipping method default selected in the checkout_shipping.php page in the shop; not necessarily the cheapest."

http://www.oscommerce.com/community/contributions,4396

 

thanks for the link, I just installed this and it's great.

 

Install was about 10 minutes and it was up an running.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...