Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Heads Up: July 28, 2013 USPS Name Change for Express Mail


krdito

Recommended Posts

Just as a point of info.. if you keep making changes and are not progressing where you think you should be.. check your database the CONFIGURATION TABLE to see if there are any USPS entries that were not removed the last time you uninstalled. Clearing CACHE & COOKIES might also help but the bigger finger pointing is to left over stuff in the database..

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

I've been able to fix the "First-Class" issue in my modified version of 5.2.+. All my Domestic is now working.

 

USPS doesn't state this change in their notice but I was able to see it when viewing the USPS XML Response emails. Prior USPS xml response had been returning <MailService>First-Class Mail Parcel</MailService>. The USPS xml response now returns <MailService>First-Class Mail</MailService> and <FirstClassMailType>PARCEL</FirstClassMailType>. They have split the service name into 2 responses.

FYI- I did an example above for PARCEL, but the fix should take care of all First-Class types. I also removed all the extra characters (in above example) for the Registration Mark and the Trade Mark to make it more readable - add back in what you need.

 

Here's my fix (use at your own risk. ONLY for 5.2+, Not written or tested on 6.1+. Assumes that you have added in the new USPS naming conventions into your code):

 

In the "START DOMESTIC RESPONSE" section, after the <MailService>(.*)</MailService> code (2 lines), I inserted:

 

$fctype=";

$fctype=preg_match('/<FirstClassMailType>(.*)<\/FirstClassMailType>/',$response[$i],$regs);

$fctype=$regs[1]

if($service=='First-Class Mail') // You may need to add your reg/tm info that you use in here also

{$service=$service . ' ' . ucwords(strtolower($fctype));

}

 

The last line changes the response from all caps to lower case and then capitalizes the first letter of each word (Ex: PARCEL to Parcel). Make sure that your final output on the $service variable matches your "case" statements that sets the day/days ($time). Once $service matches your "case" statements your handling fee issue will be fixed. You will also need to make sure that you change the other "case" labels to the new Priority Mail Express and Priority Mail Express Flat Rate Envelope for these package types to work correctly.

 

I'm still working on the International side, I think I have it all working except for the insurance. My XML response is having an issue adding extra characters that is messing up my $iinsurance preg_match statement. I hope to replace my XML file tomorrow and it should be working all OK.

 

Hope this helps - I was trying to explain what changed and a general way to solve the problem. There are so many variations of USPS shipping modules it's really hard to provide "exact" code fixes for everyone.

Link to comment
Share on other sites

Could you provide a link to the exact version you're talking about? The one that I found does not have "VERSION: 5.2.1 Updated to July 28 2013 Changes" at the top of the file...

 

http://www.oscommerce.com/forums/topic/393466-heads-up-july-28-2013-usps-name-change-for-express-mail/#entry1676716 already points directly to the exact file. FlyingKites posted it to this thread. Posted 28 July 2013 - 01:39 PM.

Link to comment
Share on other sites

This work good with me, thank you Sir .

 

 

Attached is a upgraded version of USPS Methods is based on 5.2.1. See http://addons.oscommerce.com/info/487 It is patched and current to 28 July 2013 changes. It works on 2.2, rc2a and 2.3. We've re-tested all options and services and believe they all work.

 

php.gif usps.php 52.26K 25 downloads

 

Please note the server is still set to staging. Go to lines 821-823 to reset to production.

 

You need to upload the file to modules/shipping. You need to uninstall then reinstall in Admin. Don't forget to make note of your settings before you uninstall.

 

Again this is USPS Methods Add On #487

Link to comment
Share on other sites

Actual response from USPS (the relevant part of one, anyway):

 

Priority Mail 2-Day<sup>â„¢</sup> Small Flat Rate Box

 

Moral: Don't trust the USPS API documentation. They lie.

 

Regards

Jim

Edited by kymation

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Attached is a upgraded version of USPS Methods is based on 5.2.1. See http://addons.oscommerce.com/info/487 It is patched and current to 28 July 2013 changes. It works on 2.2, rc2a and 2.3. We've re-tested all options and services and believe they all work.

 

php.gif usps.php 52.26K 25 downloads

 

Please note the server is still set to staging. Go to lines 821-823 to reset to production.

 

You need to upload the file to modules/shipping. You need to uninstall then reinstall in Admin. Don't forget to make note of your settings before you uninstall.

 

