fatbloke Posted April 4, 2005 Share Posted April 4, 2005 Hi I use the Credit Card - Postal Cheque - PayPal payment modules None of the Radio Boxes are selcted by default but I want to make the Credit Card module Radio Button selected as default ..where and how do I do this ? Thanks in advance Quote Link to comment Share on other sites More sharing options...
fatbloke Posted April 6, 2005 Author Share Posted April 6, 2005 there must be a way to do this and some clever dude that will let me into the secret .. PLEASE ;-) Quote Link to comment Share on other sites More sharing options...
TerryK Posted April 6, 2005 Share Posted April 6, 2005 (edited) I've done this on my site, but am not positive that this is how I accomplished it. (I'm using BeyondCompare to see the difference between the default checkout_payment.php file and mine, so this looks like the right spot.) MAKE A BACKUP COPY OF YOUR /CATALOG/CHECKOUT_PAYMENT.PHP FILE BEFORE TRYING THIS! In /catalog/checkout_payment.php, look for: <?php ? ?if (sizeof($selection) > 1) { ? ? ?echo tep_draw_radio_field('payment', $selection[$i]['id']); ? ?} else { ? ? ?echo tep_draw_hidden_field('payment', $selection[$i]['id']); ? ?} ?> Change to: <?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']); ? ?} ?> See if that works for you... HTH, Terry (a clever DUDETTE if it works) :) Edited April 6, 2005 by TerryK Quote Terry Kluytmans Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like: Add order total to checkout_shipment Add order total to checkout_payment Add radio buttons at checkout_shipping (for backorder options, etc.) Duplicate Table Rate Shipping Module Better Product Review Flow * If at first you don't succeed, find out if there's a prize for the loser. * Link to comment Share on other sites More sharing options...
TerryK Posted April 6, 2005 Share Posted April 6, 2005 To go along with this, you might also need to ensure that Credit Card is listed as sort order #1 in your Admin -> Modules -> Payment Modules section. Terry Quote Terry Kluytmans Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like: Add order total to checkout_shipment Add order total to checkout_payment Add radio buttons at checkout_shipping (for backorder options, etc.) Duplicate Table Rate Shipping Module Better Product Review Flow * If at first you don't succeed, find out if there's a prize for the loser. * Link to comment Share on other sites More sharing options...
fatbloke Posted April 7, 2005 Author Share Posted April 7, 2005 Hi Terry ( Dudette ) That worked fine .....and first time .... thanks a million :thumbsup: I have been trying to do that for weeks Quote Link to comment Share on other sites More sharing options...
rbartz Posted April 11, 2005 Share Posted April 11, 2005 Another simpler way using javascript is to add an onload event to the body tag in your checkout_payment.php file: onload="java script:document.checkout_payment.payment[0].click();return true;" Add it all including the endquotes... This is good on MS2, later CVS may need: onload="java script:document.payment.payment[0].click();return true;" Whether you use "checkout_payment" or just "payment" in your checkout_payment.php depends on the name of the form... This assumes that the ORDER of your payment methods in Admin->Modules->Payment has the credit card module ordered FIRST. Quote Link to comment Share on other sites More sharing options...
oldworldcharms Posted June 21, 2005 Share Posted June 21, 2005 Would anyone know how to put the radio buttons in front of the payment types rather than the right site. part of the code for the checkout_shipping.php is below. thanks for any help on this ><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php $selection = $payment_modules->selection(); if (sizeof($selection) > 1) { ?> <?php } else { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="100%" colspan="2"><?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } $radio_buttons = 0; 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']); } else { echo tep_draw_hidden_field('payment', $selection[$i]['id']); } ?> </td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php if (isset($selection[$i]['error'])) { ?> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="4"><?php echo $selection[$i]['error']; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> Quote Link to comment Share on other sites More sharing options...
Guest Posted January 31, 2006 Share Posted January 31, 2006 Fantastic Terry, thanks so much. Works a treat. Matt. I've done this on my site, but am not positive that this is how I accomplished it. (I'm using BeyondCompare to see the difference between the default checkout_payment.php file and mine, so this looks like the right spot.) MAKE A BACKUP COPY OF YOUR /CATALOG/CHECKOUT_PAYMENT.PHP FILE BEFORE TRYING THIS! In /catalog/checkout_payment.php, look for: <?php if (sizeof($selection) > 1) { echo tep_draw_radio_field('payment', $selection[$i]['id']); } else { echo tep_draw_hidden_field('payment', $selection[$i]['id']); } ?> Change to: <?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']); } ?> See if that works for you... HTH, Terry (a clever DUDETTE if it works) :) Quote Link to comment Share on other sites More sharing options...
appleguru Posted February 2, 2006 Share Posted February 2, 2006 Awesome! Thanks!!! :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.