Jump to content
bad_lemming

[Contribution] - USPS Methods

Recommended Posts

I installed 4.30 alpha today. Works fine, but I'm now not able to use AJAX order editor.

I click on EDIT goes to edit_orders.php and gives a blank screen. I imagine something needs to be changed int he AJAX order editor contrib to work with the changes made to the USPS entries in configuration table in the database.

I'm running 5.05 on ajax. Anyone else get these 2 to comingle?

 

thanks,

Share this post


Link to post
Share on other sites
I installed 4.30 alpha today. Works fine, but I'm now not able to use AJAX order editor.

I click on EDIT goes to edit_orders.php and gives a blank screen. I imagine something needs to be changed int he AJAX order editor contrib to work with the changes made to the USPS entries in configuration table in the database.

I'm running 5.05 on ajax. Anyone else get these 2 to comingle?

 

thanks,

 

 

 

Hi ALL,

 

I figured this out and thought I'd share in case anyone else needed the fix.

It has to do with the // Round up function for non whole numbers by GREG DEETH

 

Installation instructions tell you to install this in general.php on the catalog side, but not the admin side.

For AJAX order editor to work you need to integrate this function into the general.php in admin/includes/functions

 

Open the general.php find this:

 

////

// Wrapper function for round() for php3 compatibility

function tep_round($value, $precision) {

if (PHP_VERSION < 4) {

$exp = pow(10, $precision);

return round($value * $exp) / $exp;

} else {

return round($value, $precision);

}

}

 

and copy the roundup function directly below and save it. AJAX Order editor will then work properly.

 

////

// Round up function for non whole numbers by GREG DEETH

// The value for the precision variable determines how many digits after the decimal and rounds the last digit up to the next value

// Precision = 0 -> xx.xxxx = x+

// Precision = 1 -> xx.xxxx = xx.+

// Precision = 2 -> xx.xxxx = xx.x+

function tep_round_up($number, $precision) {

$number_whole = '';

$num_left_dec = 0;

$num_right_dec = 0;

$num_digits = strlen($number);

$number_out = '';

$i = 0;

while ($i + 1 <= strlen($number))

{

$current_digit = substr($number, $i, ($i + 1) - $num_digits);

if ($current_digit == '.') {

$i = $num_digits + 1;

$num_left_dec = strlen($number_whole);

$num_right_dec = ($num_left_dec + 1) - $num_digits;

} else {

$number_whole = $number_whole . $current_digit;

$i = $i + 1;

}

}

if ($num_digits > 3 && $precision < ($num_digits - $num_left_dec - 1) && $precision >= 0) {

$i = $precision;

$addable = 1;

while ($i > 0) {

$addable = $addable * .1;

$i = $i - 1;

}

$number_out = substr($number, 0, $num_right_dec + $precision) + $addable;

} else {

$number_out = $number;

}

return $number_out;

}

 

 

 

 

 

Cheers.

WWW.MOUNTAINMODS.COM

Share this post


Link to post
Share on other sites
Hello,

I'm not sure if something changed with USPS recently, however First Class Mail no long shows up to my customers. I checked the Admin section, and it is selected as a choice that should be displayed to customers, however it never shows up.

I don't remember making any new modifications to the module, I'm using V3.0.2., but I know it used to work just fine. Does anyone have any ideas what may have changed recently to make First Class Mail no longer show, or even butter, what needs to happen to make it show?

 

Ok, I could not figure out what was going wrong, so I un-installed the 3.0.2 version and installed VERSION: 4.3.0 ALPHA, and no First-Class options appear no matter the weight of my package, or what I set the limit to. Around line 368 of checkout_shipping.php the line echo($quotes[$i]['methods'][$j]['title']); prints the calculated shipping options to the screen, does anyone know where this is fed from? I'm trying to track down WHY I'm not getting any information on First-Class shipping, but I don't know where the data is sent to USPS or received from USPS, so I can't check it. Does anyone know where in the code information is sent to the USPS servers?

Share this post


Link to post
Share on other sites
I am currently using version 3.0.2 and have the problem where my international customers are having to use GLOBAL EXPRESS because it will not let them select the other usps shipping options. Is there a fix to this or has this been resolved with the newer versions available for this contribution?

 

I really need an answer to this real soon or I will lose my international customer base...

 

I am seeing this exact same problem and I didn't notice that anyone answered with a resolution. My international customers are selecting First Class International but are then defaulted to Global Express once they reach the payment screen.

 

Obviously there are ways around this but using the USPS module is more accurate and allows the customer to choose a faster method if they so wish. Has anyone solved this problem?

Share this post


Link to post
Share on other sites

So I am having issues with the Priority Mail and Parcel costs. For an order under 1lb is is saying $6.60(parcel) and $6.65 for Priority. The cost should be $4.80 for Priority and around that for Parcel. I have tare set to 0 but can not figure out what I am missing..... There are no tax rates either. Can anyone assist me?

