Here are the installation instructions for the USPS Shipping Module for Prestashop. This is an advanced install and requires not just loading the module, but installing a new class and updating several others, an upgrade to an administration tab, as well as a theme upgrade and installation of a plugin for the smarty template system.
I wish it was simpler, but I have not found a way to implement all the features needed for the USPS API without all of these changes. Core files have been edited the least amount possible to ensure operation. The most recent release is version 0.3.2, which is a bug fix release addressing errors relating to operation with the AJAX portion of the cart module, as well as zone errors in the Carrier Admin section.
New Installation
- First you must get a user id from USPS. You can do so at USPS Webtools.
- Now to upload files to Prestashop. The folder called classes has three files, cart.php, carrier.php and uspsRate.php. Upload these files to the classes folder in your prestashop installation. Cart.php will overwrite Prestashop’s default cart.php and carrier.php will do the same. You may want to rename those files to cart.php.old and carrier.php.old before you upload the new cart and carrier files. Upload the entire blockusps folder to the folder called modules in your prestashop installation.
- There is a folder called tabs with a file called AdminCarriers.php. The tabs folder is in your admin folder, which Prestashop required you to give a unique name when you installed your shop. The folder named smarty has a file named compiler.continue.php. This file goes into /tools/smarty/plugins/. The final file is in the themes folder and is named order-carrier.tpl. This file goes into your theme folder and replaces your current order-carrier.tpl. This goes into whatever theme you have activated for your shop and should be compatible with most, if not all, of the currently published themes available for download.
- Version 0.3.1 added two new file updates. There is a file called blockcart-json.php, that needs to be uploaded into your modules-blockcart folder. This file only deletes extra whitespace in the prior file that I believe was contributing to the AJAX errors. The 2nd file is only for Prestashop version 1.2. In your main Presta folder there is order.php. Rename your old order.php and upload the new version.
- Visit the Modules section in the back office of your Prestashop site. The USPS Module should now show up under Core Improvements. To install the module, simply click the install button next to the module information.
- After installing, a configure link will show up next to the USPS Plugin on the modules page. We need to go there to configure the Module for proper operation.
- The configure page has USPS Account Settings on the upper left. Please place your USPS ID next to User and your zip code (where you send packages from) in the Zip Code field. Then click Update Settings.
- If you are approved for the production server, you can put the plugin into live mode. Otherwise you will have to put it into test mode.
- The add a Shipping Method field allows you to choose between Priority, Express and Parcel Post. Choose one or more and click Add a Shipping method button. –note that US is the only zone that works right now as USPS uses a different API for intl.–
- When you select a method it will show up in the Configure Shipping Methods field. Here you use the select box to turn the method of shipping on or off. You can also turn Free Shipping for that method on or off. Free Shipping settings are input in the Shipping section of your Prestashop Back Office.
- If you are in test mode, run a test purchase through your shop. On the shipping page you should get this message ** 80040b1a API Authorization failure. RateV3 is not a valid API name for this protocol. UspsCom::DoAuth **. That seems like an error, but it is a successful test. Refresh the screen several times, then e-mail or call USPS and tell them you are ready to go to the production server.
- If you would like to utilize the optional Box Measurement for more accurate quotes, you will need to turn it on in Account Settings. You will also have to click the Install Box Size button, which adds fields to your product database. If Box Measurement is active, you will have to manually input product measurements for each of the products in your Prestashop store. You will be able to do this in the features section for the product in your catalog.
- The optional Machinable module works the same way as Box Measurement. Machinable packages cost less to ship and enable your shop to show lower rates, possibly converting more sales in certain situations. The USPS API defaults to false on machinable. If you activate this module, you will have to update all the items in your shop with a value for machinable. This will be done in the features section.
NOTE – If you change Free Shipping Preferences/Options (the price or weight for free shipping, not whether to offer it or not), it will take five minutes for the shipping cache to catch up to your changes. You could optionally DELETE * FROM usps_cache in our phpmyadmin screen.
Instructions For UPS Users
1. Follow the above instructions for a new Install. In step 2 you need to replace carrier.php from your UPS module with the one from this module. The USPS module’s carrier.php contains all the functions necessary to run your UPS install. You do not need to replace cart.php as they are now the same for both plugins. In step 3 replace AdminCarriers.php with the one from this module. It contains all the functionality you need to operate your UPS Module. Finally, if you are using Prestashop 1.2, replace order.php in your main Presta folder.
Instructions For Upgrade
***If you are upgrading to 0.3.2 from 0.3.1 you only need to replace Carrier.php, uspsRate.php and AdminCarriers.php. You can replace the blockusps folder if you would like your modules page to reference the correct version number.***********
1.Uninstall the previous version of the USPS plugin on your modules page. I will work on an upgrade script for future versions so this won’t be necessary.
2.Replace, in the classes folder, cart.php, carrier.php and uspsrate.php. Save backups of the old files if necessary. You will also need to add the AdminCarriers.php, as well as the update to your theme and the Smarty plugin. Those instructions are on step 3 above. Finally, if you are using Prestashop 1.2, replace order.php in your main Presta folder.
3.Replace the files in the folder modules/blockusps with the new folder of files
4.Follow the setup instructions from step 4 if you don’t remember how to activate and configure the plugin.
Hi, I tried to install this module on my shop but when I actually hit the install icon, I got this:
Table ’slpubli1_shoppe.shop_usps_cache’ doesn’t exist
ALTER TABLE `shop_usps_cache` ADD INDEX (`id_customer`)
How do I fix this?
Thanks!
same error
I’m sorry I missed this. I answered on the Presta forums and missed here. There is an error in the uspsInstall.sql in the blockusps folder. This line
ALTER TABLE `shop_usps_cache` ADD INDEX (`id_customer`);should read like this
ALTER TABLE `PREFIX_usps_cache` ADD INDEX (`id_customer`);I don’t have a final date for the next version, but it will be much easier to install as it will only affect one core file, and will be much more of a true module.
I fixed the ’shop’ to ‘prefix’ part of the code but now I am getting this error:
Duplicate column name 'usps_id'
ALTER TABLE `ps_carrier` ADD usps_id int(10)
Whem I add an item to cart, the shipping cost on the ajax cart often shows up as free. The module works fine on the shipping page of checking out however. It is just often free on the cart. Is there a way to fix this?
I am receiving an entirely different problem with the UPS module that is compatible with. I installed it, added the upscarrier file, and shipping constantly shows up as free for any UPS shipping method. Is there any way to fix this as well?
I’m getting the same error as harial. Please help!
hello, i installed everything but when i try to purchase a product and get the shipping it says that the sender zip is not valid. how and where do i change this to my zip code? thanks for the module…
USPS Error: API Authorization failure. RateV3 is not a valid API name for this protocol.
any fix to this problem?
Duplicate column name ‘usps_id’
ALTER TABLE `ps_carrier` ADD usps_id int(10)
Thanks in advance, great module, once i get it working i wold love to doante.
Hi,
I have installed USPS module for my client. It was working fine. I have checked it several times but now it is not giving any quotes. It results:
Shipping Cost: $null
What i should do now. I shell be waiting for your quick response.
Thanks