Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Checked Shipping Method


Guest

Recommended Posts

Posted

I have two shipping methods but for some reason the one that I don't want to be checked by default gets checked when the page loads.

 

How can control which method is checked by default?

 

Many Thanks in advance.

 

Plamen

Posted

the cheapest shipping method is checked by default. If you want to change this behavior you need to edit your catalog\includes\classes\shipping.php function cheapest().

Posted
the cheapest shipping method is checked by default. If you want to change this behavior you need to edit your catalog\includes\classes\shipping.php function cheapest().

 

Hi Enigma,

 

My cheapest is £0.00 but it checks the other which is £15.00. Maybe because it's £0.00.

Do you have any ideas how I tweak the finction to make it select £0.00 first

 

function cheapest() {
  if (is_array($this->modules)) {
	$rates = array();

	reset($this->modules);
	while (list(, $value) = each($this->modules)) {
	  $class = substr($value, 0, strrpos($value, '.'));
	  if ($GLOBALS[$class]->enabled) {
		$quotes = $GLOBALS[$class]->quotes;
		for ($i=0, $n=sizeof($quotes['methods']); $i<$n; $i++) {
		  if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) {
			$rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'],
							 'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')',
							 'cost' => $quotes['methods'][$i]['cost']);
		  }
		}
	  }
	}

	$cheapest = false;
	for ($i=0, $n=sizeof($rates); $i<$n; $i++) {
	  if (is_array($cheapest)) {
		if ($rates[$i]['cost'] < $cheapest['cost']) {
		  $cheapest = $rates[$i];
		}
	  } else {
		$cheapest = $rates[$i];
	  }
	}

	return $cheapest;
  }

 

Thanks

Archived

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

×
×
  • Create New...