Share this post


Link to post
Share on other sites

i was having the same problem where no matter which method the customer selected for International shipping, the next screen would always show the Global Express rate. Then I installed this latest USPS 3.02 contribution, and that problem went away. HOWEVER, none of the First-Class International shipping methods appear as an option for the customer.

 

For a 2 oz package, all I get are the following methods on the screen (and appropriate rates):

 

United States Postal Service (1 x 2oz)

Priority Mail International

Express Mail International (EMS)

Global Express Guaranteed Non-Document Non-Rectangular

Global Express Guaranteed Non-Document Rectangular

Global Express Guaranteed

 

In Admin, I have all the available shipping methods selected for International:

 

Int'l Shipping Methods

 

GLOBAL EXPRESS

GLOBAL EXPRESS NON-DOC RECT

GLOBAL EXPRESS NON-DOC NON-RECT

EXPRESS MAIL INT

EXPRESS MAIL INT FLAT RATE ENV

PRIORITY MAIL INT

PRIORITY MAIL INT FLAT RATE ENV

PRIORITY MAIL INT FLAT RATE BOX

FIRST-CLASS MAIL INT

 

Looking at the data returned from the USPS, I do see the FIRST-CLASS MAIL INT rates:

 

<Service

ID="13"><Pounds>0</Pounds><Ounces>2</Ounces><MailType>Package</MailType><Cou

ntry>CANADA</Country>

<Postage>1.00</Postage><SvcCommitments>Varies</SvcCommitments>

<SvcDescription>First Class Mail International Letters</SvcDescription> <MaxDimensions>Max. length 11.5", height 6 1/8" or more than 1/4"

thick</MaxDimensions><MaxWeight>0.2188</MaxWeight></Service>

 

<Service

ID="14"><Pounds>0</Pounds><Ounces>2</Ounces><MailType>Package</MailType><Cou

ntry>CANADA</Country>

<Postage>1.29</Postage><SvcCommitments>Varies</SvcCommitments>

<SvcDescription>First Class Mail International Large Envelope</SvcDescription> <MaxDimensions>Max. length 15", height 12 or more than 3/4"

thick</MaxDimensions><MaxWeight>4</MaxWeight></Service>

 

<Service

ID="15"><Pounds>0</Pounds><Ounces>2</Ounces><MailType>Package</MailType><Cou

ntry>CANADA</Country>

<Postage>1.49</Postage><SvcCommitments>Varies</SvcCommitments>

<SvcDescription>First Class Mail International Package</SvcDescription> <MaxDimensions>Max. length 24", max length, height and depth (thickness) combined 36"</MaxDimensions><MaxWeight>4</MaxWeight></Service>

 

Does anyone have a clue why this is happening, or how the individual shipping methods are selected to display?

Share this post


Link to post
Share on other sites

Found my problem. Sure would help to have some better documentation with the contribution on how methods are selected for adding to the screen.

 

What I did was make sure that the text in the usps.php file for the intl_types array matches EXACTLY the sevice id descriptions that are returned by USPS. Thus to have First Class Mail International Package rates to show up, I had to make sure that the array looked liked this.....

 

$this->intl_types = array(

'FIRST-CLASS MAIL INT' => 'First Class Mail International Package',

'GLOBAL EXPRESS' => 'Global Express Guaranteed',

'GLOBAL EXPRESS NON-DOC RECT' => 'Global Express Guaranteed Non-Document Rectangular',

'GLOBAL EXPRESS NON-DOC NON-RECT' => 'Global Express Guaranteed Non-Document Non-Rectangular',

'EXPRESS MAIL INT' => 'Express Mail International (EMS)',

'EXPRESS MAIL INT FLAT RATE ENV' => 'Express Mail International (EMS) Flat Rate Envelope',

'PRIORITY MAIL INT' => 'Priority Mail International',

'PRIORITY MAIL INT FLAT RATE ENV' => 'Priority Mail International Flat-Rate Envelope',

'PRIORITY MAIL INT FLAT RATE BOX' => 'Priority Mail International Flat Rate Box'

);

 

 

Note that '-' (dashes) make a difference.

 

Not sure this was the 'correct' fix, but it worked for me.

Share this post


Link to post
Share on other sites

Okay that worked, although I have more shipping options and it looks like this:

 

