So I've had a running 6.2.x B2B cart for years, and I'm working on bringing up a new 6.4 cart (also B2B).
As a part of bringing up that 6.2.x cart I tweaked the checkout_payment.tpl.php to auto select the top payment method when the customer enters the payment page of the checkout process. Thankfully I saved that info as I can't seem to find the thread on this site anymore (old link is dead).
Here were the changes that needed to be made for 6.2.x B2B (tested on 6.2.09)
Code:
/catalog/templates/content/checkout_payment.tpl.php
Tweaked based on this thread: http://forums.oscommerce.com/index.php?showtopic=42029&hl=payment+method+default
This made the top payment method get selected AND highlighted by default.
Around lines 160-166
----------------------------------------------------
<?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";
}
?>
----------------------------------------------------
Changed to:
----------------------------------------------------
<?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 {
if ( (!$payment) && ($i==0) ) {
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";
}
}
?>
----------------------------------------------------
----------------------------------------------------
Around line 172:
----------------------------------------------------
echo tep_draw_radio_field('payment', $selection[$i]['id']);
----------------------------------------------------
Changed to
----------------------------------------------------
echo tep_draw_radio_field('payment', $selection[$i]['id'], $i==0);
----------------------------------------------------
So now bringing up this 6.4 B2B cart I'm going back through my notes and finding of course that alot of the code is different and the mods/tweaks have to be applied differently. In some cases I've figured it out, but not being a real PHP guy I'm having trouble with this one.
The code in the 6.4 checkout_payment.tpl.php is definitely different from the 6.2.09 code. The sections are recognizable when comparing the two, but things are being done a bit differently. I've tried my hand at patching something together in the same vein as the 6.2.09 tweak but I haven't had any luck yet. Can anyone help? Here's the 6.4 code sections that line up with the same sections that were tweaked in 6.2.09 to accomplish this:
First around line 190:
Code:
<?php
if ( (isset($payment) && $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";
}
?>
and then a few lines further down around line 200:
Code:
<?php
if (sizeof($selection) > 1) {
if (isset($_SESSION['payment']) && $_SESSION['payment'] == $selection[$i]['id']) {
echo tep_draw_radio_field('payment', $selection[$i]['id'], true);
} elseif (!isset($_SESSION['payment']) && $i == 0) {
echo tep_draw_radio_field('payment', $selection[$i]['id'], true);
} else {
echo tep_draw_radio_field('payment', $selection[$i]['id']);
}
} else {
echo tep_draw_hidden_field('payment', $selection[$i]['id']);
}
?>