Jump to content
Sign in to follow this  
dfrancis

Default Shipping Method - need help

Recommended Posts

I'm using two shipping modules - USPS and the contribution Store Pickup. Store Pickup is coming up as the default shipping method when a customer places and order and I want the USPS method to be the default. I assumed that the Sort Order option was controlling this but I'm having no luck with it. Does anyone know how to designate the default shipping method?

Share this post


Link to post
Share on other sites

From the knowledge base:

 

Sort Order (Display Order)

 

The sort order field associated with each module describes in what order the modules will be presented to the customer during checkout. The modules will always be displayed in alphabetical order in the Administrative tool, regardless of the Sort Order field. Changing the Sort Order can be done by editing the settings for that particular module, but cannot be done at the main shipping modules screen. The sorting is done with the lowest number representing the top of the displayed list, except for modules with a value of 0, which are put at the bottom. Ties are sorted alphabetically.

 

I hope this helps. Try setting the USPS module sort to 1; Store Pickup to 2.

 

jon


It's all just ones and zeros....

Share this post


Link to post
Share on other sites
Try setting the USPS module sort to 1; Store Pickup to 2.

 

Jon,

 

Thanks for the fast reply. My mistake was in setting them to 0 and 1, not 1 and 2. That fixed the sort order - thanks!

 

However, the radio is still defaulting to the Store Pickup. I presume this is no longer the sort order but rather some logic that sets the default to the lowest cost, in this case zero. Does anyone know where to look for that code? I'd like for it to disregard the zero and set it to the next lowest value.

 

Dave

Share this post


Link to post
Share on other sites

includes/classes/shipping.php makes it so the "cheapest" shipping method available is selected. So if USPS is less $$ than the other, this is why :)

 

Line 114-ish

	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;

 

Edit for file reference & Store pickup vs USPS

Edited by jonquil

It's all just ones and zeros....

Share this post


Link to post
Share on other sites
I'm using two shipping modules - USPS and the contribution Store Pickup. Store Pickup is coming up as the default shipping method when a customer places and order and I want the USPS method to be the default. I assumed that the Sort Order option was controlling this but I'm having no luck with it. Does anyone know how to designate the default shipping method?

 

I just installed the Default shipping methods contribution for this. Install was about 10 minutes and it works great. Here's the link:

 

http://www.oscommerce.com/community/contributions,4396

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×