$this->intl_types = array('Global Express' => 'Global Express Guaranteed',

'Global Express Non-Doc Rect' => 'Global Express Guaranteed Non-Document Rectangular',

'Global Express Non-Doc Non-Rect' => 'Global Express Guaranteed Non-Document Non-Rectangular',

'Global Express Envelopes' => 'USPS GXG Envelopes',

'Express Mail Int' => 'Express Mail International (EMS)',

'Express Mail Int Flat Rate Env' => 'Express Mail International (EMS) Flat-Rate Envelope',

'Priority Mail International' => 'Priority Mail International',

'Priority Mail Int Flat Rate Env' => 'Priority Mail International Flat-Rate Envelope',

'Priority Mail Int Flat Rate Box' => 'Priority Mail International Flat-Rate Box',

'Priority Mail Int Flat Rate Lrg Box' => 'Priority Mail International Large Flat Rate Box',

'First Class Mail Int Lrg Env' => 'First Class Mail International Large Envelope',

'First Class Mail Int Package' => 'First Class Mail International Package',

'First Class Mail Int Letters' => 'First Class Mail International Letters',

'First Class Mail Int Flats' => 'First Class Mail International Flats',

'First Class Mail Int Parcels' => 'First Class Mail International Parcels');

Share this post


Link to post
Share on other sites
wesley

Try to go to your configuration page, where is a tab "Shipping/Packaging" and make sure you add your zip code, and other information "from"

 

I wanted to thank both you and Wesley for insight to this problem. I was having the same trouble but I had no idea that I forgot to load necessary information. Thanks for your help.

Share this post


Link to post
Share on other sites

Hi everyone!!

I need a help here.

I installed V4.3.1 today.

Somehow my option is not working.

there are only 15 empty boxes below "sort order" option.

 

I reinstalled but it's still same.

 

my API is working fine I tested with default USPS module.

 

Thank you!

 

Satomi

Share this post


Link to post
Share on other sites

I am using OSCommerce v2.2 and am using Methods version 4.3 new install. I added the code segments, uploaded the 2 usps files, and reinstalled the module; yet still get this error:

 

An error occured with the USPS shipping calculations.
If you prefer to use USPS as your shipping method, please contact the store owner.

 

Can it be that USPS needs to activate the osCommerce API since I was not able to query that api.

 

Thanks

Share this post


Link to post
Share on other sites
I am using OSCommerce v2.2 and am using Methods version 4.3 new install. I added the code segments, uploaded the 2 usps files, and reinstalled the module; yet still get this error:

 

An error occured with the USPS shipping calculations.
If you prefer to use USPS as your shipping method, please contact the store owner.

 

Can it be that USPS needs to activate the osCommerce API since I was not able to query that api.

 

Thanks

 

Also it keeps deleting my user and password upon editing module.

Share this post


Link to post
Share on other sites

Mark,

Make sure you made the edit to adim/modules.php as stated in the docs under pre 3.0 version. Should fix it.

 

lildog

Share this post


Link to post
Share on other sites

I wanted to offer free shipping on my site for orders over $99 and still offer express postal service, if the customer wished to have faster delivery.

 

I could not find anything that would set Parcel Post to 0 if the order was equal to or over $99 and still display the other shipping options.

 

Took a second look at the code and made this change to offer Parcel Post free with orders over $99.

 

case 'Parcel Post':

$time = ereg('<Days>(.*)</Days>', $transresp[$service], $tregs);

$time = $tregs[1];

if ($time == '' || $time == 'No Data') {

$time = MODULE_SHIPPING_USPS_TEXT_ESTIMATED . ' 2 - 9 ' . MODULE_SHIPPING_USPS_TEXT_DAYS;

} elseif ($time == '1') {

$time .= ' ' . MODULE_SHIPPING_USPS_TEXT_DAY;

} else {

$time .= ' ' . MODULE_SHIPPING_USPS_TEXT_DAYS;

}

if ($order->info['subtotal'] >= 99) {

$postage = 0;

} else {

$postage = $postage + $this->handling[5];

}

break;

 

This might be useful to someone else.

 

Cheers


Using IE6 with today’s websites is like driving a horse and buggy in New York City during rush hour traffic and expecting everyone else to accommodate to you. It’s simply time to upgrade.

Share this post


Link to post
Share on other sites

Having some problems with this. I keep getting this error

 

Shipping Method

 

This is currently the only shipping method available to use on this order.

United States Postal Service

An error occured with the USPS shipping calculations.

If you prefer to use USPS as your shipping method, please contact the store owner.

 

 

 

Also at the top of the page I get 8 lines of this

 

Warning: fsockopen() [function.fsockopen]: unable to connect to production.shippingapis.com:80 (Permission denied) in /home/www/safetechonline.net/catalog/includes/classes/http_client.php on line 330

 

I contacted USPS to make sure I was on production server.

I have tried to reinstall module 2 times.

 

Thanks for help

 

Terry T

Share this post


Link to post
Share on other sites

The only thing that has worked for me is to uninstall the module. Try to remove all cookies as much as possible. it's just an internet thing why you should do that during things like this. Then make sure all of your store info is properly filled out including the zip code in short format. Ex: 90210

 

