Jump to content

USPS Shipping Questions


Guest loren antolik

Recommended Posts

Guest loren antolik

i am using cubecart version 3.06 and am only using the USPS shipping module. i have all other shipping modules disabled.

1. where do i print the shipping labels from ?

2. how do i apply the weight of the package to my submitted usps shipping weights for shipping estimates? i don't want to include package weight in the weight of the product database line item because i will overcharge my customers that purchase more than one product with inflated shipping costs (i.e. charged for the weight of 10 packages when only one was needed to ship 10 products)

3. how can i filter the international search results ?

thank you for reading and i hope to hear from you.

Link to comment
Share on other sites

Hi Loren,

I hope this info will help.

1. where do i print the shipping labels from ?

Right now I just accept my payments via PayPal...which i can print shipping labels directly from PayPal. If your not using them, you might want to check out one of those postage / label printing services like 'stamps.com' ... It's about $15 a month but you'll get discount shipping rates, nice printed postal labels, and the ability to print Airmail International postage too.

2. how do i apply the weight of the package to my submitted usps shipping weights for shipping estimates? i don't want to include package weight in the weight of the product database line item because i will overcharge my customers that purchase more than one product with inflated shipping costs (i.e. charged for the weight of 10 packages when only one was needed to ship 10 products)

For each item in my database, I just add an additional 1 ounce (0.0625) to each actual item weight. Then at checkout, the USPS module will just add up all the weight and it will be fairly accurate.

3. how can i filter the international search results ?

I hard coded this into my 'modules/shipping/USPS/class.usps.php' file.

From about line 490 or so to then end, I changed a few things around and adding some code in that will only select 'Global Express Mail, Global Priority Mail (Not the flat rate but variable!), and Airmail Letter Post'.

		else if(isset($xml['IntlRateResponse']))

		{

			//This is international data, so parse it accordingly

			$intshipping = array ( "Global Express Mail (EMS)", "Global Priority Mail - Variable Weight (Single)", "Airmail Letter Post" );

			$package_id = 0;



			if(isset($xml['IntlRateResponse']['#']['Package']['0']['#']['Error']))

			{

				$x_errorDesc = $xml['IntlRateResponse']['#']['Package']['#']['Error'];

				$this->current_result[$package_id]['Error']['Description'] = $x_errorDesc;

			}

			else if(isset($xml['IntlRateResponse']))

			{

				$x_postage = $xml['IntlRateResponse']['#']['Package']['0']['#']['Service'];



				for($i=0; $i < count($x_postage); $i++)

				{

					$x_mailservice = $x_postage[$i]['#']['SvcDescription']['0']['#'];

					$x_rate = $x_postage[$i]['#']['Postage']['0']['#'];

					$service = $x_postage[$i]['#']['SvcDescription']['0']['#'];

					

					if ( $service == $intshipping[0] or $service == $intshipping[1] or $service == $intshipping[2] )

						{ 

							$this->current_result[$package_id]['Postage'][$x_mailservice] = $x_rate;

						}

						

//#					echo "MailService = ".$x_mailservice."<br>";

//#					echo "Rate = ".$x_rate."<br>";

					

//					$this->current_result[$package_id]['Postage'][$x_mailservice] = $x_rate;

				} 

			}

		}



		return true;

	}



	function get_rates($package_id = 0)

	{

		if($this->current_result[$package_id]['Error']) return $this->current_result[$package_id]['Error']['Description'];



#		if($this->api == 'RateV2')

			return $this->current_result[$package_id]['Postage'];

#		else if($this->api == 'IntlRate')

#		{

			//SvcDescription and Postage

#			$result = array();



#			foreach($this->current_result[$package_id]['Service'] as $service)

#			{

#				$key = $service['SvcDescription'];

#				$result[$key] = $service['Postage'];

#			}



			return $result;

#		}

#		else return false;

	}



	function get_prohibitions($package_id)

	{

		if($this->api == 'IntlRate') return $this->current_result[$package_id]['Prohibitions'];

		else return false;

	}



	function get_restrictions($package_id)

	{

		if($this->api == 'IntlRate') return $this->current_result[$package_id]['Restrictions'];

		else return false;

	}



	function get_observations($package_id)

	{

		if($this->api == 'IntlRate') return $this->current_result[$package_id]['Observations'];

		else return false;

	}



	function get_areas_served($package_id)

	{

		if($this->api == 'IntlRate') return $this->current_result[$package_id]['AreasServed'];

		else return false;

	}



	function get_package_error($package_id)

	{

		if($this->current_result[$package_id]['Error']) return $this->current_result[$package_id]['Error'];

	}

}



