Community Add-Ons
USPS Methods
for osCommerce Online Merchant v2.2
This allows a site owner to choose which USPS shipping methods will be available
to the customer. Settings can be changed in the admin interface under
Modules->Shipping->United States Postal Service.
For example, if you select "Express" and "Priority", then a customer will only
be shown those two options for USPS shipping.
NOTE: as a side benefit, you can now have a list of configuration options for a
given configuration_key with the new tep_cfg_select_multioption() function.
Legend:
Download
Report
Included in this mod are only 2 files - usps.php (includes/modules/shipping) and USPS_methods_utility.php (admin). These have been updated to reflect the Jan 27, 2013 USPS changes. Tested to work with International and Domestic Priority, First Class, and Parcel Post. Copy the files to their designated locations then uniinstall and install / edit the shipping module.
A pipe will not work correctly, so you need to change like the following:
ereg('<Description>(.*)</Description>',
to
preg_match('/<Description>(.*)</Description>/',
I am not sure which version i just modified to work, so empty file is attached.
If you need help installing this module, please visit atwoodz.com
This addition is an enhancement to the sort order which will still sort by cost and will now also sort by name. So display will show lowest to highest cost and if there are any shipping options with the same price they will be sorted by name (example: Express Mail, Express Mail Hold for Pickup). The only file included is the USPS.php file which should be placed within the /catalog/includes/modules/shipping/ directory overwriting the existing USPS.php file (you will obviously want to backup your original file to another directory or locally in the event that you will need to restore).
* updated text strings causing problems as of 22 January 2012 in usps.php and USPS_international_max_insurance.sql
* removed __MACOSX directory and .DS_Store cruft files
I'm not a maintainer, but I figure I'd save some people the trouble of doing this stuff by hand.
I found and fixed a bug in the packing class that was causing incorrect weight to be calculated when using Ready-To-Ship Only dimensional support.
I've also updated the shipping module with a couple of new configuration variables that tell it how much insured value the USPS will allow you to process online when quoting internet rates with insurance. When the package value exceeds this maximum then the retail rate will be returned instead.
Complete install is enclosed but only catalog/includes/classes/packing.php and catalog/includes/modules/shipping/usps.php have changed.
Changes for 6.0
*Updated country list and fixed country names that were invalid to the USPS and thus failed to return rates.
*Rewrote domestic and international quotes into separate functions since they each require different code.
*Rewrote the code for decoding rates to use the XML_unserialize class provided by the UPSXML contribution. This greatly simplified decoding the XML responses returned by the USPS rates server.
*Changed international handling so that each international shipping method could have it's own handling fee as was previously done with the domestic methods.
*Changed the configuration for available shipping methods and handling fees to install based on the shipping methods found in the usps function. In the future if the USPS changes methods, a simple change of the methods listed in the usps function followed by a remove and reinstall of the module will update the configuration for available methods and handling.
*Added ability for handling to be per package or per shipment.
*Added packaging support since the USPS now requires package sizes as part of the rate request. The module has a simplified version of estimated packaging based on weight built in, and it can also use the full packaging support made available by the UPSXML contribution if that is installed.
*Eliminated entry of a USPS password as this is no longer used by the USPS rates server.
*Added ability to display Signature or Delivery Confirmation if these options are used.
*When using USPS insurance, the module will now quote insurance for the maximum of either the package value or the maximum insurable value for that shipping method and destination. For instance, if the package is worth $800 and the maximum insurable value for the method to the chosen destination is $675 then the module will return a rate including insurance for $675. Previous versions would not include any insurance at all in that case.
******PHP 5.3 AND HIGHER ONLY!******
ereg is depricated, which throws errors at checkout.
Simply place a delimiter in the string.
Example:
ereg('<Description>(.*)</Description>',
with
preg_match('|<Description>(.*)</Description>|',
I chose the pipe delimiter because the forward slash will close the string early because of /Description.
Empty file uploaded. I was working on 5.0.3 and didn't get a chance to work on the latest version.
Regarding contribution from April 21, 2011.
Removing the trademark symbols violates USPS terms of use and federal law. Do so at your own risk.
FROM THE USPS DEVELOPER GUIDE:
USPS trademarks are trademarks owned solely and exclusively by USPS and may be used only in the form, manner and with appropriate legends prescribed by USPS. All advertising and other uses of USPS trademarks must include a legend indicating that USPS trademarks are the property of USPS and that they are being used under license from USPS, together with any other legends or marking that may be required by law. Nothing contained in this document shall be deemed to convey any title or ownership interest to any user except for the nonexclusive rights granted under the Terms and Conditions of Use for Internet Shipping Application Program Interfaces and this document. All use of USPS Trademarks shall inure to the benefit of USPS.
http://www.usps.com/webtools/htm/Development-Guide-v3-0b.htm#_Toc205879397
Regarding contribution from April 23, 2011
The USPS mods for RateV4 Intl Rate V2 methods DO NOT USE PASSWORDS.
There is not a missing password field. It was intentionally removed as a non necessity.
USPS api documentation can be found here:
http://www.usps.com/webtools/_pdf/Rate-Calculators-v1-2a.pdf
The most common culprit to installation problems is failure to uninstall the old module
before uploading the new files. This will cause database conflict problems.
No files here. Upload only contains this same text.
There is no problem with fresh install, but after saving and trying to edit, the second parameter (password) disappeared, and module will stop working.
I think it's better to replace the 3d query within install() method with
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enter the USPS User ID', 'MODULE_SHIPPING_USPS_USERID', 'NONE', 'Enter the USPS USERID assigned to you. <u>You must contact USPS to have them switch you to the Production server.</u> Otherwise this module will not work!', '6', '3', 'tep_cfg_multiinput_list(array('ID', 'Password'), ', now())");
just one file uploaded
catalog/includes/languages/english/shipping/usps.php and catalog/includes/modules/shipping/usps.php
both are updated for the following reasons:
regimark was replaced by null,
date is displayed now in the following form
First-Class Mail International Package** (Varies by country)
Priority Mail International Small Flat Rate Box** (6 - 10 business days)
Priority Mail International (6 - 10 business days)
Priority Mail International Medium Flat Rate Box (6 - 10 business days)
Express Mail International (3 - 5 business days)
Priority Mail International Large Flat Rate Box (6 - 10 business days)
5.2.2
April 7, 2011 by Fulluv Scents
removed option to insure shipping cost - it didn't work correctly
fixed international envelope options - they weren't showing
fixed delivery and signature confirmation to coincide with retail/internet options
they were previously calculating at retail regardless of whether admin
chose retail or internet rates. Thanks BigGeorge for pointing it out.
added military mail responses - will go into affect on April 17, 2011
added alternate instructions for setting time zone (for servers that won't accept ini_set)
If installing over 5.2.1, then save your USPS login ID, uninstall from admin, replace one file (catalog/includes/modules/shipping/usps.php), reinstall from admin, and reset your configuration.
International envelope options aren't being returned in 5.2.1 module. To fix, change code below. The upload includes only a text file with the same instructions.
in catalog/includes/modules/shipping/usps.php
on about line 723, change
'<MailType>Package</MailType>'
to
'<MailType>All</MailType>'
This is not a full package release except for the following:
This package is intended only for fresh installs in unmodified osc2.3.1 stores. Drop the files, replacing existing files and make a couple of changes per the instructions.
For full install instructions on any other osc version or on modified osc2.3.1 stores, see the previous full package upload.
Fixed string replacement - should have only affected USPS but also affected other methods. Fixed.
Added instructions for shipping_estimator language.
Added instructions for difference between osc2.2 and 2.3.1 file difference.
Somehow one of the codes got jumbled up when I changed the last set of instructions. This full package includes the correct code so that you won't get errors.
Includes 2 small changes to instructions.
1. Changes default css class from mainContent to main.
2. Changes code for setting store time zone.
From the USPS development guide:
USPS trademarks are trademarks owned solely and exclusively by USPS and may be used only in the form, manner and with appropriate legends prescribed by USPS. All advertising and other uses of USPS trademarks must include a legend indicating that USPS trademarks are the property of USPS and that they are being used under license from USPS, together with any other legends or marking that may be required by law. Nothing contained in this document shall be deemed to convey any title or ownership interest to any user except for the nonexclusive rights granted under the Terms and Conditions of Use for Internet Shipping Application Program Interfaces and this document. All use of USPS Trademarks shall inure to the benefit of USPS.
The trademark legends that are sent by USPS are required by law and by the terms of use to be shown. This full package will show the marks without interfering with functionality.
I'm a stickler for doing things correctly rather than hiding what is being done incorrectly, so I had to fix this.
Whether a new install or an upgrade, there are several small modifications to be made. Please pay careful attention to the instructions.
Express Mail and Express Flat Rate Envelope weight thresholds were backwards. To fix, replace the usps.php file. For fresh install or upgrade, read instructions.
Full package
Full package with instructions
Removes "days" from express transit time if date response is received.
If 5.2.0 is already installed, then just drop the files from the includes folder to replace usps and language files. If not, then see instructions for fresh install or upgrade.
A completely revised USPS module with methods and much more.
With many options in the configuration (admin) panel, this is the most
versatile and business friendly USPS module offered to date.
This module will give you complete control over your shipping options.
Options include choosing domestic and international shipping methods,
whether to display package weight, transit time, and insurance, whether
to charge retail rates or commercial rates, add delivery confirmation and/
or signature confirmation with order total threshold for sig confirmation.
Charge handling for domestic or international, insure domestic and int'l
packages via USPS or private insurance carrier. Insure purchase only, tax,
and cost of shipping if you so desire. Set weight thresholds on domestic
packages to keep your customers from choosing methods that don't apply.
Changes since the popular 4.3.2:
Added international handling
Applied V4 IntlV2 syntax / required by May, 2011
Updated transit time responses and displays
Added user defined int'l package sizes - required by new syntax
Added option to charge retail or counter prices
Added delivery confirmation
Added signature confirmation
Added signature confirmation order threshold
Added processing time (to increase the transit time displayed)
Added user defined insurance (for private postal insurance)
Updated dmstc and intl insurance responses and displays
Updated display options - to work independently
transit time, weight, and insurance
Updated option to insure tax
Added option to insure shipping cost
the language file folder was missing an S
full package - complete
ignore all previous 5.1.0 versions
UPS Methods modified for MVS (Multi Vendor Shipping)
No insurance or taxes installed.
Have not tested transit times as I do not use them
only usps.php file included
upload to catalogincludesmodulesvendors_shipping
added the correct sql statement
NOT A COMPLETE PACKAGE - readme file ONLY
README file ONLY - added in step #3 round_up function to /catalog/admin/includes/functions/general.php
and some typos (spelling errors)
January 6th, 2011 by Fulluv Scents
basic fine tuning for USPS V3 & V4 requirements
WORK IN PROGRESS - improvements forthcoming
1. Handling fees for Domestic Rates only
2. Insurance option in this module is not working
3. Domestic transit times pulled from lanugage file, International pulled from USPS
4. TODO: Insurance for Domestic, Hnalding for Internatinal, Trade and Register Marks
transit times all pulled from USPS
COMPLETE PACKAGE
repaired handling fee issue
cleaned file for easier read
full package
Collaberative effort in making all aspects of pervious 4.3.x ALPHA function with new 2011 USPS criteria
Complete package with instructions for upgrade of new and older versions. US Domestic & International rates, Domestic handling fees, International Insurance
Combined effort of: Fulluv Scents, altoid, pbolyn, wkdwich and more..
I am not 100% sure if USPS TEST server feature functions
Some members had problems with the 5.0.1 bug fix, getting white blank pages. This file, while it still has some issues, resolves that problem and returns proper rates, pages and adds handling.
Domestic:
No transit times
Doesn't have some options - flat rate boxes etc..
International
Does display transit time
holy moly there are a million rates listed.. it will only hold the first 6 or 7 as checked. I have not extensively tested this as I only use Express & Priority package
Full credit goes to ozeworks who contributed the USPS Methods 4.3.2 Fix international services
NOT A FULL PACKAGE
contains ONLY
catalogincludesmodulesshippingusps.php
Uninstall current version, upload this file, reinstall
One file only - replaces catalog/includes/modules/shipping/usps.php (version 5.0.1 original).
First class mail options were not showing estimated delivery times. Fix included in this file.
Domestic methods partially fixed to work with rate changes. No longer defaulting. Chosen shipping method will not revert at checkout.
Standard domestic methods only - Flat rate not included YET.
This is a temporary fix. It is not a clean or fully loaded module.
If anyone can get the names to work correctly for flat rate, they can also be added, but I am only including methods that are fully working.
Includes Jan 3, 2011 updates to USPS rates & methods. This is a working file with domestic and international options. Domestic options have not been fully updated. Insurance and weight threshold options are not included. First priority was getting it to work and it works. I would like to merge this with version 4.3.2 to obtain all options and will upload new version if I find time to do it.
Remove module from within admin panel. Replace existing files with uploaded files. Reinstall module from admin panel.
This is an update for 1 file only!
I went to update this module and noticed that there were deprecated configuration features, missing install files with historical information/notes from the author and someone called it a complete release... tsk tsk :P
I've restored the selectable methods although it does not separate Domestic/International as it originally did. These modules should never have the settings edited in the file its self, the whole purpose for this construct is to make these things configurable :)
What needs to be done. I would do this, but don't have the time atm... heres what needs to be done if someone want's to clean this up (or perhaps the person who did this *cough cough* lol).
You'll need to go back to the 8 Jan 2010 release to get the old install info.
Update that to reflect what's been changed and add it to the release. Make upgrade instructions like the other releases had. The current version has database differences so anyone upgrading beware as they are not documented in the install.
Compare the releases to ensure that no other useful configuration options were deprecated and reinstate them if need be.
Give it a proper version number; 2002 called... they want v1 back :P
Added 2 missing rates (First-Class LOL) and have all rates enabled.
This is a full release that supports the latest API version (V3) from USPS. It also supports all service types both domestic and international.
You can disable any service by commenting out it's description in the module file (usps.php)
Any questions email me in the forum
Tom
Fixes a bug where the selected method was not used in the final order.
This is a full release that supports the latest API version (V3) from USPS. It also supports all service types both domestic and international.
You can disable any service by commenting out it's description in the module file (usps.php)
Any questions email me in the forum
Tom
This is a full release that supports the latest API version (V3) from USPS. It also supports all service types both domestic and international.
You can disable any service by commenting out it's description in the module file (usps.php)
Any questions email me in the forum
Tom
This is a full release.
USPS changed titles of international services.
current services names are:
Global Express Guaranteed (GXG)
Global Express Guaranteed Non-Document Rectangular
Global Express Guaranteed Non-Document Non-Rectangular
USPS GXG Envelopes
Express Mail International
Express Mail International Flat Rate Envelope
Priority Mail International
Priority Mail International Large Flat Rate Box
Priority Mail International Medium Flat Rate Box
Priority Mail International Small Flat Rate Box
Priority Mail International Flat Rate Envelope
First-Class Mail International Package
First-Class Mail International Large Envelope
and these services was added.
I know that I like to be able to test my USPS before I go public with it, so I made the following change.
* Added back in the ability to choose between a test and production server.
This is a full release.
*Fixed bug caused by misplaced if statement that caused an error result if Display Transit Time was not selected
*Fixed hard coded text that should have come from language file
*Fixed error caused by reference to misspelled configuration variable
*Corrected configuration of allowed international types (Global Express Non-Document Rectangular got listed twice when one of them should have been Global Express Non-Document Non-Rectangular)
*updated US insurance costs to those current since May 11, 2009
If you already have 4.3.0 installed replace it with this version. This one at least works now.
Yet to be done:
Add handling fee definitions for International methods.
Add support for the packaging module used by UPSXML 1.3.6 since the post office also bases prices at least partly on size.
Same package as the last one except added to the troubleshooting the fact that many people experience an error when trying to run in test mode even if everything else is set up correctly.
Hope this saves some time.
This is NOT the latest version using the v3 API. However, it still works just fine. If you want the latest, download v4.0.3 ALPHA.
Since v3.0
-----------
* Added sorting of USPS rates from least to most expensive
* Added separation of weight into pounds and ounces
* Removed "without insurance" option since insurance can be turned "on" or "off" in the admin
* Updated domestic and international insurance rates to be current
Scott
v4.3.0 has Domestic and International Insurance
PLEASE NOTE: THIS IS AN ALPHA VERSION AND HAS NOT BEEN TESTED
*********************************************************
Please note: The test server option will not work because there is no test server for the v3 API. You must email USPS and ask them to switch your account to the production server and tell them you are using OSCommerce.
INSTALLATION
You must read the installation instructions towards the bottom of the text provided. A few files need to have some code added.
Changes since USPS Methods v4.3.0
-------------------------
NEW FEATURES
*Dedicated Priority Flat Rate Box and Envelope and Standard options.
*GUI weight thresholds for weight related shipping options.
*GUI handling charges for domestic shipping options
FIXES
*Added a round up function to eliminate some problems
*Fixed a couple coding errors found in the default configurations
-----------------------------
What we could use help on:
1. I want to split the weight entry for new products into lbs and oz.
MAY 12th API UPDATE COMPATIBLE WITH v4.1.3 Beta AND ABOVE
PLEASE NOTE: THIS IS AN ALPHA VERSION
************************
Please note: The test server option will not work because there is no test server for the v3 API. You must email USPS and ask them to switch your account to the production server and tell them you are using OSCommerce.
INSTALLATION
If you previously installed USPS Methods 3.0 and above, all you need is the USPS.php file, and the new language file. Just uninstall and reinstall. Otherwise, read the installation text supplied with the module.
Changes since USPS Methods v4.2.0
-------------------------
NEW FEATURES
*Put back Global Express mail options with smaller SQL entries to fit.
FIXES
*Fixed issue with PayPal Express by removing rounding function wich may cause problems
*Removed previously added priority flat rate box and flat rate envelope options due to problem with selected mail option changing before arriving at confirmation page. Will hopefully have this fixed by next release. Right now you can only use one type of priority mail.
-----------------------------
What we could use help on:
1. I want to split the weight entry for new products into lbs and oz.
MAY 12th API UPDATE COMPATIBLE WITH v4.1.3 Beta AND ABOVE
PLEASE NOTE: THIS IS AN ALPHA VERSION
************************
Please note: The test server option will not work because there is no test server for the v3 API. You must email USPS and ask them to switch your account to the production server and tell them you are using OSCommerce.
INSTALLATION
If you previously installed USPS Methods 3.0 up to 4.1.4, all you need is the USPS.php file, and the new language file. Just uninstall and reinstall. Otherwise, read the installation text supplied with the module.
Changes since USPS Methods v4.1.4
-------------------------
NEW FEATURES
*API calculated International Insurance
*User specified Domestic Insurance
*On/Off domestic and international insurance option
*Domestic insurance is current as of May 12th, 2008
FIXES
*NONE*
-----------------------------
What we could use help on:
1. I want to split the weight entry for new products into lbs and oz.
***Should be stable, but don't quote me on that one***
MAY 12th API UPDATE COMPATIBLE WITH v4.1.3 Beta AND ABOVE
PLEASE NOTE: THIS IS A BETA VERSION
************************
Please note: The test server option will not work because there is no test server for the v3 API. You must email USPS and ask them to switch your account to the production server and tell them you are using OSCommerce.
If you need to use this with insurance, please use USPS Methods 3.0 until I can upload a new version with insurance.
INSTALLATION
If you previously installed USPS Methods 3.0 up to 4.1.3, all you need is the USPS.php file. Just uninstall and reinstall. Otherwise, read the installation text supplied with the module.
Changes since USPS Methods v4.1.3 BETA
-------------------------
NEW FEATURES
*NONE*
FIXES
*Removed array listing at top of page
*Added rounding function to prevent problems with .33333333333... weight displays
-----------------------------
What we could use help on:
1. I want to split the weight entry for new products into lbs and oz.
2. I want to add package options to new products to use: envelope, parcel, non-machineable, etc.
MAY 12th API UPDATE COMPATIBLE WITH v4.1.3
PLEASE NOTE: THIS IS A BETA VERSION
************************
Please note: The test server option will not work because there is no test server for the v3 API. You must email USPS and ask them to switch your account to the production server and tell them you are using OSCommerce.
If you need to use this with insurance, please use USPS Methods 3.0 until I can upload a new version with insurance.
INSTALLATION
If you previously installed USPS Methods 3.0 up to 4.1.2, all you need is the USPS.php file. Just uninstall and reinstall. Otherwise, read the installation text supplied with the module.
Changes since USPS Methods v4.1.2 BETA
-------------------------
NEW FEATURES
*Shipping options are now listed in order from cheapest to most expensive instead of fastest to slowest.
FIXES
*Adjusted default weight for packages under .1lb to 1oz.
*Removed rounding of ounces (Not rounding can potentially cause undesireable results like .666666... so be aware that it has not been tested)
*Removed potential confusing comments
*Removed VARIABLE option from container options
-----------------------------
What we could use help on:
1. I want to split the weight entry for new products into lbs and oz.
2. I want to add package options to new products to use: envelope, parcel, non-machineable, etc.
MAY 12th API UPDATE COMPATIBLE WITH v4.1.2
PLEASE NOTE: THIS IS A BETA VERSION
************************
Please note: The test server option will not work because there is no test server for the v3 API. You must email USPS and ask them to switch your account to the production server and tell them you are using OSCommerce.
If you need to use this with insurance, please use USPS Methods 3.0 until I can upload a new version with insurance.
INSTALLATION
If you previously installed USPS Methods 3.0 up to 4.1, all you need is the USPS.php file. Just uninstall and reinstall. Otherwise, read the installation text supplied with the module.
Changes since USPS Methods v4.1 BETA
-------------------------
NEW FEATURES
*Can now have both DOMESTIC Priority Mail, Priority Flat Rate Envelope, and Priority Flat Rate Box.
*NEW for 4.1.2: I have added a weight threshold for FirstClass and ParcelPost packages so you can now have the option to change the "container"when a certain weight is reached. So say you are using FirstClass Letters to mail stickers and someone buys 100. If the weight exceeds the set ammount, you can have it change the package type to Parcel instead of Letter.
FIXES
*All mail types now have estimated delivery times
*Changed all uppercase domestic mail descriptions to lowercase
*International shipments now work with USPS v3 API after their May 12th update.
-----------------------------
What we could use help on:
1. I'd like to figure out how to sort the shipping methods from lowest to highest cost (I can't get it to do this properly using sort) But I have found out that it sorts from quickest to longest delivery time, which I would like to change.
2. I want to split the weight entry for new products into lbs and oz.
3. I want to add package options to new products to use: envelope, parcel, non-machineable, etc.
MAY 12th API UPDATE COMPATIBLE WITH v4.1
PLEASE NOTE: THIS IS A BETA VERSION
************************
Please note: The test server option will not work because there is no test server for the v3 API. You must email USPS and ask them to switch your account to the production server and tell them you are using OSCommerce.
If you need to use this with insurance, please use USPS Methods 3.0 until I can upload a new version with insurance.
INSTALLATION
If you previously installed "USPS Methods 3.0", all you need is the USPS.php file. Otherwise, read the installation text supplied with the module.
Changes since USPS Methods v4.0 ALPHA
-------------------------
*REMOVED MY EMAIL FROM THE RATE RESPONSE FUNCTION Oops :) Was wondering where all the emails were coming from?
NEW FEATURES
*New options for international First Class mail and Priority Flat Rate Boxes
FIXES
*International shipments now work with USPS v3 API after their May 12th update.
-----------------------------
What olsonsp4c and I could use help on:
1. I'd like to figure out how to sort the shipping methods from lowest to highest (I can't get it to do this properly using sort)
2. I want to split the weight entry for new products into lbs and oz.
3. I want to add package options to new products to use: envelope, parcel, non-machineable, etc.
PLEASE NOTE: THIS IS AN UNTESTED ALPHA VERSION
************************
Please note: The test server option will not work because there is no test server for the v3 API. You must email USPS and ask them to switch your account to the production server and tell them you are using OSCommerce.
If you need to use this with insurance, please use USPS Methods 3.0 until I can upload a new version with insurance.
INSTALLATION
If you previously installed "USPS Methods 3.0", all you need is the USPS.php file. Otherwise, read the installation text supplied with the module.
Changes since USPS Methods v3.0
-------------------------
*REMOVED MY EMAIL FROM THE RATE RESPONSE FUNCTION Oops :) Was wondering where all the emails were coming from?
NEW FEATURES
*Uses New USPS v3 API
*New package options due to v3 API: Flat-Rate, Letter, Small/Large package, ...
*Ability to calculate First Class Envelopes and Letters + Machineable options
FIXES
*Fixed error when installing: SQL Statement too long (Global Express shipping services removed)
*Fixed machineable setting to change to false when package is over 3.5oz
-----------------------------
What olsonsp4c and I could use help on:
1. I'd like to figure out how to sort the shipping methods from lowest to highest (I can't get it to do this properly using sort)
2. I want to split the weight entry for new products into lbs and oz.
3. I want to add package options to new products to use: envelope, parcel, non-machineable, etc.
Changes since v.2.9.6
-----------------------
Added the optional shipping insurance order totals module (checkbox): http://addons.oscommerce.com/info/5782
* Updated the code for Paypal Express http error (posted on forum)
* Fixed the admin USPS registration link to work
* Updated the modules/usps.php file to list the US shipping array so that it is readable
* Updated the insurance amount headings/descriptions in the admin
* Added additional international insurance rates in the admin in case of future USPS changes
* Updated the insurance amounts to format properly in the admin in currency
* Removed deprecated code from the english files
* Removed the library mail option as it does not apply to ecommerce
* Added estimated shipping times for all forms of domestic mail
What I could use help on:
1. I'd like this to be able to include the most up to date shipping options from USPS (ie. flat rate shipping)
2. I'd like to figure out how to sort the shipping methods from lowest to highest (I can't get it to do this properly using sort)
3. Updating USPS to utilize dimensional support (like UPSXML)
Enjoy! Scott
Before you go to the forum and post, please fully read the updated Troubleshooting section of this contribution - this is the ONLY part that is updated in this FULL PACKAGE.
The next step is I'd like to figure out a mod to this contribution where you can use a selectable insurance toggle in the checkout process, possibly AJAX. If anyone has expertise in this (especially AJAX code), please let me know and we can collaborate.
Scott
Same package as below, just updated the Update text file and added to the Troubleshooting aspect of the instructions. Not enough changes to warrent updating the version number...
Scott
I've updated a number of small things:
1. Removed "$this->_setMachinable('False');" from usps.php that had crept into the code causing Parcel Post quotes to exceed Priority Mail quotes despite the fix
2. Removed deprecated code and 1 sql insert that duplicated a sql key for old usps naming standards
3. Updated the instructions substantially and clarified some points
4. Removed drop in instructions because it just causes errors for nearly everybody - it is good for people to discover how to edit, copy, and paste code - the instructions are clear
5. Included a version with insurance and without insurance
6. Included update instructions
7. Added "Estimated:" on quotes seen in checkout shipping
That's it. This is an effort to unify and clean up this contribution and preserve changes in the 2 forks (with and without insurance)
Scott
olsonsp4c
This is my attempt to consolidate all updates and changes into one package. Could someone please try this and see that it works?
This includes Christian's fix to have correct parcel post quotes and my fixes below.
Complete package.
Scott
For those who noticed the First Class doesn't show up - it was because usps.php did not replace "First Class" with "FIRST CLASS" near the bottom of the file - also, I changed the names of the services that are output to checkout_shipping.php to be more user friendly :)
Thanks for all those who have made this useful - same as below by bkpie + my minor changes. (replace usps.php and you are done)
Scott
olsonsp4c
Thank you tarheit
This file is tarheits file that also includes the insurance module by Kevin Shelton (Thank you Kevin)
Tweaked for 2007 and only what I use. You can tweak if you need more and post it here but I am not
smart enough. :) http://www.oscommerce.com/community/contributions,2704
This adds insurance for Domestic Priority and Express Mail as well as International priority mail.
It does not cover International Express Mail as I have not worked that out yet with all the variables. Feel
free to add on to this. please
If you dont want the insurance just use the previous version from tarheit Instructions for variables included
THIS IS JUST THE USPS.PHP FILE
(2nd try. uploaded the incorrect file the first time.)
This update is identical to 2.9.2 except that the key's for all shipping methods have been capitalized so that they will be compatible with the change USPS apparently made to the values returned by their API around 11-18-2007. I don't know at this time if this is a permanent change they made so make a backup of your files before changing anything.
For new installations:
* Simply follow the original instructions.
For existing installations:
* Replace /catalog/includes/modules/shipping/usps.php with the new one included
in this package. It is the only file that is changed. (Make a backup first
in case you have to revert to the old behavior)
* Run the script update.sql to modify the configuration table in the database.
Your configuration will be preserved, it just converts them to uppercase.
You won't see the new international shipping methods reflected in your admin > modules > shipping > usps without updating your database:
Run this code in MySQL to find out your configuration id:
SELECT configuration_id from configuration where configuration_key = "MODULE_SHIPPING_USPS_TYPES_INTL";
Run this code, substitute "CONFIG_ID" for the value you received from the query above:
UPDATE `configuration` SET `configuration_value` = 'GXG, GXG Non-Doc Rect, GXG Non-Doc Non-Rect, Express, Express FlatEnv, Priority Intl, Priority Intl FlatEnv, Priority Intl FlatBox, FirstClass Intl',
`last_modified` = NULL ,
`use_function` = NULL ,
`set_function` = 'tep_cfg_select_multioption(array('GXG', 'GXG Non-Doc Rect', 'GXG Non-Doc Non-Rect', 'Express', 'Express FlatEnv', 'Priority Intl', 'Priority Intl FlatEnv', 'Priority Intl FlatBox', 'FirstClass Intl'),' WHERE `configuration_id` = 'CONFIG_ID' LIMIT 1;
I have found a problem while installing 2.9 (1) version of this contribution. i have only modified the update file 050920007_updates.txt, the rest remains the same.
I want to thank everyone that worked for this great contribution !
pederb made me aware that I didn't test my enhancement very well (shame on me) and I forgot a single quote that breaks the install SQL statement.
Thank you pederb for a quick message to me.
This is a fixed version of 2.9.
Enjoy.
Updated the names being sent back from the International Rate quotes, they were out of date and were not being shown in the checkout_shipping.php page.
If you are upgrading, I would just drop in the modified usps.php file and that would be it.
To see the changes, use WinMerge (free) and do a file comparison.
Minor correction to instructions written by grapesmuggler to make the installation steps more portable between installations.
This attachment contains the instructions for updating the USPSMethods_2.8d module to work with the USPS service and rates updates effective May 14, 2007.
This .zip file does not include code files but just instructions for updating.
FULL INSTALLATION INCLUDED:
only updated instructions file to reflect under STEP 6:
IF YOU ARE USING UPSXML_v1_2_3_1 MOD - YOU CAN SKIP STEP #6 AS THE CODE IS ALREADY IN THERE
Made a minor fix to prevent many packages from being flagged as non-machineable.
(Details:
line 83 of
catalogincludesmodulesshippingusps.php changed from
if($shipping_pounds > 35 || $shipping_ounce < 6){
to
if($shipping_pounds > 35 || ($shipping_pounds == 0 && $shipping_ounces < 6)){
Same as v2.8b. Just updated the code for Airmail Letter Post and Economy Letter Post in the catalog/includes/modules/shipping/usps.php file to the new USPS language effective 1.9.06
Was 'Airmail Letter' => 'Airmail Letter-post',
Now 'Airmail Letter' => 'Airmail Letter Post',
Was 'Surface Letter' => 'Economy (Surface) Letter-post',
Now 'Surface Letter' => 'Economy (Surface) Letter Post',
You can just just updated those lines in usps.com or replace the whole file.
I readded the necessary admin files into this including admin/modules.php and admin/includes/fuctions/general.php.
This is now the complete self contained package.
Full Package and now includes a nice pop-up page within admin containing full registration and configuration instructions.
To view, go to
ADMIN > MODULES > PAYMENT > USPS METHODS.
There is new text there and a link. This will make it very easy for developers and their customers with this quick reference guide and troubleshooting page.
I have added the insurance component from Kevin L. Shelton's 'USPS shipping with US/International insurance' contrib. I have installed it on a very modded MS 2.2 site and it appears to work just fine. I figured some others may benifit from this
note this is just the 'usps.php' file
The files are the same as directly below, I made this post in attempt to attach a thread to the contribution.
http://forums.oscommerce.com/index.php?showtopic=146950
Full Version with all changes
With all of the corrections up to the previous one (26 January, 2005) combined, ounces are not rounded off and the USPS servers return an error. This /catalog/includes/modules/shipping/usps.php incorporates all listed changes to date and corrects that by rounding ounces up.
Change the following:
$ounces = (100*$convounces);
TO:
$ounces = ($convounces);
Sorry - please use this one instead - the below file does not make the correct replacements.
To add to John Christopher's contribution, if you enter your weights in lbs (i.e., 1.5 lbs versus 1 lb 5 ounces), you should replace:
$ounces = (100 * $shipping_weight - floor($shipping_weight) );
if($ounces >= 16)
{
$shipping_ounces += $ounces % 16;
$shipping_pounds += floor($ounces / 16);
}
else
{
$shipping_ounces += $ounces;
}
----------------------------------------
WITH:
$shipping_weight = ($shipping_weight < 0.1 ? 0.1 : $shipping_weight);
$getounces = ($shipping_weight - floor($shipping_weight));
$convounces = ($getounces / 0.0625);
$ounces = (100 * $convounces);
if($ounces >= 14)
{
$shipping_pounds = (floor($shipping_weight) + 1);
$shipping_ounces = 0;
}
else
{
$shipping_pounds = floor($shipping_weight);
$shipping_ounces = $ounces;
}
Around line 76 and 77 in modules/shipping/usps.php the shipping_pounds and shipping_ounces
variables are calculated. These were being calculated incorrectly. For instance,
Suppose a customers shopping cart contained two items, and you always added .08 ounces for
every package.
product1 weight 0.16 ounces
procuct2 weight 0.03 ounces
packing weight 0.08 ounces
total weight 0.27 ounces
The old code would get 0 pound and 3 ounces.
The new code would get 1 pound and 11 ounces,which is correct.
Sometime this month USPS must have change the SvcDescription that the Priority Var method uses. On line 54 of usps.php change:<br>
<br>
'Priority Var' => 'Global Priority Mail - Variable Weight Envelope (Single)',<br>
<br>
to<br>
<br>
'Priority Var' => 'Global Priority Mail - Variable Weight (Single)',
Changes since v2.6b
----------------
*fixed a variable declaration bug.
Changes since v2.6a
------------------
* Fixed the parcel post bug where the parcel postage would be greater than priority mail.
* Added in logic/code to ./includes/modules/shipping/usps.php to determine if a package is machinable or non-machinable which determines if the parcel postage would cost more.
* Saved customers a ton of confusion on checkout. ^^
Added instructions with proper coding to manually install the modified files "modules.php" and "general.php". If you have an already modified store and you following the previous instructions you will get errors, and other contribs like "PayPal Shopping Cart IPN" AND "Header Tags Controller" will no longer work. Follow the instructions I have added to make this contrib work without harming an already modified store.
In order to use the USPS shipping modules in osCommerce, you need a Web Tools account. The URL's in the documentation are incorrect as things have changed recently on the USPS web site. To sign up you need to go here:
http://www.uspswebtools.com/registration/
Also note that the test system doesn't work with osCommerce at present, so you need to switch to the production system to get this working.
Changes since v2.6
------------------
* added service type literals for Bound Printed Material, Library and Media Mail, so these are recognized and offered as domestic choices
* remove duplicate configuration table entry MODULE_SHIPPING_USPS_TAX_CLASS
Changes since 2.5:
------------------
service type literals revised to current XML responses from USPS a/o 9Oct2003
Changes since v2.3
------------------
* Brought current with MS2
* Added troubleshooting hook
Changes since v2.3
------------------
* Brought current with MS1
* Fixed transit time display bug
* Supports deselecting all checkboxes
* Brought current with most recent cvs:
Separate handling charge per shipping module
Hard coded error message is in language file
Shipping charge is taxable
* Repackaged as full files instead of diffs
USPSMethods v2.2 for osCommerce 2.2 CVS
Copyright 12/7/02 by Brad Waite (brad@wcubed.net)
Released under the GPL.
Description
-----------
This allows a site owner to choose which international and domestic USPS
shipping methods will be available to the customer. Settings can be changed in
the admin interface under Modules->Shipping->United States Postal Service.
For example, if you select "Express" and "Priority", then a customer will only
be shown those two options for USPS shipping.
USPSMethods also allows you to choose whether to display the package weight and
transit times (also called service standards).
IMPORTANT NOTE: These files include a fix for bug 830 (USPS Module intl quote
always reverts to Global Express) which at the time of writing has been
submitted but not approved.
Questions or comments to brad@wcubed.net.
Changes since v2.1
------------------
* Fixed typos in Step 5 of the instructions. Kevin Cashman was the bugcatcher
this time.
this time.
Changes since v2.0
------------------
* Fixed a major bug that halted the installation process.
* Fixed minor bug that complained about a variable type when the destination
country was international.
* Added the new files to the contrib in addition to the diffs to retain others'
sanity as well. Another one of Fritz's insightful suggestions.
Changes since v1.1
------------------
* Changed to a patch-based install to keep my sanity.
* Added international services support (More thanks go to Fritz Clapp).
* Added options to enable/disable weight and transit time display.
Changes since v1.0
------------------
* Adjusted code to reflect usps.php module in CVS.
* Added required SQL to install() function in usps.php (step 7).
Thanks to Fritz Clapp (zzfritz) for both.
Description
-----------
This allows a site owner to choose which international and domestic USPS
shipping methods will be available to the customer. Settings can be changed in
the admin interface under Modules->Shipping->United States Postal Service.
For example, if you select "Express" and "Priority", then a customer will only
be shown those two options for USPS shipping.
USPSMethods also allows you to choose whether to display the package weight and
transit times (service standards).
IMPORTANT NOTE: These diffs include a fix for bug 830 (USPS Module intl quote
always reverts to Global Express) which at the time of writing has been
submitted but not approved.
Questions or comments to brad@wcubed.net.
Changes since v2.0
------------------
* Fixed a major bug that halted the installation process.
* Fixed minor bug that complained about a variable type when the destination
country was international.
* Added the new files to the contrib in addition to the diffs to retain others'
sanity as well. Another one of Fritz's insightful suggestions.
Changes since v1.1
------------------
* Changed to a patch-based install to keep my sanity.
* Added international services support (More thanks go to Fritz Clapp).
* Added options to enable/disable weight and transit time display.
Changes since v1.0
------------------
* Adjusted code to reflect usps.php module in CVS.
* Added required SQL to install() function in usps.php (step 7).
Thanks to Fritz Clapp (zzfritz) for both.
This allows a site owner to choose which international and domestic USPS
shipping methods will be available to the customer. Settings can be changed in
the admin interface under Modules->Shipping->United States Postal Service.
For example, if you select "Express" and "Priority", then a customer will only
be shown those two options for USPS shipping.
USPSMethods also allows you to choose whether to display the package weight and
transit times (service standards).
IMPORTANT NOTE: These diffs include a fix for bug 830 (USPS Module intl quote
always reverts to Global Express) which at the time of writing has been
submitted but not approved.
Questions or comments to brad@wcubed.net.
Changes since v1.1
------------------
Changed to a patch-based install to keep my sanity.
Added international services support (More thanks go to zzfritz).
Added options to enable/disable weight and transit time display.
Changes since v1.0
------------------
Adjusted code to reflect usps.php module in CVS.
Added required SQL to install() function in usps.php (step 7).
Thanks to zzfritz for both.
This allows a site owner to choose which domestic USPS shipping methods will be
available to the customer. Settings can be changed in the admin interface
under Modules->Shipping->United States Postal Service.
For example, if you select "Express" and "Priority", then a customer will only
be shown those two options for USPS shipping.
As of the current version, USPS international shipping options cannot be selected.
Questions or comments to brad@wcubed.net.
Changes since v1.0
------------------
Adjusted code to reflect usps.php module in CVS.
Added required SQL to install() function in usps.php (step 7).
Thanks to zzfritz for both.
This allows a site owner to choose which USPS shipping methods will be available
to the customer. Settings can be changed in the admin interface under
Modules->Shipping->United States Postal Service.
For example, if you select "Express" and "Priority", then a customer will only
be shown those two options for USPS shipping.
NOTE: as a side benefit, you can now have a list of configuration options for a
given configuration_key with the new tep_cfg_select_multioption() function.