Than re-install the module and enter in your shipping api userame and password. Not your webtools password.

Set the index number to 1. For some reason it didn't work right away for me on but did work after a few hours. Reset cookies if you have to too.

 

This same goes for OSC 3.

 

For ZenCart this is not a problem since it tells you that you need to enter in the zip code if you didn't. I really think OSC should have smiler error handleing like this out of the box.

Also, ZenCart is based on OSC.

Share this post


Link to post
Share on other sites

I'm having problems with the international shipping with this module: I've installed 4.3.1 and it works fine for domestic and also for International Flat-Rate Envelope, but for Flat-Rate Box and First-Class International, it just returns:

 

An error occured with the USPS shipping calculations.

If you prefer to use USPS as your shipping method, please contact the store owner.

 

Any idea why it's having problems with these two options? Everything else seems fine..

 

Thanks!

 

Dominic

Share this post


Link to post
Share on other sites

What if you simply want to add the latest USPS methods to a new and clean install of osCommerce Online Merchant v2.2 RC 2a .

 

What part of the instructions should you follow at that point, especially if you were adding the flat rate USPS module as well?

 

I tried a normal install and it looked like it worked, but then when you try to edit the options, there are fields, but no text above them telling you what everything is.. in other words the entire page to edit is blank other than empty fields. If you refresh aain, it simply disappears completely.

 

I know its me, but I don't understand which install instructions I should follow.

 

TIA for any advice.

 

Mike

Share this post


Link to post
Share on other sites

Hello I just installed USPS VERSION: 4.3.0 ALPHA

Can anyone tell me how I can remove all these brackets so that my "Display transit time" looks more professonal on my checkout_confirmation page?

 

Currently it displays like this:

 

U.S Postal Service (Express Mail (Estimated 1 - 2 Days) ) :$27.65

 

How can I edit the code so it shows something like:

 

U.S Postal Service Express Mail (Estimated 1 - 2 Days) :$27.65

 

Thanks for any advice

Edited by kilra

Share this post


Link to post
Share on other sites

I also noticed that when I have Display Weight enabled it shows an excessive description:

 

U.S Postal Service (1 x 1.4lbs) (1lbs, 6.4oz) (Express Mail): $27.65

 

As you can imagine, this enabled along with Display transit time shows a very ugly and long string:

 

U.S Postal Service (1 x 1.4lbs) (1lbs, 6.4oz) (Express Mail (Estimated 1 - 2 Days) ): $27.65

 

Thanks again for any advice on cleaning this up alittle bit

Edited by kilra

Share this post


Link to post
Share on other sites

I needed International stamps at $.94/oz. Half the time I need two. Not enough space for 10 stamps.

 

 

BTW... They changed the API tags for international rates. I've fixed it and am uploading v4.1 There are now options for Firstclass package, letter, or large envelope. Also options for priority flatrate box and large flatrate box inside usps.php.

 

You know, I can't get any quotes through for Priority Mail International for any sort of Flat Rate Box. It would be helpful to have those show up....

 

In fact, for 16 pounds, under International shipping addresses, the Express Mail Envelope option appears - and quite cheaply I might add....

 

I installed the 4.3.1 version, too......

 

Any ideas?

Edited by fang

Share this post


Link to post
Share on other sites

I have a question. I called USPS and they switched me over to production. Question is when I do a check out, this message displays " An error occured with the USPS shipping calculations.

If you prefer to use USPS as your shipping method, please contact the store owner."

 

I was wondering how I can resolve this error as I had registered to use the Webtools, got the username and password, and called USPS. USPS sent me an email with these two URLs and I asked the representative how or what should do with them and he said I need to add the URLs to my third party checkout, but I do not see an option where I can do so, please help, thanks.

Share this post


Link to post
Share on other sites

Just wanted to add that if you are getting the following error or similar:

tep_cfg_multiinput_list() in /home/mysite/public_html/catalog/admin/modules.php(217) : eval()'d code on line 1

check to make sure your admin/includes/modules.php and admin/includes/functions/general.php have all the updated code mentioned in the directions for previous versions...if you've installed other contributions, you may have replaced those pages with earlier versions that need updating....even if you haven't used other contributions, check anyway.

don't ask me how I know :rolleyes:

Share this post


Link to post
Share on other sites

Hi Folks, I have installed USPS Methods 4.3.1 on my site, but have found a problem.

 

The installation seems to have gone smooth, but nothing show up during the checkout process. I have UPS and USPS Flat Rate shipping modules installed and they show up and work correctly. but the regular USPS shipping option doesn't show. There are no errors even.

 

I'm not sure what is wrong. I already have my USPS api account on the production server, although I have not been able to verify that it works because of this module not working.

 

Any help would be appreciated.

 

Thanks in advanced.

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

×