Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Default Shipping Method - need help


dfrancis

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?

Link to comment
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....

Link to comment
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

Link to comment
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....

Link to comment
Share on other sites

  • 4 weeks later...
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...