Again this is USPS Methods Add On #487

I guess I wasn't that lucky.

 

this is all teh pleasure I get out of it....

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

 

PHP Version: 5.3.3-7+squeeze14 (Zend: 2.3.0)

 

OSC 2.2 RC2a

 

lovely!

Link to comment
Share on other sites

Chris, I suggest before you rip your hair out uninstall, check your database configuration table for any left over USPS entries.. one of the updates was not cleaning house when uninstall it.. that caused that error too..

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

Chris, I suggest before you rip your hair out uninstall, check your database configuration table for any left over USPS entries.. one of the updates was not cleaning house when uninstall it.. that caused that error too..

I found a bunch of stuff.....

362 Domestic Insurance Options MODULE_SHIPPING_DMSTC_INSURANCE_OPTION None Select Options MODULE_SHIPPING_INTL_INSURANCE_OPTION None Select how Pounds MODULE_SHIPPING_USPS_PKG_SIZE_OVER60 24' date=' 24, 12 Typical Pounds MODULE_SHIPPING_USPS_PKG_SIZE_OVER50 22, 22, 16 Typical Pounds MODULE_SHIPPING_USPS_PKG_SIZE_OVER40 18, 18, 16 Typical Pounds MODULE_SHIPPING_USPS_PKG_SIZE_OVER30 16, 16, 16 Typical Pounds MODULE_SHIPPING_USPS_PKG_SIZE_OVER20 24, 12, 6 Typical Pounds MODULE_SHIPPING_USPS_PKG_SIZE_OVER10 16, 12, 10 Typical Pounds MODULE_SHIPPING_USPS_PKG_SIZE_OVER5 12, 12, 5 Typical Pounds MODULE_SHIPPING_USPS_PKG_SIZE_LESS5 12, 9, 3 Typical Amount MODULE_SHIPPING_USPS_DMSTC_INSURANCE_MAX 5000 Enter Insurance MODULE_SHIPPING_USPS_DMSTC_INSURANCE_MAX_ONLINE 5000 Enter Maximums MODULE_SHIPPING_USPS_DMSTC_FIRSTCLASS_LETTER 11.5, 6.125, 0.25, Maximums MODULE_SHIPPING_USPS_DMSTC_FIRSTCLASS_LRGLTR 15, 12, 0.75, Maximum MODULE_SHIPPING_USPS_DMSTC_FIRSTCLASS_PARCEL 13 Enter .......and there were a few more...

[/quote']

 

I'm really leary of deleting things directly from the database like that......bad things are known to happen.

Edited by badcaps
Link to comment
Share on other sites

Hi

Always back up your database before doing any changes that way you can revert back to what you have got.

If you are afraid of the software you will never learn.

Regards

Joli

To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

any of those entries that contain

MODULE_SHIPPING_USPS

you should have no issues removing.. but as stated. you can back up or export that table fore you do anything

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

Hi

Always back up your database before doing any changes that way you can revert back to what you have got.

If you are afraid of the software you will never learn.

Regards

Joli

Its not a fear of learning, its a fear of causing my livelyhood a massive outage.... ;) big difference!! Anyway, thanks for the info. Is it safe to flush the sessions table? It's almost 600mb, and I want to do a full dump of the database prior....and if there's no need to carry this over, I'd rather remove it.
Link to comment
Share on other sites

Its not a fear of learning, its a fear of causing my livelyhood a massive outage.... ;) big difference!! Anyway, thanks for the info. Is it safe to flush the sessions table? It's almost 600mb, and I want to do a full dump of the database prior....and if there's no need to carry this over, I'd rather remove it.

 

Hi,

If you are running a lot of sales I would duplicate / clone my database then start trying to optimize (flush sessions table )and then testing the new database by changing the x 2 configure.php 600 mb is really big !!

 

You can also empty the customers_basket and who's online tables.

 

but would really do this on a duplicate database so I could revert quickly back if something went wrong (w00t) .

 

Regards

Joli

To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

I believe I have installed this USPS update correctly. I cannot edit USPS settings in the admin area. I have tried to remove the MODULE SHIPPING USPS entries from the configuration table with no result. Any other tips? thank you.

 

I would like to add. I needed to add a function to my general.php file as detailed here for it to work correctly.

 

http://www.oscommerce.com/forums/topic/343677-tep-round-up-error/

Edited by mhulbrock
Link to comment
Share on other sites