?>

I hope this helps you out!

-Tim

Link to comment
Share on other sites

thanks for responding. i will try these out.

can i just print my labels from the usps website ?

Yes you can but only Priority, Express for domestic...and EMS I think for the international.

I ship a lot of lightweight items, so I have a lot of things that go out just 1st Class Mail which saves the customer money. Airmail packages though I have to just print out a basic label here on my small label printer, then just pay the postage at the post office.

Link to comment
Share on other sites

Guest loren antolik

thank you for this. it filtered my results properly.

i would like to add for anyone that plans on implementing this code, that the only modification necessary are the declaration of the international shipping services array

$intshipping = array ( "Global Express Mail (EMS)", "Global Priority Mail - Variable Weight (Single)", "Airmail Letter Post" );

and the conditional code

if ( $service == $intshipping[0] or $service == $intshipping[1] or $service == $intshipping[2] ) {

$this->current_result[$package_id]['Postage'][$x_mailservice] = $x_rate;

}

which essentially just replaces this line of code

$this->current_result[$package_id]['Postage'][$x_mailservice] = $x_rate;

very nice mod.

Link to comment
Share on other sites

Glad it worked well for you. I know when all those different international shipping options are listed, there needed to be some type of control.

This is just basically a quick fix. I suppose if someone had the time they could actually implement this into the whole USPS module where you can select which international methods you need, just like you can now with the domestic methods via the Admin Menu.

Link to comment
Share on other sites

  • 3 months later...

for some reason my cart is not showing the

http://www.cubecart.com/site/forums/index....showtopic=18082 but even if i limit his original http://www.braindamagefilms.com/ if you wanna test out a user that is already setup with an international address try [email protected]/bob please let me know if yall have any suggestions heres the code i added to class.usps.php from 490 down

GLOBAL PRIORITY MAIL - VARIABLE WEIGHT (SINGLE)
 

option i implemented the mod as suggested by user TimHinsel 



  $intshipping = array ( "Global Express Mail (EMS)", "Global Priority Mail - Variable Weight (Single)", "Airmail Letter Post" );




to just 
 $intshipping = array ( "Global Priority Mail - Variable Weight (Single)");




it still only shows Global Express Mail (EMS)



you can see my shopppping cart here ... 

 else if(isset($xml['IntlRateResponse']))

		{

			//This is international data, so parse it accordingly

			$intshipping = array ( "Global Priority Mail - Variable Weight (Single)");

			$package_id = 0;



			if(isset($xml['IntlRateResponse']['#']['Package']['0']['#']['Error']))

			{

				$x_errorDesc = $xml['IntlRateResponse']['#']['Package']['#']['Error'];

				$this->current_result[$package_id]['Error']['Description'] = $x_errorDesc;

			}

			else if(isset($xml['IntlRateResponse']))

			{

				$x_postage = $xml['IntlRateResponse']['#']['Package']['0']['#']['Service'];



				for($i=0; $i < count($x_postage); $i++)

				{

					$x_mailservice = $x_postage[$i]['#']['SvcDescription']['0']['#'];

					$x_rate = $x_postage[$i]['#']['Postage']['0']['#'];

					$service = $x_postage[$i]['#']['SvcDescription']['0']['#'];

					

					if ( $service == $intshipping[0] or $service == $intshipping[1] or $service == $intshipping[2] )

						{

							$this->current_result[$package_id]['Postage'][$x_mailservice] = $x_rate;

						}

						

//#					echo "MailService = ".$x_mailservice."<br>";

//#					echo "Rate = ".$x_rate."<br>";

					

//					$this->current_result[$package_id]['Postage'][$x_mailservice] = $x_rate;

				}

			}

		}



		return true;

	}



	function get_rates($package_id = 0)

	{

		if($this->current_result[$package_id]['Error']) return $this->current_result[$package_id]['Error']['Description'];



#		if($this->api == 'RateV2')

			return $this->current_result[$package_id]['Postage'];

#		else if($this->api == 'IntlRate')

#		{

			//SvcDescription and Postage

#			$result = array();



#			foreach($this->current_result[$package_id]['Service'] as $service)

#			{

#				$key = $service['SvcDescription'];

#				$result[$key] = $service['Postage'];

#			}



			return $result;

#		}

#		else return false;

	}



	function get_prohibitions($package_id)

	{

		if($this->api == 'IntlRate') return $this->current_result[$package_id]['Prohibitions'];

		else return false;

	}



	function get_restrictions($package_id)

	{

		if($this->api == 'IntlRate') return $this->current_result[$package_id]['Restrictions'];

		else return false;

	}



	function get_observations($package_id)

	{

		if($this->api == 'IntlRate') return $this->current_result[$package_id]['Observations'];

		else return false;

	}



	function get_areas_served($package_id)

	{

		if($this->api == 'IntlRate') return $this->current_result[$package_id]['AreasServed'];

		else return false;

	}



	function get_package_error($package_id)

	{

		if($this->current_result[$package_id]['Error']) return $this->current_result[$package_id]['Error'];

	}

}



