Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Default selection in shipping and payment checkout


Richard Lee

Recommended Posts

Posted

Hi guys and girls,

 

can someone tell me how the default selection works in the shipping and payment checkout?

 

I would like the cheapest shipping option selected by default and I would like to set one of the payment options as default.

 

Heres the section in checkout_payment.php which creates the options...

   for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
// set the radio button to be checked if it is the method chosen
		$checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false);
		//echo "<h1>Checked? ".$quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] ." == ".$shipping['id']."</h1>";
		if ( ($checked == true) || ($n == 1 && $n2 == 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" width="75%"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td> 
						<?php
		if ( ($n > 1) || ($n2 > 1) ) {
?> 
						<td class="main"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></td> 
						<td class="main" align="right"><?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked); ?></td> 
						<?php
		} else {
?> 
						<td class="main" align="right" colspan="2"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></td> 
						<?php
		}
?> 
						<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
					  </tr> <?php
		$radio_buttons++;
	  }

Posted
Hi guys and girls,

 

can someone tell me how the default selection works in the shipping and payment checkout?

 

I would like the cheapest shipping option selected by default and I would like to set one of the payment options as default.

 

Heres the section in checkout_payment.php which creates the options...

   for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
// set the radio button to be checked if it is the method chosen
		$checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false);
		//echo "<h1>Checked? ".$quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] ." == ".$shipping['id']."</h1>";
		if ( ($checked == true) || ($n == 1 && $n2 == 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" width="75%"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td> 
						<?php
		if ( ($n > 1) || ($n2 > 1) ) {
?> 
						<td class="main"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></td> 
						<td class="main" align="right"><?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked); ?></td> 
						<?php
		} else {
?> 
						<td class="main" align="right" colspan="2"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></td> 
						<?php
		}
?> 
						<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
					  </tr> <?php
		$radio_buttons++;
	  }

 

 

I too am searching for a way to make a particular payment method as default.

 

BTW: My shipping already selects the least expensive as default. I just thought that it was standard. Let me know if you think it would help and I will post the code for my ship page.

 

Meanwhile, there must be a way to make a payment method as default. Anyone???

Tony Mazz

Archived

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

×
×
  • Create New...