USPS Shipping Module v4.0

(1/20) > >>

UPDATE 2/3/2010: v4.2 released
v4.2 corrects changes to USPS shipping options effective 1/4/2010. Lastest version found on my website.

UPDATE 6/12/2008: v4.0 stable released: no longer a release candidate. There are no modifications of the code from v4.0RC2 to v4.0 stable. So v4.0RC2 users do not have to upgrade.

UPDATE 5/17/2008: v4.0RC2 released to support VM1.1 and J!1.5

I have rewritten the USPS shipping module based on Corey Koltz's last updated version. I incremented it to v4 since it is a total rewrite of original process.

You can download the file at the bottom of this thread or from my website.

If the module works for you donations are welcome! Thanks!

Enhancements done in v4.0:
Module works in J!1.0.x and J!1.5.x. Also VM 1.0.x and VM 1.1.Module totally rewritten to compare the shipping service text from USPS with the shipping service text enabled in VM. This avoids all the problems when USPS changes the ordering of the services in the XML or when certain shipping methods are not available based on the weight. Therefore the service names in the configuration file should NOT be changed. A future release will provide the ability to automatically update the USPS service names in the configuration menu. USPS does not return a unique identifier for each domestic service so the service name had to be used for this to work properly.Changes to use USPS API v3 for domestic shipments.Ability to enter a proxy server in configuration menu.Ability to turn on/off the displaying of errors from the USPS service on the frontend.Ability to turn on/off the failover to standard shipping if a USPS error occurs or there are no active USPS shipping methods for order.Change the prefix which appears in front of the shipping options returned from USPS service in configuration settings.Ability to customize the shipping commitment (delivery days quote) on domestic shipping options since USPS does not return this information for domestic rates.If total weight exceeds 70 pounds the module will trigger the standard shipping methods (if enabled).Enhancements to work correctly with fsockopen. This method is used if cURL is not installed on the web server.Corrections to fix some weight calculations as suggested by cw733. Ounces will also round up to the nearest integer and pounds will round down to the nearest integer. This provides more accurate shipping costs since the USPS service will adjust the pounds based on the services.Removed "International Per Pound Rate" from configuration since it was not being used in the module.Enhancements to the configuration descriptions and tooltips to provide better information.Added support to the international handling fee to allow a percentage amount as well as a dollar amount. This was a suggestion from cw733.Added feature to write warning message on configuration screen if the configuration file is not writable (this was particularly helpful prior to J1.5)
* Installing / Upgrading VM's USPS Module *

These instructions are for installing and configuring the USPS v4.0. The entire structure of the module was reworked in this release so all previous hack comments were removed from the code. Also, v4.0 uses different file names so the older version and the new v4.0 can be installed in VM at the same time to allow for turning on/off of the shipping modules.

Copy over the new files into the "/administrator/components/com_virtuemart/classes/shipping" directory.  These include 3 files:


NOTE: The new version has unique file names to avoid overwriting previous version.

Now go into the VM Administrator and go to "Store -> Shipping Module List". If you previously had the USPS module installed, you should now see two USPS modules. The new version will have "4.0" in the version column and should not be active at this point. If this is the first time installing the USPS module there will only be the one module.

Click on "Configure Ship Method" under the "4.0" version and enter your configuration settings. Some of these like; username, server and path should be the same as your previous version. NOTE: USPS password should be blank.

Once all setting have been selected click on the "Save" button to save your configuration.

Once the configuration settings have been saved enable the new USPS shipping method (and deactivate the old one if being used). See steps below for more information.

New Users:  To enable USPS shipping, follow these instructions:
1. Go into the Virtuemart backend
2. Click on Admin -> Configuration, now select the Shipping tab.
3. Click the USPS checkbox and click the save button. If multiple USPS shipping methods exist ensure the title says "The USPS Shipping module v4.0 supporting USPS API v3."

Excellent work Chaz thanks a lot!

Hello! Here is the error I'm getting when I try to save the configuration to the new module: failed to open stream: Permission denied in public_html/administrator/components/com_virtuemart/classes/shipping/uspsv4.php on line 792

Error writing to configuration file

I am also having a similar problem. I have copied the three files as instructed, have selected the new module in both Admin>Config>Shipping and Store>Shipping Module List, but when I try to Configure Ship Method, all I get is the message "Direct Access to this location is not allowed."

btw, I am running VM 1.1.0

Make sure the uspsv4.cfg.php file is writable by your webserver. A typical problem can occur if you ftp your files to the server with a user different then running as the webserver. The web sever user must have write privileges to the file.


[0] Message Index

[#] Next page