Guest Posted November 2, 2008 Share Posted November 2, 2008 If you use more than one payment module, you can have one of them pre-selected for use when the customer goes thru 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']); } ?> If you use Fast Easy Checkout, apply the same change to catalog>includes>fec>payment_box.php Now, your preferred payment method should be selected by default when customers check out. - Andrea Link to comment Share on other sites More sharing options...
pyramids Posted November 2, 2008 Share Posted November 2, 2008 Slight variation from the code above: (this adds the ability to have different colored background for the default payment type verses the others, also added a blinking gif arrow) Find: for ($i=0, $n=sizeof($selection); $i<$n; $i++) { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) { echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } else { echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } ?> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="3"><b><?php echo $selection[$i]['module']; ?></b></td> <td class="main" align="right"> <?php if (sizeof($selection) > 1) { echo tep_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $payment)); } else { echo tep_draw_hidden_field('payment', $selection[$i]['id']); } ?> Change To: for ($i=0, $n=sizeof($selection); $i<$n; $i++) { // this will make the first payment selection the default one if ($i == 0) { $bgclass = 'mainSelected'; $checked = true; } else { $bgclass = 'mainNotSelected'; $checked = false; } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="<?php echo $bgclass; ?>" colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) { echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } else { echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } ?> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="3"><b><?php echo $selection[$i]['module']; ?></b></td> <td class="main" align="right"> <?php if (sizeof($selection) > 1) { echo tep_draw_radio_field('payment', $selection[$i]['id'], $checked); } else { echo tep_draw_hidden_field('payment', $selection[$i]['id']); } ?> Add this to your stylesheet.css file to control the background color .mainSelected {background: #004000;} .mainNotSelected {background: #336666;} Here is a blinking arrow gif Link to comment Share on other sites More sharing options...
tim-schulze Posted November 3, 2008 Share Posted November 3, 2008 nice. thank you Link to comment Share on other sites More sharing options...
steepedincode Posted February 5, 2009 Share Posted February 5, 2009 Awesome! This is exactly what I was looking for. Implemented right away on TWO sites. THANKS! :) Link to comment Share on other sites More sharing options...
sunrise99 Posted March 25, 2009 Share Posted March 25, 2009 many thanks!!! Best Regards, Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.