?>






I also just added the code


if($basket['delInf']['country']!==$config['siteCountry']) {

		$api = "IntlRate";

	} else {

		 $api = "RateV2";

	}



if($api=="IntlRate") {

	$module = fetchDbConfig("USPSINT");

	} else {

	$module = fetchDbConfig("USPS");

	}

to the top of my calc.php to take care of the duplicates issue that was happening as suggested again by tim.....

http://www.cubecart.com/site/forums/index....Global+Priority

no change except it took away the dupes ... still only have Global Express Mail (EMS)

Link to comment
Share on other sites

anyone?

i tried contacting support but they said no help on mods ... i dont understand ... this isnt a mod ...its fixing functionality that does not work correctly right?

Link to comment
Share on other sites

Guest Majestic RC

2. how do i apply the weight of the package to my submitted usps shipping weights for shipping estimates? i don't want to include package weight in the weight of the product database line item because i will overcharge my customers that purchase more than one product with inflated shipping costs (i.e. charged for the weight of 10 packages when only one was needed to ship 10 products)

For each item in my database, I just add an additional 1 ounce (0.0625) to each actual item weight. Then at checkout, the USPS module will just add up all the weight and it will be fairly accurate.

I hope this helps you out!

-Tim

I have tried this, but USPS priority only lets me chose a flate rate box.

How can I get it to a variable to be calculated by weight.

Link to comment
Share on other sites

Guest ladagerick

I have used the code as suggested and it has limited the intl shipping perfectly (Thank you) except I still gets the duplicates in intl shipping(better than a all choices). I am using Cubecart 3.0.9 and php 5.1.4 any other suggestions on eliminating the duplicates? I had a question in another thread and will eliminate it if I can.(couldn't figure out how)

please let me know if ya'll have any suggestions

Has anyone heard of a mod that allows free shipping US and CA and allows USPS Intl by weight with only global priority, air-parcel post and surface?

Link to comment
Share on other sites

Guest jmn0426

thanks for responding. i will try these out.

can i just print my labels from the usps website ?

you can also download "shipping assistant" from the USPS website. you can print your labels out with that as well.

Link to comment
Share on other sites

  • 2 weeks later...
Guest mashurst

Has anyone heard of a mod that allows free shipping US and CA and allows USPS Intl by weight with only global priority, air-parcel post and surface?

that would be cool. the problem that i have is that i can almost setup that function with the shipping by weight option. however, when you specify 1 lb 0.00 it treats it as shipping for 1 lb to the zone is unavailable, rather than free. If I put in 0.01 cent then it works correctly. If the shipping by weight option worked with a 0.00 amount in it, it would be the solution to the free shipping only to select locations option.

Link to comment
Share on other sites

Guest mashurst

Has anyone heard of a mod that allows free shipping US and CA and allows USPS Intl by weight with only global priority, air-parcel post and surface?

that would be cool. the problem that i have is that i can almost setup that function with the shipping by weight option. however, when you specify 1 lb 0.00 it treats it as shipping for 1 lb to the zone is unavailable, rather than free. If I put in 0.01 cent then it works correctly. If the shipping by weight option worked with a 0.00 amount in it, it would be the solution to the free shipping only to select locations option.

I figured it out, put a value of 0.001 for the cost and it will come up 0.00 at checkout.

-M

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