Ok, I have uninstalled and reinstalled. Edit only seems to work the first time, then dissapears.

The DB feilds that were removed from above tip, did not re-save into the table. Should the data only be cleared? Any details how the edit button was fixed?

Edited by mhulbrock
Link to comment
Share on other sites

Ok, I have uninstalled and reinstalled. Edit only seems to work the first time, then dissapears.

The DB feilds that were removed from above tip, did not re-save into the table. Should the data only be cleared? Any details how the edit button was fixed?

 

Did you uninstall, check the database and remove and hanger-on entries THEN reinstall??? or did you check the DB while it was installed???

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

Perhaps someone in this forum can help me with this.

 

I was able to Uninstall the USPS Methods Module (5.2.0 - which was working properly prior to the recent USPS updates - probably because we do not use all the shipping options) and uploaded the two new files found in http://addons.oscommerce.com/info/487. For the most part the new USPS Methods Module (5.2.2) appears to be working properly again, with two exceptions. Neither the "Processing Time" nor the "Domestic Handling Fees" are adding these additions to the USPS responses for delivery date and shipping cost. I have reloaded the module's settings exactly as they were before the update, but no matter what numbers are included in either field, only the USPS amounts are returned.

 

Any idea what I need to change in order to get the additions to delivery time and shipping cost working again?

 

Thanks...

GEORGE

Link to comment
Share on other sites

@@mhulbrock - nope that would be the proper method :) but if it is not uninstalling then you have another issue.. chances are REALLY good that you have leftover entries in your database, in the configuration table. They should be removed - CAREFULLY. Of the entries I found that should have been gone, one needed to stay and just be edited.

 

I believe this happens when you upload a new file before you uninstall the old version. I'm ADD and I do that all the time, so I just know that is the first line of defense.. check the DB :)

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

My fix was! TURN ON YOUR ERROR MESSAGES! I was missing these functions from my functions>general.php file

// USPS Methods.  Added by Greg Deeth
// Alias function for Store configuration values in the Administration Tool.
 function tep_cfg_multiinput_list($select_array, $key_value, $key = '') {
    $key_values = explode( ", ", $key_value);

    for ($i=0; $i<sizeof($select_array); $i++) {
	  $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
	  $string .= '<br><input type="text" name="' . $name . '" value="' . $key_values[$i] . '"> ' . $select_array[$i];
    }
    $string .= '<input type="hidden" name="' . $name . '" value="--none--">';
    return $string;
 }

// USPS Methods.  Added by Greg Deeth
// Alias function for Store configuration values in the Administration Tool.
 function tep_cfg_multiinput_duallist_oz($select_array, $key_value, $key = '') {
    $key_values = explode( ", ", $key_value);
    $string .= '<center>';

    for ($i=0; $i<sizeof($select_array); $i++) {
				    $current_key_value = current($key_values);

	  $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
	  $string .= '<br><input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>oz</i>';
				    $string .= ' <b><</b> ' . $select_array[$i] . ' <u><b><</b></u>';
				    next($key_values);
				    $current_key_value = current($key_values);
				    $string .= '<input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>oz</i>';
				    next($key_values);
    }
    $string .= '<input type="hidden" name="' . $name . '" value="--none--">';

    $string .= '</center>';
    return $string;
 }
 function tep_cfg_multiinput_duallist_lb($select_array, $key_value, $key = '') {
    $key_values = explode( ", ", $key_value);
    $string .= '<center>';

    for ($i=0; $i<sizeof($select_array); $i++) {
				    $current_key_value = current($key_values);

	  $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
	  $string .= '<br><input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>lbs</i>';
				    $string .= ' <b><</b> ' . $select_array[$i] . ' <u><b><</b></u>';
				    next($key_values);
				    $current_key_value = current($key_values);
				    $string .= '<input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>lbs</i>';
				    next($key_values);
    }
    $string .= '<input type="hidden" name="' . $name . '" value="--none--">';

    $string .= '</center>';
    return $string;
 }

Link to comment
Share on other sites

I've gotten nearly everything to work -- except now when trying to ship to Virgin Islands (US), I get this message: 2147219080 - Missing value for Country Looks like that is coming from USPS. Any help with this? Thanks.

Link to comment
Share on other sites

@@TheGuy

That error means that the country name in the osCommerce Countries table does not match what the USPS is expecting for the Virgin Islands. You can find what the USPS is expecting here.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

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