Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

USPS handling fee as a percentage?


tdo82

Recommended Posts

  • 4 weeks later...

look in the usps.php function quote() once the value returns from the usps carrier you have this code:

 

			$methods[] = array('id' => $type,
						   'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
						   'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);

 

change it so it is:

$final_cost = ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
$final_cost = floatval($final_cost) + (floatval($final_cost)*2)/100;
		$methods[] = array('id' => $type,
						   'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
						   'cost' => strval($final_cost);

 

see if its any better.

Edited by enigma1
Link to comment
Share on other sites

  • 2 weeks later...

Thanks enigma1, I'm also in need of a percentage for handling costs. The code just seemed to add a couple more cents onto the dollar amount of handling. Ex: handling is set at 5 (or 5%), then the shipping is increased five dollars and some cents.

 

For future reference, there were a couple of syntax errors in the code, maybe my edits whacked it? -thanks for checking it out!

			$final_cost = ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes;
		$final_cost = floatval($final_cost) + (floatval($final_cost)*2)/100;
		$methods[] = array('id' => $type,
							'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
							'cost' => strval($final_cost));

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...